def
addItem
(widget, icon, text)
def
addItem
(widget, text)
def
count
()
def
currentIndex
()
def
currentWidget
()
def
indexOf
(widget)
def
insertItem
(index, widget, icon, text)
def
insertItem
(index, widget, text)
def
isItemEnabled
(index)
def
itemIcon
(index)
def
itemText
(index)
def
itemToolTip
(index)
def
removeItem
(index)
def
setItemEnabled
(index, enabled)
def
setItemIcon
(index, icon)
def
setItemText
(index, text)
def
setItemToolTip
(index, toolTip)
def
widget
(index)
def
itemInserted
(index)
def
itemRemoved
(index)
def
setCurrentIndex
(index)
def
setCurrentWidget
(widget)
def
currentChanged
(index)
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 optionalitemIcon(), an optionalitemToolTip(),和widget(). The item’s attributes can be changed withsetItemText(),setItemIcon(),和setItemToolTip(). Each item can be enabled or disabled individually withsetItemEnabled().Items are added using
addItem(), or inserted at particular positions usinginsertItem(). The total number of items is given bycount(). Items can be deleted with delete, or removed from the toolbox withremoveItem(). CombiningremoveItem()andinsertItem()allows you to move items to different positions.The index of the current item widget is returned by
currentIndex(), and set withsetCurrentIndex(). The index of a particular item can be found usingindexOf(), and the item at a given index is returned by item().
currentChanged()signal is emitted when the current item is changed.另请参阅
QToolBox
(
[
parent=None
[
,
f=Qt.WindowFlags()
]
]
)
¶
- param f
WindowFlags- param parent
Constructs a new toolbox with the given
parent
and the flags,
f
.
PySide2.QtWidgets.QToolBox.
addItem
(
widget
,
text
)
¶
widget
–
QWidget
text – unicode
int
这是重载函数。
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.
PySide2.QtWidgets.QToolBox.
addItem
(
widget
,
icon
,
text
)
¶
widget
–
QWidget
icon
–
QIcon
text – unicode
int
添加
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
. Returns the new tab’s index.
PySide2.QtWidgets.QToolBox.
count
(
)
¶
int
PySide2.QtWidgets.QToolBox.
currentChanged
(
index
)
¶
index
–
int
PySide2.QtWidgets.QToolBox.
currentIndex
(
)
¶
int
另请参阅
PySide2.QtWidgets.QToolBox.
currentWidget
(
)
¶
Returns a pointer to the current widget, or
None
if there is no such item.
PySide2.QtWidgets.QToolBox.
indexOf
(
widget
)
¶
widget
–
QWidget
int
Returns the index of
widget
, or -1 if the item does not exist.
PySide2.QtWidgets.QToolBox.
insertItem
(
index
,
widget
,
icon
,
text
)
¶
index
–
int
widget
–
QWidget
icon
–
QIcon
text – unicode
int
插入
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.
PySide2.QtWidgets.QToolBox.
insertItem
(
index
,
widget
,
text
)
¶
index
–
int
widget
–
QWidget
text – unicode
int
这是重载函数。
插入
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.
PySide2.QtWidgets.QToolBox.
isItemEnabled
(
index
)
¶
index
–
int
bool
返回
true
if the item at position
index
被启用;否则返回
false
.
PySide2.QtWidgets.QToolBox.
itemIcon
(
index
)
¶
index
–
int
QIcon
Returns the icon of the item at position
index
,或 null 图标若
index
超出范围。
另请参阅
PySide2.QtWidgets.QToolBox.
itemInserted
(
index
)
¶
index
–
int
This virtual handler is called after a new item was added or inserted at position
index
.
另请参阅
PySide2.QtWidgets.QToolBox.
itemRemoved
(
index
)
¶
index
–
int
This virtual handler is called after an item was removed from position
index
.
另请参阅
PySide2.QtWidgets.QToolBox.
itemText
(
index
)
¶
index
–
int
unicode
Returns the text of the item at position
index
,或空字符串若
index
超出范围。
另请参阅
PySide2.QtWidgets.QToolBox.
itemToolTip
(
index
)
¶
index
–
int
unicode
Returns the tooltip of the item at position
index
,或空字符串若
index
超出范围。
另请参阅
PySide2.QtWidgets.QToolBox.
removeItem
(
index
)
¶
index
–
int
Removes the item at position
index
from the toolbox. Note that the widget is
not
deleted.
PySide2.QtWidgets.QToolBox.
setCurrentIndex
(
index
)
¶
index
–
int
另请参阅
PySide2.QtWidgets.QToolBox.
setCurrentWidget
(
widget
)
¶
widget
–
QWidget
Makes``widget`` the current widget. The
widget
must be an item in this tool box.
PySide2.QtWidgets.QToolBox.
setItemEnabled
(
index
,
enabled
)
¶
index
–
int
enabled
–
bool
若
enabled
is true then the item at position
index
被启用;否则项在位置
index
是禁用的。
另请参阅
PySide2.QtWidgets.QToolBox.
setItemIcon
(
index
,
icon
)
¶
index
–
int
icon
–
QIcon
Sets the icon of the item at position
index
to
icon
.
另请参阅
PySide2.QtWidgets.QToolBox.
setItemText
(
index
,
text
)
¶
index
–
int
text – unicode
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
documentation for details (to display an actual ampersand, use ‘&&’).
另请参阅
PySide2.QtWidgets.QToolBox.
setItemToolTip
(
index
,
toolTip
)
¶
index
–
int
toolTip – unicode
Sets the tooltip of the item at position
index
to
toolTip
.
另请参阅