QToolBox Class Reference

[ QtGui module]

QToolBox 类提供选项卡化 Widget 项的列。 更多...

继承 QFrame .

方法

Special Methods

Qt Signals


详细描述

QToolBox 类提供选项卡化 Widget 项的列。

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 (),可选 itemIcon (),可选 itemToolTip (), and a 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 (), 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 () 和 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 ().

currentChanged () signal is emitted when the current item is changed.


方法文档编制

QToolBox.__init__ ( self , QWidget   parent  = None, Qt.WindowFlags   flags  = 0)

parent argument, if not None, causes self to be owned by Qt instead of PyQt.

Constructs a new toolbox with the given parent 和 flags, f .

int QToolBox.addItem ( self , QWidget   item , QString  text )

item argument has it's ownership transferred to Qt.

添加 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.

int QToolBox.addItem ( self , QWidget   item , QIcon   iconSet , QString  text )

item argument has it's ownership transferred to Qt.

这是重载函数。

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.

QToolBox.changeEvent ( self , QEvent )

重实现自 QWidget.changeEvent ().

int QToolBox.count ( self )

int QToolBox.currentIndex ( self )

QWidget QToolBox.currentWidget ( self )

Returns a pointer to the current widget, or 0 if there is no such item.

另请参阅 currentIndex () 和 setCurrentWidget ().

bool QToolBox.event ( self , QEvent   e )

重实现自 QObject.event ().

int QToolBox.indexOf ( self , QWidget   widget )

Returns the index of widget , or -1 if the item does not exist.

int QToolBox.insertItem ( self , int  index , QWidget   item , QString  text )

item argument has it's ownership transferred to Qt.

插入 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.

int QToolBox.insertItem ( self , int  index , QWidget   widget , QIcon   icon , QString  text )

widget argument has it's ownership transferred to Qt.

这是重载函数。

插入 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.

bool QToolBox.isItemEnabled ( self , int  index )

Returns true if the item at position index is enabled; otherwise returns false.

QIcon QToolBox.itemIcon ( self , int  index )

Returns the icon of the item at position index ,或 null icon if index 超出范围。

另请参阅 setItemIcon ().

QToolBox.itemInserted ( self , int  index )

This virtual handler is called after a new item was added or inserted at position index .

另请参阅 itemRemoved ().

QToolBox.itemRemoved ( self , int  index )

This virtual handler is called after an item was removed from position index .

另请参阅 itemInserted ().

QString QToolBox.itemText ( self , int  index )

Returns the text of the item at position index ,或 empty string if index 超出范围。

另请参阅 setItemText ().

QString QToolBox.itemToolTip ( self , int  index )

Returns the tooltip of the item at position index ,或 empty string if index 超出范围。

另请参阅 setItemToolTip ().

QToolBox.removeItem ( self , int  index )

Removes the item at position index from the toolbox. Note that the widget is not deleted.

QToolBox.setCurrentIndex ( self , int  index )

This method is also a Qt slot with the C++ signature void setCurrentIndex(int) .

QToolBox.setCurrentWidget ( self , QWidget   widget )

This method is also a Qt slot with the C++ signature void setCurrentWidget(QWidget*) .

Makes widget 当前小部件。 widget 必须是 an item in this tool box.

另请参阅 addItem (), setCurrentIndex (), and currentWidget ().

QToolBox.setItemEnabled ( self , int  index , bool  enabled )

enabled is true then the item at position index 被启用;否则项在位置 index is disabled.

另请参阅 isItemEnabled ().

QToolBox.setItemIcon ( self , int  index , QIcon   icon )

Sets the icon of the item at position index to icon .

另请参阅 itemIcon ().

QToolBox.setItemText ( self , int  index , QString  text )

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 '&&').

另请参阅 itemText ().

QToolBox.setItemToolTip ( self , int  index , QString  toolTip )

Sets the tooltip of the item at position index to toolTip .

另请参阅 itemToolTip ().

QToolBox.showEvent ( self , QShowEvent   e )

重实现自 QWidget.showEvent ().

QWidget QToolBox.widget ( self , int  index )

Returns the widget at position index , or 0 if there is no such item.

QToolBox.__len__ ( self )


Qt Signal Documentation

void currentChanged (int)

This is the default overload of this 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.