Eneboo - Documentación para desarrolladores
|
The QTabDialog class provides a stack of tabbed widgets. Más...
#include <qtabdialog.h>
The QTabDialog class provides a stack of tabbed widgets.
A tabbed dialog is one in which several "tab pages" are available. By clicking on a tab page's tab or by pressing the indicated Alt+{letter} key combination, the user can select which tab page they want to use.
QTabDialog provides a tab bar consisting of single row of tabs at the top; each tab has an associated widget which is that tab's tab page. In addition, QTabDialog provides an OK button and the following optional buttons: Apply, Cancel, Defaults and Help.
The normal way to use QTabDialog is to do the following in the constructor: 1 Create a QTabDialog. Create a QWidget for each of the pages in the tab dialog, insert children into it, set up geometry management for it, and use addTab() (or insertTab()) to set up a tab and keyboard accelerator for it. Set up the buttons for the tab dialog using setOkButton(), setApplyButton(), setDefaultsButton(), setCancelButton() and setHelpButton(). Connect to the signals and slots.
If you don't call addTab() the page you have created will not be visible. Don't confuse the object name you supply to the QWidget constructor and the tab label you supply to addTab(); addTab() takes user-visible name that appears on the widget's tab and may identify an accelerator, whereas the widget name is used primarily for debugging.
Almost all applications have to connect the applyButtonPressed() signal to something. applyButtonPressed() is emitted when either OK or Apply is clicked, and your slot must copy the dialog's state into the application.
There are also several other signals which may be useful: cancelButtonPressed() is emitted when the user clicks Cancel. defaultButtonPressed() is emitted when the user clicks Defaults; the slot it is connected to should reset the state of the dialog to the application defaults. helpButtonPressed() is emitted when the user clicks Help. aboutToShow() is emitted at the start of show(); if there is any chance that the state of the application may change between the creation of the tab dialog and the time show() is called, you must connect this signal to a slot that resets the state of the dialog. currentChanged() is emitted when the user selects a page.
Each tab is either enabled or disabled at any given time (see setTabEnabled()). If a tab is enabled the tab text is drawn in black and the user can select that tab. If it is disabled the tab is drawn in a different way and the user cannot select that tab. 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.
You can change a tab's label and iconset using changeTab(). A tab page can be removed with removePage() and shown with showPage(). The current page is given by currentPage().
QTabDialog does not support tabs on the sides or bottom, nor can you set or retrieve the visible page. If you need more functionality than QTabDialog provides, consider creating a QDialog and using a QTabBar with QTabWidgets.
Most of the functionality in QTabDialog is provided by a QTabWidget.
QTabDialog::QTabDialog | ( | QWidget * | parent = 0 , |
const char * | name = 0 , |
||
bool | modal = FALSE , |
||
WFlags | f = 0 |
||
) |
Constructs a QTabDialog with only an OK button. The parent, name, modal and widget flag, f, arguments are passed on to the QDialog constructor.
QTabDialog::~QTabDialog | ( | ) |
Destroys the tab dialog.
QTabDialog::QTabDialog | ( | QWidget * | parent = 0 , |
const char * | name = 0 , |
||
bool | modal = FALSE , |
||
WFlags | f = 0 |
||
) |
QTabDialog::~QTabDialog | ( | ) |
void QTabDialog::aboutToShow | ( | ) | [signal] |
This signal is emitted by show() when it is time to set the state of the dialog's contents. The dialog should reflect the current state of the application when it appears; if there is any possibility that the state of the application may change between the time you call QTabDialog::QTabDialog() and QTabDialog::show(), you should set the dialog's state in a slot and connect this signal to it.
This applies mainly to QTabDialog objects that are kept around hidden, rather than being created, shown, and deleted afterwards.
void QTabDialog::aboutToShow | ( | ) | [signal] |
Adds another tab and page to the tab view.
The new page is child; the tab's label is label. Note the difference between the widget name (which you supply to widget constructors and to setTabEnabled(), for example) and the tab label. The name is internal to the program and invariant, whereas the label is shown on-screen and may vary according to language and other factors.
If the tab's label contains an ampersand, the letter following the ampersand is used as an accelerator for the tab, e.g. if the label is "Bro&wse" then Alt+W becomes an accelerator which will move the focus to this tab.
If you call addTab() after show() the screen will flicker and the user may be confused.
Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. This version of the function shows the iconset as well as the label on the tab of child.
Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. This is a lower-level method for adding tabs, similar to the other addTab() method. It is useful if you are using setTabBar() to set a QTabBar subclass with an overridden QTabBar::paint() function for a subclass of QTab.
The child is the widget to be placed on the new tab page. The tab is the tab to display on the tab page -- normally this shows a label or an icon that identifies the tab page.
void QTabDialog::applyButtonPressed | ( | ) | [signal] |
This signal is emitted when either the Apply or OK button is clicked.
It should be connected to a slot (or several slots) that change the application's state according to the state of the dialog.
void QTabDialog::applyButtonPressed | ( | ) | [signal] |
void QTabDialog::cancelButtonPressed | ( | ) | [signal] |
This signal is emitted when the Cancel button is clicked. It is automatically connected to QDialog::reject(), which will hide the dialog.
The Cancel button should not change the application's state at all, so you should generally not need to connect it to any slot.
void QTabDialog::cancelButtonPressed | ( | ) | [signal] |
Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Defines a new label for the tab of page w
Changes tab page w's iconset to iconset and label to label.
void QTabDialog::currentChanged | ( | QWidget * | t0 | ) | [signal] |
This signal is emitted whenever the current page changes.
void QTabDialog::currentChanged | ( | QWidget * | ) | [signal] |
QWidget* QTabDialog::currentPage | ( | ) | const |
QWidget * QTabDialog::currentPage | ( | ) | const |
Returns a pointer to the page currently being displayed by the tab dialog. The tab dialog does its best to make sure that this value is never 0 (but if you try hard enough, it can be).
void QTabDialog::defaultButtonPressed | ( | ) | [signal] |
This signal is emitted when the Defaults button is pressed. It should reset the dialog (but not the application) to the "factory defaults".
The application's state should not be changed until the user clicks Apply or OK.
void QTabDialog::defaultButtonPressed | ( | ) | [signal] |
bool QTabDialog::hasApplyButton | ( | ) | const |
bool QTabDialog::hasApplyButton | ( | ) | const |
Returns TRUE if the tab dialog has an Apply button; otherwise returns FALSE.
bool QTabDialog::hasCancelButton | ( | ) | const |
bool QTabDialog::hasCancelButton | ( | ) | const |
Returns TRUE if the tab dialog has a Cancel button; otherwise returns FALSE.
bool QTabDialog::hasDefaultButton | ( | ) | const |
bool QTabDialog::hasDefaultButton | ( | ) | const |
Returns TRUE if the tab dialog has a Defaults button; otherwise returns FALSE.
bool QTabDialog::hasHelpButton | ( | ) | const |
bool QTabDialog::hasHelpButton | ( | ) | const |
Returns TRUE if the tab dialog has a Help button; otherwise returns FALSE.
bool QTabDialog::hasOkButton | ( | ) | const |
Returns TRUE if the tab dialog has an OK button; otherwise returns FALSE.
bool QTabDialog::hasOkButton | ( | ) | const |
void QTabDialog::helpButtonPressed | ( | ) | [signal] |
void QTabDialog::helpButtonPressed | ( | ) | [signal] |
This signal is emitted when the Help button is pressed. It could be used to present information about how to use the dialog.
Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. This is a lower-level method for inserting tabs, similar to the other insertTab() method. It is useful if you are using setTabBar() to set a QTabBar subclass with an overridden QTabBar::paint() function for a subclass of QTab.
The child is the widget to be placed on the new tab page. The tab is the tab to display on the tab page -- normally this shows a label or an icon that identifies the tab page. The index is the position where this tab page should be inserted.
void QTabDialog::insertTab | ( | QWidget * | child, |
const QIconSet & | iconset, | ||
const QString & | label, | ||
int | index = -1 |
||
) |
Inserts another tab and page to the tab view.
The new page is child; the tab's label is label. Note the difference between the widget name (which you supply to widget constructors and to setTabEnabled(), for example) and the tab label. The name is internal to the program and invariant, whereas the label is shown on-screen and may vary according to language and other factors.
If the tab's label contains an ampersand, the letter following the ampersand is used as an accelerator for the tab, e.g. if the label is "Bro&wse" then Alt+W becomes an accelerator which will move the focus to this tab.
If index is not specified, the tab is simply added. Otherwise it is inserted at the specified position.
If you call insertTab() after show(), the screen will flicker and the user may be confused.
void QTabDialog::insertTab | ( | QWidget * | child, |
const QIconSet & | iconset, | ||
const QString & | label, | ||
int | index = -1 |
||
) |
Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. This version of the function shows the iconset as well as the label on the tab of child.
bool QTabDialog::isTabEnabled | ( | const char * | name | ) | const |
Returns TRUE if the page with object name name is enabled and FALSE if it is disabled.
If name is 0 or not the name of any of the pages, isTabEnabled() returns FALSE.
Returns TRUE if the page w is enabled; otherwise returns FALSE.
bool QTabDialog::isTabEnabled | ( | const char * | ) | const |
void QTabDialog::paintEvent | ( | QPaintEvent * | ) | [protected, virtual] |
Reimplementado de QWidget.
void QTabDialog::paintEvent | ( | QPaintEvent * | ) | [protected, virtual] |
This event handler can be reimplemented in a subclass to receive paint events.
A paint event is a request to repaint all or part of the widget. It can happen as a result of repaint() or update(), or because the widget was obscured and has now been uncovered, or for many other reasons.
Many widgets can simply repaint their entire surface when asked to, but some slow widgets need to optimize by painting only the requested region: QPaintEvent::region(). This speed optimization does not change the result, as painting is clipped to that region during event processing. QListView and QCanvas do this, for example.
Qt also tries to speed up painting by merging multiple paint events into one. When update() is called several times or the window system sends several paint events, Qt merges these events into one event with a larger region (see QRegion::unite()). repaint() does not permit this optimization, so we suggest using update() when possible.
When the paint event occurs, the update region has normally been erased, so that you're painting on the widget's background. There are a couple of exceptions and QPaintEvent::erased() tells you whether the widget has been erased or not.
The background can be set using setBackgroundMode(), setPaletteBackgroundColor() or setBackgroundPixmap(). The documentation for setBackgroundMode() elaborates on the background; we recommend reading it.
Reimplementado de QWidget.
void QTabDialog::removePage | ( | QWidget * | w | ) |
Removes page w from this stack of widgets. Does not delete w.
void QTabDialog::removePage | ( | QWidget * | ) |
void QTabDialog::resizeEvent | ( | QResizeEvent * | ) | [protected, virtual] |
Reimplementado de QDialog.
void QTabDialog::resizeEvent | ( | QResizeEvent * | e | ) | [protected, virtual] |
Reimplementado de QDialog.
void QTabDialog::selected | ( | const QString & | t0 | ) | [signal] |
void QTabDialog::selected | ( | const QString & | ) | [signal] |
void QTabDialog::setApplyButton | ( | ) |
Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Adds an Apply button to the dialog. The button's text is set to a localizable "Apply".
void QTabDialog::setApplyButton | ( | const QString & | text | ) |
void QTabDialog::setApplyButton | ( | ) |
void QTabDialog::setApplyButton | ( | const QString & | text | ) |
Adds an Apply button to the dialog. The button's text is set to text.
The Apply button should apply the current settings in the dialog box to the application while keeping the dialog visible.
When Apply is clicked, the applyButtonPressed() signal is emitted.
If text is a null string, no button is shown.
void QTabDialog::setCancelButton | ( | ) |
void QTabDialog::setCancelButton | ( | const QString & | text | ) |
Adds a Cancel button to the dialog. The button's text is set to text.
The cancel button should always return the application to the state it was in before the tab view popped up, or if the user has clicked Apply, back to the state immediately after the last Apply.
When Cancel is clicked, the cancelButtonPressed() signal is emitted. The dialog is closed at the same time.
If text is a null string, no button is shown.
void QTabDialog::setCancelButton | ( | ) |
Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Adds a Cancel button to the dialog. The button's text is set to a localizable "Cancel".
void QTabDialog::setCancelButton | ( | const QString & | text | ) |
void QTabDialog::setDefaultButton | ( | const QString & | text | ) |
void QTabDialog::setDefaultButton | ( | ) |
void QTabDialog::setDefaultButton | ( | const QString & | text | ) |
Adds a Defaults button to the dialog. The button's text is set to text.
The Defaults button should set the dialog (but not the application) back to the application defaults.
When Defaults is clicked, the defaultButtonPressed() signal is emitted.
If text is a null string, no button is shown.
void QTabDialog::setDefaultButton | ( | ) |
Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Adds a Defaults button to the dialog. The button's text is set to a localizable "Defaults".
void QTabDialog::setFont | ( | const QFont & | font | ) | [virtual] |
Sets the font for the tabs to font.
If the widget is visible, the display is updated with the new font immediately. There may be some geometry changes, depending on the size of the old and new fonts.
Reimplementado de QWidget.
void QTabDialog::setHelpButton | ( | const QString & | text | ) |
void QTabDialog::setHelpButton | ( | ) |
void QTabDialog::setHelpButton | ( | ) |
Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Adds a Help button to the dialog. The button's text is set to a localizable "Help".
void QTabDialog::setHelpButton | ( | const QString & | text | ) |
Adds a Help button to the dialog. The button's text is set to text.
When Help is clicked, the helpButtonPressed() signal is emitted.
If text is a null string, no button is shown.
void QTabDialog::setOkButton | ( | ) |
Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Adds an OK button to the dialog. The button's text is set to a localizable "OK".
void QTabDialog::setOkButton | ( | const QString & | text | ) |
Adds an OK button to the dialog and sets the button's text to text.
When the OK button is clicked, the applyButtonPressed() signal is emitted, and the current settings in the dialog box should be applied to the application. The dialog then closes.
If text is a null string, no button is shown.
void QTabDialog::setOkButton | ( | const QString & | text | ) |
void QTabDialog::setOKButton | ( | const QString & | text = QString::null | ) |
void QTabDialog::setOKButton | ( | const QString & | text = QString::null | ) |
void QTabDialog::setOkButton | ( | ) |
void QTabDialog::setTabBar | ( | QTabBar * | ) | [protected] |
void QTabDialog::setTabBar | ( | QTabBar * | tb | ) | [protected] |
If enable is TRUE the page w is enabled; otherwise w is disabled. The page's tab is redrawn appropriately.
QTabWidget uses QWidget::setEnabled() internally, rather than keeping a separate flag.
Note that even a disabled tab and tab page may be visible. If the page is already visible QTabWidget will not hide it; if all the pages are disabled QTabWidget will show one of them.
void QTabDialog::setTabEnabled | ( | const char * | name, |
bool | enable | ||
) |
Finds the page with object name name, enables/disables it according to the value of enable and redraws the page's tab appropriately.
QTabDialog uses QWidget::setEnabled() internally, rather than keeping a separate flag.
Note that even a disabled tab/page may be visible. If the page is already visible QTabDialog will not hide it; if all the pages are disabled QTabDialog will show one of them.
The object name is used (rather than the tab label) because the tab text may not be invariant in multi-language applications.
void QTabDialog::setTabEnabled | ( | const char * | , |
bool | |||
) |
void QTabDialog::show | ( | ) | [virtual] |
Reimplementado de QDialog.
void QTabDialog::show | ( | ) | [virtual] |
void QTabDialog::showPage | ( | QWidget * | ) |
void QTabDialog::showPage | ( | QWidget * | w | ) |
Ensures that widget w is shown. This is mainly useful for accelerators.
void QTabDialog::styleChange | ( | QStyle & | ) | [protected, virtual] |
This virtual function is called when the style of the widgets changes. oldStyle is the previous GUI style; you can get the new style from style().
Reimplement this function if your widget needs to know when its GUI style changes. You will almost certainly need to update the widget using update().
The default implementation updates the widget including its geometry.
Reimplementado de QWidget.
QTabBar* QTabDialog::tabBar | ( | ) | const [protected] |
QTabBar * QTabDialog::tabBar | ( | ) | const [protected] |
Returns the currently set QTabBar.