QtBase
v6.3.1
|
The QToolBox class provides a column of tabbed widget items. More...
#include <qtoolbox.h>
Public Slots | |
void | setCurrentIndex (int index) |
void | setCurrentWidget (QWidget *widget) |
Public Slots inherited from QWidget | |
void | setEnabled (bool) |
void | setDisabled (bool) |
void | setWindowModified (bool) |
void | setWindowTitle (const QString &) |
void | setStyleSheet (const QString &styleSheet) |
void | setFocus () |
void | update () |
void | repaint () |
virtual void | setVisible (bool visible) |
void | setHidden (bool hidden) |
void | show () |
void | hide () |
void | showMinimized () |
void | showMaximized () |
void | showFullScreen () |
void | showNormal () |
bool | close () |
void | raise () |
void | lower () |
Public Slots inherited from QObject | |
void | deleteLater () |
Signals | |
void | currentChanged (int index) |
Signals inherited from QWidget | |
void | windowTitleChanged (const QString &title) |
void | windowIconChanged (const QIcon &icon) |
void | windowIconTextChanged (const QString &iconText) |
void | customContextMenuRequested (const QPoint &pos) |
Signals inherited from QObject | |
void | destroyed (QObject *=nullptr) |
void | objectNameChanged (const QString &objectName, QPrivateSignal) |
Properties | |
int | currentIndex |
the index of the current item More... | |
int | count |
The number of items contained in the toolbox. More... | |
Properties inherited from QFrame | |
Shape | frameShape |
the frame shape value from the frame style More... | |
Shadow | frameShadow |
the frame shadow value from the frame style More... | |
int | lineWidth |
the line width More... | |
int | midLineWidth |
the width of the mid-line More... | |
int | frameWidth |
the width of the frame that is drawn. More... | |
QRect | frameRect |
the frame's rectangle More... | |
Properties inherited from QWidget | |
bool | modal |
whether the widget is a modal widget More... | |
Qt::WindowModality | windowModality |
which windows are blocked by the modal widget More... | |
bool | enabled |
whether the widget is enabled More... | |
QRect | geometry |
the geometry of the widget relative to its parent and excluding the window frame More... | |
QRect | frameGeometry |
geometry of the widget relative to its parent including any window frame More... | |
QRect | normalGeometry |
the geometry of the widget as it will appear when shown as a normal (not maximized or full screen) top-level widget More... | |
int | x |
the x coordinate of the widget relative to its parent including any window frame More... | |
int | y |
the y coordinate of the widget relative to its parent and including any window frame More... | |
QPoint | pos |
the position of the widget within its parent widget More... | |
QSize | frameSize |
the size of the widget including any window frame More... | |
QSize | size |
the size of the widget excluding any window frame More... | |
int | width |
the width of the widget excluding any window frame More... | |
int | height |
the height of the widget excluding any window frame More... | |
QRect | rect |
the internal geometry of the widget excluding any window frame More... | |
QRect | childrenRect |
the bounding rectangle of the widget's children More... | |
QRegion | childrenRegion |
the combined region occupied by the widget's children More... | |
QSizePolicy | sizePolicy |
the default layout behavior of the widget More... | |
QSize | minimumSize |
the widget's minimum size More... | |
QSize | maximumSize |
the widget's maximum size in pixels More... | |
int | minimumWidth |
the widget's minimum width in pixels More... | |
int | minimumHeight |
the widget's minimum height in pixels More... | |
int | maximumWidth |
the widget's maximum width in pixels More... | |
int | maximumHeight |
the widget's maximum height in pixels More... | |
QSize | sizeIncrement |
the size increment of the widget More... | |
QSize | baseSize |
the base size of the widget More... | |
QPalette | palette |
the widget's palette More... | |
QFont | font |
the font currently set for the widget More... | |
QCursor | cursor |
the cursor shape for this widget More... | |
bool | mouseTracking |
whether mouse tracking is enabled for the widget More... | |
bool | tabletTracking |
whether tablet tracking is enabled for the widget More... | |
bool | isActiveWindow |
whether this widget's window is the active window More... | |
Qt::FocusPolicy | focusPolicy |
the way the widget accepts keyboard focus More... | |
bool | focus |
whether this widget (or its focus proxy) has the keyboard input focus More... | |
Qt::ContextMenuPolicy | contextMenuPolicy |
how the widget shows a context menu More... | |
bool | updatesEnabled |
whether updates are enabled More... | |
bool | visible |
whether the widget is visible More... | |
bool | minimized |
whether this widget is minimized (iconified) More... | |
bool | maximized |
whether this widget is maximized More... | |
bool | fullScreen |
whether the widget is shown in full screen mode More... | |
QSize | sizeHint |
the recommended size for the widget More... | |
QSize | minimumSizeHint |
the recommended minimum size for the widget More... | |
bool | acceptDrops |
whether drop events are enabled for this widget More... | |
QString | windowTitle |
the window title (caption) More... | |
QIcon | windowIcon |
the widget's icon More... | |
QString | windowIconText |
the text to be displayed on the icon of a minimized window More... | |
double | windowOpacity |
The level of opacity for the window. More... | |
bool | windowModified |
whether the document shown in the window has unsaved changes More... | |
QString | accessibleName |
the widget's name as seen by assistive technologies More... | |
QString | accessibleDescription |
the widget's description as seen by assistive technologies More... | |
Qt::LayoutDirection | layoutDirection |
the layout direction for this widget. More... | |
bool | autoFillBackground |
whether the widget background is filled automatically More... | |
QString | styleSheet |
the widget's style sheet More... | |
QLocale | locale |
the widget's locale More... | |
QString | windowFilePath |
the file path associated with a widget More... | |
Qt::InputMethodHints | inputMethodHints |
What input method specific hints the widget has. More... | |
Properties inherited from QObject | |
QString | objectName |
the name of this object More... | |
The QToolBox class provides a column of tabbed widget items.
\inmodule QtWidgets
A toolbox is a widget that displays a column of tabs one above the other, with the current item displayed below the current tab. Every tab has an index position within the column of tabs. A tab's item is a QWidget.
Each item has an itemText(), an optional itemIcon(), an optional itemToolTip(), and a widget(). The item's attributes can be changed with setItemText(), setItemIcon(), and setItemToolTip(). Each item can be enabled or disabled individually with setItemEnabled().
Items are added using addItem(), or inserted at particular positions using insertItem(). The total number of items is given by count(). Items can be deleted with delete, or removed from the toolbox with removeItem(). Combining removeItem() and insertItem() allows you to move items to different positions.
The index of the current item widget is returned by currentIndex(), and set with setCurrentIndex(). The index of a particular item can be found using indexOf(), and the item at a given index is returned by item().
The currentChanged() signal is emitted when the current item is changed.
Definition at line 53 of file qtoolbox.h.
Constructs a new toolbox with the given parent and the flags, f.
Definition at line 294 of file qtoolbox.cpp.
QToolBox::~QToolBox | ( | ) |
Destroys the toolbox.
Definition at line 307 of file qtoolbox.cpp.
Adds the widget in a new tab at bottom of the toolbox. The new tab's text is set to text, and the iconSet is displayed to the left of the text. Returns the new tab's index.
Definition at line 115 of file qtoolbox.h.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Adds the widget w in a new tab at bottom of the toolbox. The new tab's text is set to text. Returns the new tab's index.
Definition at line 113 of file qtoolbox.h.
\reimp
Reimplemented from QFrame.
Definition at line 711 of file qtoolbox.cpp.
int QToolBox::count | ( | ) | const |
Definition at line 415 of file qtoolbox.cpp.
|
signal |
This signal is emitted when the current item is changed. The new current item's index is passed in index, or -1 if there is no current item.
int QToolBox::currentIndex | ( | ) | const |
QWidget * QToolBox::currentWidget | ( | ) | const |
Returns a pointer to the current widget, or \nullptr if there is no such item.
Definition at line 523 of file qtoolbox.cpp.
|
overrideprotectedvirtual |
\reimp
Reimplemented from QFrame.
Definition at line 742 of file qtoolbox.cpp.
Returns the index of widget, or -1 if the item does not exist.
Definition at line 561 of file qtoolbox.cpp.
Inserts the widget at position index, or at the bottom of the toolbox if index is out of range. The new item's text is set to text, and the icon is displayed to the left of the text. Returns the new item's index.
Definition at line 342 of file qtoolbox.cpp.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Inserts the widget at position index, or at the bottom of the toolbox if index is out of range. The new item's text is set to text. Returns the new item's index.
Definition at line 118 of file qtoolbox.h.
bool QToolBox::isItemEnabled | ( | int | index | ) | const |
Returns true
if the item at position index is enabled; otherwise returns false
.
Definition at line 659 of file qtoolbox.cpp.
QIcon QToolBox::itemIcon | ( | int | index | ) | const |
Returns the icon of the item at position index, or a null icon if index is out of range.
Definition at line 683 of file qtoolbox.cpp.
|
protectedvirtual |
This virtual handler is called after a new item was added or inserted at position index.
Definition at line 725 of file qtoolbox.cpp.
|
protectedvirtual |
This virtual handler is called after an item was removed from position index.
Definition at line 736 of file qtoolbox.cpp.
QString QToolBox::itemText | ( | int | index | ) | const |
Returns the text of the item at position index, or an empty string if index is out of range.
Definition at line 671 of file qtoolbox.cpp.
void QToolBox::removeItem | ( | int | index | ) |
Removes the item at position index from the toolbox. Note that the widget is not deleted.
Definition at line 487 of file qtoolbox.cpp.
|
slot |
Makeswidget the current widget. The widget must be an item in this tool box.
Definition at line 534 of file qtoolbox.cpp.
void QToolBox::setItemEnabled | ( | int | index, |
bool | enabled | ||
) |
If enabled is true then the item at position index is enabled; otherwise the item at position index is disabled.
Definition at line 578 of file qtoolbox.cpp.
Sets the icon of the item at position index to icon.
Definition at line 633 of file qtoolbox.cpp.
Sets the text of the item at position index to text.
If the provided text contains an ampersand character ('&'), a mnemonic is automatically created for it. The character that follows the '&' will be used as the shortcut key. Any previous mnemonic will be overwritten, or cleared if no mnemonic is defined by the text. See the \l {QShortcut::mnemonic}{QShortcut} documentation for details (to display an actual ampersand, use '&&').
Definition at line 621 of file qtoolbox.cpp.
|
overrideprotectedvirtual |
\reimp
Reimplemented from QWidget.
Definition at line 705 of file qtoolbox.cpp.
QWidget * QToolBox::widget | ( | int | index | ) | const |
Returns the widget at position index, or \nullptr if there is no such item.
Definition at line 548 of file qtoolbox.cpp.
|
read |
The number of items contained in the toolbox.
By default, this property has a value of 0.
Definition at line 121 of file qtoolbox.h.
|
readwrite |
the index of the current item
By default, for an empty toolbox, this property has a value of -1.
Definition at line 121 of file qtoolbox.h.