libyui-qt-pkg
|
#include <YQPkgFilterTab.h>
Public Slots | |
void | showPage (QWidget *page) |
void | showPage (const QString &internalName) |
void | closeCurrentPage () |
void | loadSettings () |
void | saveSettings () |
void | closeAllPages () |
Signals | |
void | currentChanged (QWidget *newPageContent) |
Public Member Functions | |
YQPkgFilterTab (QWidget *parent, const QString &settingsName) | |
virtual | ~YQPkgFilterTab () |
void | addPage (const QString &pageLabel, QWidget *pageContent, const QString &internalName) |
QWidget * | rightPane () const |
YQPkgDiskUsageList * | diskUsageList () const |
YQPkgFilterPage * | findPage (QWidget *pageContent) |
YQPkgFilterPage * | findPage (const QString &internalName) |
YQPkgFilterPage * | findPage (int tabIndex) |
int | tabCount () const |
virtual bool | eventFilter (QObject *watchedObj, QEvent *event) |
Protected Slots | |
void | showPage (int tabIndex) |
void | showPage (QAction *action) |
void | contextMovePageLeft () |
void | contextMovePageRight () |
void | contextClosePage () |
Protected Member Functions | |
void | showPage (YQPkgFilterPage *page) |
bool | postTabContextMenu (const QPoint &pos) |
void | swapTabs (YQPkgFilterPage *page1, YQPkgFilterPage *page2) |
Widget for "tabbed browsing" in packages:
/------\/------\/------\ [View v] | Tab1 || Tab2 || Tab3 | [Close] +-----------------+------------------------------------+ | | | | QStackedWidget: | Right pane | | | | | Filter pages | (application defined) | | | | | | | | | | . . . . . . . . . | | | +-----------------+------------------------------------+
Each filter page corresponds to one tab and a number of widgets in a QStackedWidget in the left filter pane. When tabs are switched, the corresponding filter page is raised to the top of the widget stack. The right pane, however, remains unchanged.
Only a small numbers of filter pages is displayed as open tabs right away. Each of the other filter pages is shown in a new tabs when the user requests it via the pop-up menu on [View] button. Similarly, the tabs for all but the last filter pages can be closed with the [Close] button.
The left (filter page) and right panes are separated with a user-moveable splitter.
YQPkgFilterTab::YQPkgFilterTab | ( | QWidget * | parent, |
const QString & | settingsName ) |
Constructor. 'settingsName' is the name to use to save and load settings.
|
virtual |
Destructor.
void YQPkgFilterTab::addPage | ( | const QString & | pageLabel, |
QWidget * | pageContent, | ||
const QString & | internalName ) |
Add a page with a user-visible "pageLabel", a widget with the page content and an internal name (or ID). 'pageContent' will be reparented to a subwidget of this class.
|
slot |
Close all currently open pages.
|
slot |
Close the current page unless this is the last visible page.
|
protectedslot |
Close the current tab page (from the context menu).
|
protectedslot |
Move the current tab page (from the context menu) one position to the left.
|
protectedslot |
Move the current tab page (from the context menu) one position to the right.
|
signal |
Emitted when the current page changes. NOT emitted initially for the very first page that is shown.
YQPkgDiskUsageList * YQPkgFilterTab::diskUsageList | ( | ) | const |
Return the disk usage list widget or 0 if there is none.
|
virtual |
Event filter to catch mouse right clicks on open tabs for the tab context menu. Returns 'true' if the event is processed and consumed, 'false' if processed should be continued by the watched object itself.
Reimplemented from QObject.
YQPkgFilterPage * YQPkgFilterTab::findPage | ( | const QString & | internalName | ) |
Find a filter page by its internal name. Return 0 if there is no such page.
YQPkgFilterPage * YQPkgFilterTab::findPage | ( | int | tabIndex | ) |
Find a filter page by its tab index. Return 0 if there is no such page.
YQPkgFilterPage * YQPkgFilterTab::findPage | ( | QWidget * | pageContent | ) |
Find a filter page by its content widget (the widget that was passed to addPage() ). Return 0 if there is no such page.
|
slot |
Load settings, including which tabs are to be opened and in which order. Return 'true' if settings could be loaded, 'false' if not.
Applications should call this after all pages have been added so the open tabs can be restored the same way as the user left the program. If tabCount() is still 0 afterwards, there were no settings, so it might make sense to open a number of default pages.
|
protected |
Open the tab context menu for the tab at the specified position. Return 'true' upon success (i.e., there is a tab at that position), 'false' upon failure.
QWidget * YQPkgFilterTab::rightPane | ( | ) | const |
Return the right pane.
|
slot |
Save the current settings, including which tabs are currently open and in which order. This is implicitly done in the destructor.
|
protectedslot |
Show the page with the specified tab index.
|
protectedslot |
Show the page with the widget of this action's data().
|
slot |
Show a page. Create a tab for that page if it doesn't already exist.
|
protected |
Show a page.
|
protected |
Swap two tabs and adjust their tab indices accordingly.
int YQPkgFilterTab::tabCount | ( | ) | const |
Return the number of open tabs.