|
QSint Library
0.2.2
|
Class representing drop-down menu of QTabWidget's tabs. More...
#include <tablistmenu.h>
Inherits QMenu.
Public Slots | |
| void | setAllowIcons (bool allow=true) |
| virtual void | createMenu () |
| virtual void | switchTab (QAction *from) |
Public Member Functions | |
| TabListMenu (QWidget *parent=0) | |
| void | setTabs (QTabWidget *tabs) |
| QTabWidget * | tabs () const |
| bool | iconsAllowed () const |
Protected Member Functions | |
| virtual void | doCreateMenu (QTabWidget *tabs) |
| virtual void | doCreateMenuItem (int index, bool current, QAction *item, QTabWidget *tabs) |
| virtual void | doSwitchTab (QAction *from, QTabWidget *tabs) |
Class representing drop-down menu of QTabWidget's tabs.
TabListMenu makes it easy to provide drop-down menu with a list of opened tabs, which highlights the current one and allows to switch between the tabs by choosing the corresponding menu items.
Typycally you'd like to create a corner button at the right (or left) QTabWidget's edge and assign the menu to it using setTabs().
An example how to use TabListMenu with QTabWidget and corner button. Only 3 lines of code needed.
You can also easily customize menu's items by subclassing TabListMenu's methods doCreateMenuItem() or/and doCreateMenu().
An example how to customize 1st menu item by naming it "Main Page" and adding a separator after it.
|
explicit |
Constructor.
|
virtualslot |
This slot is called internally when QMenu::aboutToShow() signal is emitted. You can reimplement it in order to customize TabListMenu behavior. By default it clears the menu and calls doCreateMenu().
|
protectedvirtual |
This function is called internally before menu is shown. You can reimplement it in order to populate the menu manually.
Default implementation calls doCreateMenuItem() for each tab of QTabWidget tabs separately.
|
protectedvirtual |
This function is called from doCreateMenu() for each tab separately. You can reimplement it in order to change item's representation.
Default implementation creates QAction item of QTabWidget tabs's tab with index index. If this tab is current one, then current is set to true.
In order to perform tab switching, it sets item's data value to the corresponding tab index. This value is being checked in doSwitchTab() when the user chooses an item from the menu.
|
protectedvirtual |
This function is called internally when QAction from of QTabWidget tabs was triggered by the user. You can reimplement it in order to switch the tab manually.
Default implementation switches current tab of tabs to from->data().
|
inline |
Returns true if icons are allowed, false otherwise.
|
inlineslot |
When allow is true, allows icons to be shown in the menu (enabled by default).
| void QSint::TabListMenu::setTabs | ( | QTabWidget * | tabs | ) |
The most important fuction which assigns QTabWidget tabs to the menu.
|
virtualslot |
This slot is called when menu item from has been selected by the user. You can reimplement it in order to customize TabListMenu behavior. By default it calls doSwitchTab().
|
inline |
Returns QTabWidget assigned to the menu or 0 if no QTabWidget assigned.