![]() ![]() void QTabWidget:: tabBarDoubleClicked( int index) Index refers to the tab clicked, or -1 if no tab is under the cursor. This signal is emitted when user clicks on a tab at an index. void QTabWidget:: tabBarClicked( int index) See also addTab(), setCurrentIndex(), and currentWidget(). The widget used must be a page in this tab widget. void QTabWidget:: setCurrentWidget( QWidget * widget) See also currentWidget() and currentIndex. Note: Notifier signal for property currentIndex. The parameter is the new current page index position, or -1 if there isn't a new one (for example, if there are no widgets in the QTabWidget) This signal is emitted whenever the current page index changes. void QTabWidget:: currentChanged( int index) Member Function Documentation QTabWidget:: QTabWidget( QWidget * parent = nullptr)Ĭonstructs a tabbed widget with parent parent. See also QTabBar, QStackedWidget, QToolBox, and Tab Dialog Example. Most of the functionality in QTabWidget is provided by a QTabBar (at the top, providing the tabs) and a QStackedWidget (most of the area, organizing the individual pages). An alternative is to use a QStackedWidget for which you provide some means of navigating between pages, for example, a QToolBar or a QListWidget. Tab widgets can be a very good way to split up a complex dialog. Note that even if a tab is disabled, the page can still be visible, for example if all of the tabs happen to be disabled. If it is disabled, the tab is drawn in a different way and the user cannot select that tab. If a tab is enabled, the tab text is drawn normally and the user can select that tab. A tab and its associated page can be removed with removeTab().Įach tab is either enabled or disabled at any given time (see setTabEnabled()). You can change a tab's text and icon using setTabText() or setTabIcon(). Use setCurrentWidget() or setCurrentIndex() to show a particular page. You can retrieve a pointer to a page widget with a given index using widget(), and can find the index position of a widget with indexOf(). The current page index is available as currentIndex(), the current page widget with currentWidget(). The signal currentChanged() is emitted when the user selects a page. The position of the tabs is defined by tabPosition, their shape by tabShape. Call addTab() or insertTab() to put the page widgets into the tab widget, giving each tab a suitable label with an optional keyboard shortcut.Insert child widgets into the page widget, using layouts to position them as normal.Create a QWidget for each of the pages in the tab dialog, but do not specify parent widgets for them.The normal way to use QTabWidget is to do the following: The user can show a different page by clicking on its tab or by pressing its Alt+ letter shortcut if it has one. Only the current page is shown in the page area all the other pages are hidden. Each tab is associated with a different widget (called a page). ![]() By default, the tab bar is shown above the page area, but different configurations are available (see TabPosition). SetTabWhatsThis(int index, const QString & text)Ī tab widget provides a tab bar (see QTabBar) and a "page area" that is used to display pages related to each tab. SetTabToolTip(int index, const QString & tip) SetTabText(int index, const QString & label) SetTabPosition(QTabWidget::TabPosition position) SetTabIcon(int index, const QIcon & icon) SetCornerWidget(QWidget * widget, Qt::Corner corner = Qt::TopRightCorner) InsertTab(int index, QWidget * page, const QIcon & icon, const QString & label) InsertTab(int index, QWidget * page, const QString & label) AddTab(QWidget * page, const QString & label)ĪddTab(QWidget * page, const QIcon & icon, const QString & label)ĬornerWidget(Qt::Corner corner = Qt::TopRightCorner) const ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |