kspread

KSpread::TabBar Class Reference

The TabBar class provides a tab bar, for use to switch active page/sheet in a document. More...

#include <TabBar.h>

Inheritance diagram for KSpread::TabBar:

List of all members.

Public Slots

void addTab (const QString &text)
void clear ()
void moveTab (int tab, int target)
void removeTab (const QString &text)
void renameTab (const QString &old_name, const QString &new_name)
void scrollBack ()
void scrollFirst ()
void scrollForward ()
void scrollLast ()
void setActiveTab (const QString &text)
void setReadOnly (bool ro)
void setReverseLayout (bool reverse)
void setTabs (const QStringList &list)
QSize sizeHint () const

Signals

void contextMenu (const QPoint &pos)
void doubleClicked ()
void tabChanged (const QString &_text)
void tabMoved (unsigned tab, unsigned target)

Public Member Functions

 TabBar (QWidget *parent=0, const char *name=0)
virtual ~TabBar ()
QString activeTab () const
bool canScrollBack () const
bool canScrollForward () const
unsigned count () const
void ensureVisible (const QString &tab)
bool readOnly () const
bool reverseLayout () const
QStringList tabs () const

Protected Slots

void autoScrollBack ()
void autoScrollForward ()

Protected Member Functions

virtual void mouseDoubleClickEvent (QMouseEvent *ev)
virtual void mouseMoveEvent (QMouseEvent *ev)
virtual void mousePressEvent (QMouseEvent *ev)
virtual void mouseReleaseEvent (QMouseEvent *ev)
virtual void paintEvent (QPaintEvent *ev)
virtual void resizeEvent (QResizeEvent *ev)
virtual void wheelEvent (QWheelEvent *e)

Properties

QString activeTab
unsigned count
bool readOnly
QStringList tabs

Detailed Description

The TabBar class provides a tab bar, for use to switch active page/sheet in a document.

The tab bar is typically used in the main view. It is the small widget on the bottom left corner. Pages/sheets are displayed as tabs, clicking on one of the tab will activate the corresponding sheet (this is actually done in main view). Current active page/sheet is marked by bold text.

The tab bar supports page/sheet reorder by dragging a certain tab and move it to another location. The main view should handle the necessary action to perform the actual reorder.

There are four scroll buttons available in the tab bar. They are used to shift the tabs in left and right direction, for example when there are more tabs than the space available to display all tabs.

Since a page/sheet can be hidden, the tab bar only shows the visible page/sheet. When a hidden page or sheet is shown again, it will be on the same position as before it was hidden.

When the document is protected, it is necessary to set the tab bar as read-only using setReadOnly (see also readOnly). If it is set to true, tabs can not be moved by dragging and context menu will not be displayed.

A bar with tabs and scroll buttons.

Definition at line 67 of file TabBar.h.


Constructor & Destructor Documentation

KSpread::TabBar::TabBar ( QWidget parent = 0,
const char *  name = 0 
) [explicit]

Creates a new tabbar.

Definition at line 352 of file TabBar.cpp.

KSpread::TabBar::~TabBar (  )  [virtual]

Destroy the tabbar.

Definition at line 385 of file TabBar.cpp.


Member Function Documentation

QString KSpread::TabBar::activeTab (  )  const

Returns the active tab.

void KSpread::TabBar::addTab ( const QString text  )  [slot]

Adds a tab to the tab bar.

Definition at line 391 of file TabBar.cpp.

void KSpread::TabBar::autoScrollBack (  )  [protected, slot]

Definition at line 622 of file TabBar.cpp.

void KSpread::TabBar::autoScrollForward (  )  [protected, slot]

Definition at line 634 of file TabBar.cpp.

bool KSpread::TabBar::canScrollBack (  )  const

Returns true if it is possible to scroll one tab back.

See also:
scrollBack

Definition at line 484 of file TabBar.cpp.

bool KSpread::TabBar::canScrollForward (  )  const

Returns true if it is possible to scroll one tab forward.

See also:
scrollForward

Definition at line 492 of file TabBar.cpp.

void KSpread::TabBar::clear (  )  [slot]

Removes all tabs.

Definition at line 413 of file TabBar.cpp.

void KSpread::TabBar::contextMenu ( const QPoint pos  )  [signal]

This signal is emitted whenever the tab bar is right-clicked.

Typically it is used to popup a context menu.

unsigned KSpread::TabBar::count (  )  const

Returns number of tabs.

This is the same as TabBar::tabs().count()

void KSpread::TabBar::doubleClicked (  )  [signal]

This signal is emitted whenever the tab bar is double-clicked.

void KSpread::TabBar::ensureVisible ( const QString tab  ) 

Ensures that specified tab is visible.

Definition at line 568 of file TabBar.cpp.

void KSpread::TabBar::mouseDoubleClickEvent ( QMouseEvent ev  )  [protected, virtual]

Reimplemented from QWidget.

Definition at line 816 of file TabBar.cpp.

void KSpread::TabBar::mouseMoveEvent ( QMouseEvent ev  )  [protected, virtual]

Reimplemented from QWidget.

Definition at line 761 of file TabBar.cpp.

void KSpread::TabBar::mousePressEvent ( QMouseEvent ev  )  [protected, virtual]

Reimplemented from QWidget.

Definition at line 720 of file TabBar.cpp.

void KSpread::TabBar::mouseReleaseEvent ( QMouseEvent ev  )  [protected, virtual]

Reimplemented from QWidget.

Definition at line 749 of file TabBar.cpp.

void KSpread::TabBar::moveTab ( int  tab,
int  target 
) [slot]

Moves a tab to another position and reorder other tabs.

Example 1: if there are four tabs A - B - C - D, then moveTab(2,1) will yield A - C - B - D. This is because 2nd tab (i.e C) is moved to a position before 1th tab (i.e B).

Example 2: for these tabs: X - Y - Z, moveTab(0,3) will move tab X after tab Z so that the result is Y - Z - X.

Definition at line 588 of file TabBar.cpp.

void KSpread::TabBar::paintEvent ( QPaintEvent ev  )  [protected, virtual]

Reimplemented from QWidget.

Definition at line 646 of file TabBar.cpp.

bool KSpread::TabBar::readOnly (  )  const

Returns true if the tab bar is read only.

void KSpread::TabBar::removeTab ( const QString text  )  [slot]

Removes a tab from the bar.

If the tab was the active one then no tab will be active. It is recommended to call setActiveTab after a call to this function.

Definition at line 399 of file TabBar.cpp.

void KSpread::TabBar::renameTab ( const QString old_name,
const QString new_name 
) [slot]

Renames a tab.

Definition at line 705 of file TabBar.cpp.

void KSpread::TabBar::resizeEvent ( QResizeEvent ev  )  [protected, virtual]

Reimplemented from QWidget.

Definition at line 693 of file TabBar.cpp.

bool KSpread::TabBar::reverseLayout (  )  const

Returns true if tabs and scroll buttons will be laid out in a mirrored (right to left) fashion.

Definition at line 432 of file TabBar.cpp.

void KSpread::TabBar::scrollBack (  )  [slot]

Scrolls one tab back.

Does nothing if the leftmost tab (rightmost tab when reverseLayout is true) is already the first tab.

See also:
canScrollBack

Definition at line 500 of file TabBar.cpp.

void KSpread::TabBar::scrollFirst (  )  [slot]

Scrolls to the first tab.

Does nothing if the leftmost tab (rightmost tab when reverseLayout is true) is already the first tab.

See also:
canScrollBack

Definition at line 527 of file TabBar.cpp.

void KSpread::TabBar::scrollForward (  )  [slot]

Scrolls one tab forward.

Does nothing if the rightmost tab (leftmost tab when reverseLayout is true) is already the last tab.

See also:
canScrollForward

Definition at line 513 of file TabBar.cpp.

void KSpread::TabBar::scrollLast (  )  [slot]

Scrolls to the last tab.

Does nothing if the rightmost tab (leftmost tab when reverseLayout is true) is already the last tab.

See also:
canScrollForward

Definition at line 538 of file TabBar.cpp.

void KSpread::TabBar::setActiveTab ( const QString text  )  [slot]

Sets active tab.

Definition at line 606 of file TabBar.cpp.

void KSpread::TabBar::setReadOnly ( bool  ro  )  [slot]

Sets the tab bar to be read only.

If the tab bar is read only, tab reordering is not allowed. This means that signal tabMoved, contextMenu and doubleClicked would not be emitted.

Definition at line 427 of file TabBar.cpp.

void KSpread::TabBar::setReverseLayout ( bool  reverse  )  [slot]

If reverse is true, dialogs and scroll buttonswidgets will be laid out in a mirrored as if the sheet is in right to left languages (such as Arabic and Hebrew).

Definition at line 437 of file TabBar.cpp.

void KSpread::TabBar::setTabs ( const QStringList list  )  [slot]

Replaces all tabs with the list of strings.

Definition at line 448 of file TabBar.cpp.

QSize KSpread::TabBar::sizeHint (  )  const [slot]

Definition at line 700 of file TabBar.cpp.

void KSpread::TabBar::tabChanged ( const QString _text  )  [signal]

Emitted if the active tab changed.

void KSpread::TabBar::tabMoved ( unsigned  tab,
unsigned  target 
) [signal]

This signal is emitted whenever a tab is dragged, moved and released.

This means that the user wants to move a tab into another position (right before target).

When the signal is emitted, the tabs are not reordered. Therefore if you just ignore this signal, than no tab reorder is possible. Call moveTab (from the slot connected to this signal) to perform the actual tab reorder.

QStringList KSpread::TabBar::tabs (  )  const

Returns all the tab as list of strings.

void KSpread::TabBar::wheelEvent ( QWheelEvent e  )  [protected, virtual]

Reimplemented from QWidget.

Definition at line 824 of file TabBar.cpp.


Property Documentation

QString KSpread::TabBar::activeTab [read, write]

Definition at line 71 of file TabBar.h.

unsigned KSpread::TabBar::count [read]

Definition at line 74 of file TabBar.h.

bool KSpread::TabBar::readOnly [read, write]

Definition at line 72 of file TabBar.h.

QStringList KSpread::TabBar::tabs [read, write]

Definition at line 73 of file TabBar.h.


The documentation for this class was generated from the following files: