Qt:Документация 4.3.2/q3tabdialog

Материал из Wiki.crossplatform.ru

Перейти к: навигация, поиск
40px Внимание: Актуальная версия перевода документации находится здесь

__NOTOC__

Image:qt-logo.png

Главная · Все классы · Основные классы · Классы по группам · Модули · Функции

Image:trolltech-logo.png

Содержание

[править] Q3TabDialog Class Reference
[ Qt3Support module]

The Q3TabDialog class provides a stack of tabbed widgets. Далее...

 #include <Q3TabDialog>

This class is part of the Qt 3 support library. It is provided to keep old source code working. Мы настоятельно не рекомендуем использовать этот класс в новом коде. See Porting to Qt 4 for more information.

Наследует QDialog.

[править] Открытые функции

  • 5 открытых функций, унаследованных от QDialog
  • 201 свойство, унаследованное от QWidget
  • 29 открытых функций, унаследованных от QObject
  • 12 открытых функций, унаследованных от QPaintDevice

[править] Сигналы

  • 3 сигнала, унаследованные от QDialog
  • 1 сигнал, унаследованный от QWidget
  • 1 сигнал, унаследованный от QObject

[править] Защищенные функции

  • 38 защищенных функций, унаследованных от QWidget
  • 7 защищенных функций, унаследованных от QObject
  • 1 защищенная функция, унаследованных от QPaintDevice

[править] Дополнительные унаследованные члены

  • 2 войства, унаследованные от QDialog
  • 56 свойств, унаследованных от QWidget
  • 1 свойство, унаследованное от QObject
  • 4 открытых слота, унаследованные от QDialog
  • 19 открытых слотов, унаследованных от QWidget
  • 1 открытый слот, унаследованный от QObject
  • 4 статических открытых члена, унаследованных от QWidget
  • 5 статических открытых членов, унаследованных от QObject
  • 1 защищенный слот, унаследованый от QWidget

[править] Подробное описание

The Q3TabDialog 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.

Q3TabDialog 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, Q3TabDialog provides an OK button and the following optional buttons: Apply, Cancel, Defaults and Help.

The normal way to use Q3TabDialog is to do the following in the constructor:

  1. Create a Q3TabDialog.
  2. 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.
  3. Set up the buttons for the tab dialog using setOkButton(), setApplyButton(), setDefaultsButton(), setCancelButton() and setHelpButton().
  4. 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().

Q3TabDialog does not support tabs on the sides or bottom, nor can you set or retrieve the visible page. If you need more functionality than Q3TabDialog provides, consider creating a QDialog and using a QTabBar with QTabWidgets.

Most of the functionality in Q3TabDialog is provided by a QTabWidget.


[править] Описание функций-членов

[править]
Q3TabDialog::Q3TabDialog ( QWidget * parent = 0, const char * name = 0, bool modal = false, Qt::WindowFlags f = 0 )

Constructs a Q3TabDialog with only an OK button. The parent, name, modal and widget flag, f, arguments are passed on to the QDialog constructor.

[править]
Q3TabDialog::~Q3TabDialog ()

Destroys the tab dialog.

[править]
void Q3TabDialog::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 Q3TabDialog() and show(), you should set the dialog's state in a slot and connect this signal to it.

This applies mainly to Q3TabDialog objects that are kept around hidden, rather than being created, shown, and deleted afterwards.

See also applyButtonPressed(), QWidget::show(), and cancelButtonPressed().

[править]
void Q3TabDialog::addTab ( QWidget * child, const QString & label )

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.

See also insertTab().

[править]
void Q3TabDialog::addTab ( QWidget * child, const QIcon & iconset, const QString & label )

Эта перегруженная функция предоставлена для удобства.

This version of the function shows the iconset as well as the label on the tab of child.

[править]
void Q3TabDialog::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.

See also cancelButtonPressed(), defaultButtonPressed(), and setApplyButton().

[править]
void Q3TabDialog::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.

See also applyButtonPressed(), defaultButtonPressed(), and setCancelButton().

[править]
void Q3TabDialog::changeTab ( QWidget * w, const QIcon & iconset, const QString & label )

Changes tab page w's iconset to iconset and label to label.

[править]
void Q3TabDialog::changeTab ( QWidget * w, const QString & label )

Эта перегруженная функция предоставлена для удобства.

Defines a new label for the tab of page w

[править]
void Q3TabDialog::currentChanged ( QWidget * widget ) [signal]

This signal is emitted whenever the current page changes. widget is the new current page.

See also currentPage(), showPage(), and tabLabel().

[править]
QWidget * Q3TabDialog::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 Q3TabDialog::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.

See also applyButtonPressed(), cancelButtonPressed(), and setDefaultButton().

[править]
bool Q3TabDialog::hasApplyButton () const

Returns true if the tab dialog has an Apply button; otherwise returns false.

hasDefaultButton()

See also setApplyButton(), applyButtonPressed(), and hasCancelButton().

[править]
bool Q3TabDialog::hasCancelButton () const

Returns true if the tab dialog has a Cancel button; otherwise returns false.

hasDefaultButton()

See also setCancelButton(), cancelButtonPressed(), and hasApplyButton().

[править]
bool Q3TabDialog::hasDefaultButton () const

Returns true if the tab dialog has a Defaults button; otherwise returns false.

hasCancelButton()

See also setDefaultButton(), defaultButtonPressed(), and hasApplyButton().

[править]
bool Q3TabDialog::hasHelpButton () const

Returns true if the tab dialog has a Help button; otherwise returns false.

hasCancelButton()

See also setHelpButton(), helpButtonPressed(), and hasApplyButton().

[править]
bool Q3TabDialog::hasOkButton () const

Returns true if the tab dialog has an OK button; otherwise returns false.

hasDefaultButton()

See also setOkButton(), hasApplyButton(), and hasCancelButton().

[править]
void Q3TabDialog::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.

See also applyButtonPressed(), cancelButtonPressed(), and setHelpButton().

[править]
void Q3TabDialog::insertTab ( QWidget * child, 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.

See also addTab().

[править]
void Q3TabDialog::insertTab ( QWidget * child, const QIcon & iconset, const QString & label, int index = -1 )

Эта перегруженная функция предоставлена для удобства.

This version of the function shows the iconset as well as the label on the tab of child.

[править]
bool Q3TabDialog::isTabEnabled ( QWidget * w ) const

Returns true if the page w is enabled; otherwise returns false.

See also setTabEnabled() and QWidget::isEnabled().

[править]
void Q3TabDialog::removePage ( QWidget * w )

Removes page w from this stack of widgets. Does not delete w.

See also showPage() and QTabWidget::removePage().

[править]
void Q3TabDialog::selected ( const QString & name ) [signal]

This signal is emitted whenever a tab is selected (raised), including during the first show(). name is the name of the selected tab.

See also raise().

[править]
void Q3TabDialog::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 an empty string, no button is shown.

See also hasApplyButton(), setCancelButton(), setDefaultButton(), and applyButtonPressed().

[править]
void Q3TabDialog::setApplyButton ()

Эта перегруженная функция предоставлена для удобства.

Adds an Apply button to the dialog. The button's text is set to a localizable "Apply".

[править]
void Q3TabDialog::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 an empty string, no button is shown.

See also hasCancelButton(), setApplyButton(), setDefaultButton(), and cancelButtonPressed().

[править]
void Q3TabDialog::setCancelButton ()

Эта перегруженная функция предоставлена для удобства.

Adds a Cancel button to the dialog. The button's text is set to a localizable "Cancel".

[править]
void Q3TabDialog::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 an empty string, no button is shown.

See also hasDefaultButton(), setApplyButton(), setCancelButton(), and defaultButtonPressed().

[править]
void Q3TabDialog::setDefaultButton ()

Эта перегруженная функция предоставлена для удобства.

Adds a Defaults button to the dialog. The button's text is set to a localizable "Defaults".

[править]
void Q3TabDialog::setFont ( const QFont & font )

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.

[править]
void Q3TabDialog::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 an empty string, no button is shown.

See also hasHelpButton(), setApplyButton(), setCancelButton(), and helpButtonPressed().

[править]
void Q3TabDialog::setHelpButton ()

Эта перегруженная функция предоставлена для удобства.

Adds a Help button to the dialog. The button's text is set to a localizable "Help".

[править]
void Q3TabDialog::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 an empty string, no button is shown.

See also hasOkButton(), setCancelButton(), setDefaultButton(), and applyButtonPressed().

[править]
void Q3TabDialog::setOkButton ()

Эта перегруженная функция предоставлена для удобства.

Adds an OK button to the dialog. The button's text is set to a localizable "OK".

[править]
void Q3TabDialog::setTabBar ( QTabBar * tb ) [protected]

Replaces the QTabBar heading the dialog by the given tab bar, tb. Note that this must be called before any tabs have been added, or the behavior is undefined.

See also tabBar().

[править]
void Q3TabDialog::setTabEnabled ( QWidget * w, bool enable )

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.

See also isTabEnabled() and QWidget::setEnabled().

[править]
void Q3TabDialog::showPage ( QWidget * w )

Ensures that widget w is shown. This is mainly useful for accelerators.

Warning: If used carelessly, this function can easily surprise or confuse the user.

See also QTabBar::setCurrentTab().

[править]
QTabBar * Q3TabDialog::tabBar () const [protected]

Returns the currently set QTabBar.

See also setTabBar().

[править]
QString Q3TabDialog::tabLabel ( QWidget * w )

Returns the text in the tab for page w.



Copyright © 2007 Trolltech Trademarks
Qt 4.3.2