QToolBox 類提供選項卡化 Widget 項的列。 更多...
| 頭: | #include <QToolBox> |
| qmake: | QT += widgets |
| 繼承: | QFrame |
| QToolBox (QWidget * parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags()) | |
| virtual | ~QToolBox () |
| int | addItem (QWidget * widget , const QIcon & iconSet , const QString & text ) |
| int | addItem (QWidget * w , const QString & text ) |
| int | count () const |
| int | currentIndex () const |
| QWidget * | currentWidget () const |
| int | indexOf (QWidget * widget ) const |
| int | insertItem (int index , QWidget * widget , const QIcon & icon , const QString & text ) |
| int | insertItem (int index , QWidget * widget , const QString & text ) |
| bool | isItemEnabled (int index ) const |
| QIcon | itemIcon (int index ) const |
| QString | itemText (int index ) const |
| QString | itemToolTip (int index ) const |
| void | removeItem (int index ) |
| void | setItemEnabled (int index , bool enabled ) |
| void | setItemIcon (int index , const QIcon & icon ) |
| void | setItemText (int index , const QString & text ) |
| void | setItemToolTip (int index , const QString & toolTip ) |
| QWidget * | widget (int index ) const |
| void | setCurrentIndex (int index ) |
| void | setCurrentWidget (QWidget * widget ) |
| void | currentChanged (int index ) |
| virtual void | itemInserted (int index ) |
| virtual void | itemRemoved (int index ) |
| virtual void | changeEvent (QEvent * ev ) override |
| virtual bool | event (QEvent * e ) override |
| virtual void | showEvent (QShowEvent * e ) override |
工具框是顯示一個在另一個之上,當前項顯示在當前選項卡之下,的一列選項卡的 Widget。每個選項卡在選項卡列,都有索引位置。選項卡的項是 QWidget .
各項擁有 itemText (),可選 itemIcon (),可選 itemToolTip (), 和 widget (). The item's attributes can be changed with setItemText (), setItemIcon (),和 setItemToolTip (). Each item can be enabled or disabled individually with setItemEnabled ().
Items are added using addItem (),或插入在特定位置使用 insertItem (). The total number of items is given by count (). Items can be deleted with delete, or removed from the toolbox with removeItem ()。組閤 removeItem () 和 insertItem () allows you to move items to different positions.
當前項 Widget 索引的返迴是通過 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.
另請參閱 QTabWidget .
此特性保持工具框包含的項數。
默認情況下,此特性擁有 0 值。
訪問函數:
| int | count () const |
此特性保持當前項的索引
默認情況下,對於空工具框,此特性擁有值 -1。
訪問函數:
| int | currentIndex () const |
| void | setCurrentIndex (int index ) |
通知程序信號:
| void | currentChanged (int index ) |
Constructs a new toolbox with the given parent and the flags, f .
[signal]
void
QToolBox::
currentChanged
(
int
index
)
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.
注意: 通知程序信號對於特性 currentIndex .
[slot]
void
QToolBox::
setCurrentWidget
(
QWidget
*
widget
)
使 widget 當前小部件。 widget must be an item in this tool box.
另請參閱 addItem (), setCurrentIndex (),和 currentWidget ().
[虛擬]
QToolBox::
~QToolBox
()
銷毀工具框。
添加 widget in a new tab at bottom of the toolbox. The new tab's text is set to text ,和 iconSet is displayed to the left of the text 。返迴新選項卡的索引。
這是重載函數。
Adds the widget w in a new tab at bottom of the toolbox. The new tab's text is set to text 。返迴新選項卡的索引。
[override virtual protected]
void
QToolBox::
changeEvent
(
QEvent
*
ev
)
重實現: QFrame::changeEvent (QEvent *ev).
Returns a pointer to the current widget, or
nullptr
if there is no such item.
另請參閱 currentIndex () 和 setCurrentWidget ().
[override virtual protected]
bool
QToolBox::
event
(
QEvent
*
e
)
重實現: QFrame::event (QEvent *e).
返迴索引對於 widget , or -1 if the item does not exist.
插入 widget 在位置 index , or at the bottom of the toolbox if index is out of range. The new item's text is set to text ,和 icon is displayed to the left of the text . Returns the new item's index.
這是重載函數。
插入 widget 在位置 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.
返迴
true
if the item at position
index
被啓用;否則返迴
false
.
Returns the icon of the item at position index ,或 null 圖標若 index 超齣範圍。
另請參閱 setItemIcon ().
[virtual protected]
void
QToolBox::
itemInserted
(
int
index
)
This virtual handler is called after a new item was added or inserted at position index .
另請參閱 itemRemoved ().
[virtual protected]
void
QToolBox::
itemRemoved
(
int
index
)
This virtual handler is called after an item was removed from position index .
另請參閱 itemInserted ().
Returns the text of the item at position index ,或空字符串若 index 超齣範圍。
另請參閱 setItemText ().
Returns the tooltip of the item at position index ,或空字符串若 index 超齣範圍。
另請參閱 setItemToolTip ().
Removes the item at position index from the toolbox. Note that the widget is not deleted.
若 enabled is true then the item at position index 被啓用;否則項在位置 index 被禁用。
另請參閱 isItemEnabled ().
Sets the icon of the item at position index to icon .
另請參閱 itemIcon ().
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 QShortcut 文檔編製瞭解細節 (要顯示實際和號,使用 &&)。
另請參閱 itemText ().
Sets the tooltip of the item at position index to toolTip .
另請參閱 itemToolTip ().
[override virtual protected]
void
QToolBox::
showEvent
(
QShowEvent
*
e
)
重實現: QWidget::showEvent (QShowEvent *event).
Returns the widget at position
index
,或
nullptr
if there is no such item.