libyui-qt-pkg  2.45.27
YQPkgFilterTab Class Reference

Widget for "tabbed browsing" in packages: More...

#include <YQPkgFilterTab.h>

Inheritance diagram for YQPkgFilterTab:
Collaboration diagram for YQPkgFilterTab:

Public Slots

void showPage (QWidget *page)
 Show a page. More...
 
void showPage (const QString &internalName)
 
void closeCurrentPage ()
 Close the current page unless this is the last visible page.
 
void loadSettings ()
 Load settings, including which tabs are to be opened and in which order. More...
 
void saveSettings ()
 Save the current settings, including which tabs are currently open and in which order. More...
 
void closeAllPages ()
 Close all currently open pages.
 

Signals

void currentChanged (QWidget *newPageContent)
 Emitted when the current page changes. More...
 

Public Member Functions

 YQPkgFilterTab (QWidget *parent, const QString &settingsName)
 Constructor. More...
 
virtual ~YQPkgFilterTab ()
 Destructor.
 
void 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). More...
 
QWidget * rightPane () const
 Return the right pane.
 
YQPkgDiskUsageListdiskUsageList () const
 Return the disk usage list widget or 0 if there is none.
 
YQPkgFilterPagefindPage (QWidget *pageContent)
 Find a filter page by its content widget (the widget that was passed to addPage() ). More...
 
YQPkgFilterPagefindPage (const QString &internalName)
 Find a filter page by its internal name. More...
 
YQPkgFilterPagefindPage (int tabIndex)
 Find a filter page by its tab index. More...
 
int tabCount () const
 Return the number of open tabs.
 
virtual bool eventFilter (QObject *watchedObj, QEvent *event)
 Event filter to catch mouse right clicks on open tabs for the tab context menu. More...
 

Protected Slots

void showPage (int tabIndex)
 Show the page with the specified tab index.
 
void showPage (QAction *action)
 Show the page with the widget of this action's data().
 
void contextMovePageLeft ()
 Move the current tab page (from the context menu) one position to the left.
 
void contextMovePageRight ()
 Move the current tab page (from the context menu) one position to the right.
 
void contextClosePage ()
 Close the current tab page (from the context menu).
 

Protected Member Functions

void showPage (YQPkgFilterPage *page)
 Show a page.
 
bool postTabContextMenu (const QPoint &pos)
 Open the tab context menu for the tab at the specified position. More...
 
void swapTabs (YQPkgFilterPage *page1, YQPkgFilterPage *page2)
 Swap two tabs and adjust their tab indices accordingly.
 

Detailed Description

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.

Definition at line 86 of file YQPkgFilterTab.h.

Constructor & Destructor Documentation

◆ YQPkgFilterTab()

YQPkgFilterTab::YQPkgFilterTab ( QWidget *  parent,
const QString &  settingsName 
)

Constructor.

'settingsName' is the name to use to save and load settings.

Definition at line 118 of file YQPkgFilterTab.cc.

Here is the call graph for this function:

Member Function Documentation

◆ addPage()

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.

Definition at line 298 of file YQPkgFilterTab.cc.

◆ currentChanged

void YQPkgFilterTab::currentChanged ( QWidget *  newPageContent)
signal

Emitted when the current page changes.

NOT emitted initially for the very first page that is shown.

◆ eventFilter()

bool YQPkgFilterTab::eventFilter ( QObject *  watchedObj,
QEvent *  event 
)
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.

Definition at line 492 of file YQPkgFilterTab.cc.

Here is the call graph for this function:

◆ findPage() [1/3]

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.

Definition at line 437 of file YQPkgFilterTab.cc.

◆ findPage() [2/3]

YQPkgFilterPage * YQPkgFilterTab::findPage ( const QString &  internalName)

Find a filter page by its internal name.

Return 0 if there is no such page.

Definition at line 452 of file YQPkgFilterTab.cc.

◆ findPage() [3/3]

YQPkgFilterPage * YQPkgFilterTab::findPage ( int  tabIndex)

Find a filter page by its tab index.

Return 0 if there is no such page.

Definition at line 467 of file YQPkgFilterTab.cc.

◆ loadSettings

void YQPkgFilterTab::loadSettings ( )
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.

Definition at line 665 of file YQPkgFilterTab.cc.

Here is the call graph for this function:

◆ postTabContextMenu()

bool YQPkgFilterTab::postTabContextMenu ( const QPoint &  pos)
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.

Definition at line 510 of file YQPkgFilterTab.cc.

Here is the call graph for this function:

◆ saveSettings

void YQPkgFilterTab::saveSettings ( )
slot

Save the current settings, including which tabs are currently open and in which order.

This is implicitly done in the destructor.

Definition at line 697 of file YQPkgFilterTab.cc.

Here is the call graph for this function:

◆ showPage

void YQPkgFilterTab::showPage ( QWidget *  page)
slot

Show a page.

Create a tab for that page if it doesn't already exist.

Definition at line 327 of file YQPkgFilterTab.cc.

Here is the call graph for this function:

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