Movatterモバイル変換


[0]ホーム

URL:


We bake cookies in your browser for a better experience. Using this site means that you consent.Read More

Menu

Qt Documentation

QToolBox Class

TheQToolBox class provides a column of tabbed widget items.More...

Header:#include <QToolBox>
Inherits:QFrame

Properties

  • 6 properties inherited fromQFrame
  • 58 properties inherited fromQWidget
  • 1 property inherited fromQObject

Public Functions

QToolBox(QWidget * parent = 0, Qt::WindowFlags f = 0)
~QToolBox()
intaddItem(QWidget * widget, const QIcon & iconSet, const QString & text)
intaddItem(QWidget * w, const QString & text)
intcount() const
intcurrentIndex() const
QWidget *currentWidget() const
intindexOf(QWidget * widget) const
intinsertItem(int index, QWidget * widget, const QIcon & icon, const QString & text)
intinsertItem(int index, QWidget * widget, const QString & text)
boolisItemEnabled(int index) const
QIconitemIcon(int index) const
QStringitemText(int index) const
QStringitemToolTip(int index) const
voidremoveItem(int index)
voidsetItemEnabled(int index, bool enabled)
voidsetItemIcon(int index, const QIcon & icon)
voidsetItemText(int index, const QString & text)
voidsetItemToolTip(int index, const QString & toolTip)
QWidget *widget(int index) const
  • 14 public functions inherited fromQFrame
  • 220 public functions inherited fromQWidget
  • 29 public functions inherited fromQObject
  • 12 public functions inherited fromQPaintDevice

Public Slots

voidsetCurrentIndex(int index)
voidsetCurrentWidget(QWidget * widget)
  • 19 public slots inherited fromQWidget
  • 1 public slot inherited fromQObject

Signals

voidcurrentChanged(int index)

Protected Functions

virtual voiditemInserted(int index)
virtual voiditemRemoved(int index)

Reimplemented Protected Functions

virtual voidchangeEvent(QEvent * ev)
virtual boolevent(QEvent * e)
virtual voidshowEvent(QShowEvent * e)
  • 3 protected functions inherited fromQFrame
  • 37 protected functions inherited fromQWidget
  • 8 protected functions inherited fromQObject
  • 1 protected function inherited fromQPaintDevice

Additional Inherited Members

  • 4 static public members inherited fromQWidget
  • 7 static public members inherited fromQObject
  • 1 protected slot inherited fromQWidget

Detailed Description

TheQToolBox class provides a column of tabbed widget items.

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 aQWidget.

Each item has anitemText(), an optionalitemIcon(), an optionalitemToolTip(), and awidget(). The item's attributes can be changed withsetItemText(),setItemIcon(), andsetItemToolTip(). Each item can be enabled or disabled individually withsetItemEnabled().

Items are added usingaddItem(), 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 bycurrentIndex(), and set withsetCurrentIndex(). The index of a particular item can be found usingindexOf(), and the item at a given index is returned byitem().

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

See alsoQTabWidget.

Property Documentation

count : constint

This property holds the number of items contained in the toolbox.

By default, this property has a value of 0.

Access functions:

intcount() const

currentIndex :int

This property holds the index of the current item.

By default, for an empty toolbox, this property has a value of -1.

Access functions:

intcurrentIndex() const
voidsetCurrentIndex(int index)

Notifier signal:

voidcurrentChanged(int index)

See alsoindexOf() andwidget().

Member Function Documentation

QToolBox::QToolBox(QWidget * parent = 0,Qt::WindowFlags f = 0)

Constructs a new toolbox with the givenparent and the flags,f.

QToolBox::~QToolBox()

Destroys the toolbox.

int QToolBox::addItem(QWidget * widget, constQIcon & iconSet, constQString & text)

Adds thewidget in a new tab at bottom of the toolbox. The new tab's text is set totext, and theiconSet is displayed to the left of thetext. Returns the new tab's index.

int QToolBox::addItem(QWidget * w, constQString & text)

This is an overloaded function.

Adds the widgetw in a new tab at bottom of the toolbox. The new tab's text is set totext. Returns the new tab's index.

[virtual protected]void QToolBox::changeEvent(QEvent * ev)

Reimplemented fromQWidget::changeEvent().

QWidget * QToolBox::currentWidget() const

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

See alsocurrentIndex() andsetCurrentWidget().

[virtual protected]bool QToolBox::event(QEvent * e)

Reimplemented fromQObject::event().

int QToolBox::indexOf(QWidget * widget) const

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

int QToolBox::insertItem(int index,QWidget * widget, constQIcon & icon, constQString & text)

Inserts thewidget at positionindex, or at the bottom of the toolbox ifindex is out of range. The new item's text is set totext, and theicon is displayed to the left of thetext. Returns the new item's index.

int QToolBox::insertItem(int index,QWidget * widget, constQString & text)

This is an overloaded function.

Inserts thewidget at positionindex, or at the bottom of the toolbox ifindex is out of range. The new item's text is set totext. Returns the new item's index.

bool QToolBox::isItemEnabled(int index) const

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

QIcon QToolBox::itemIcon(int index) const

Returns the icon of the item at positionindex, or a null icon ifindex is out of range.

See alsosetItemIcon().

[virtual protected]void QToolBox::itemInserted(int index)

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

See alsoitemRemoved().

[virtual protected]void QToolBox::itemRemoved(int index)

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

See alsoitemInserted().

QString QToolBox::itemText(int index) const

Returns the text of the item at positionindex, or an empty string ifindex is out of range.

See alsosetItemText().

QString QToolBox::itemToolTip(int index) const

Returns the tooltip of the item at positionindex, or an empty string ifindex is out of range.

See alsosetItemToolTip().

void QToolBox::removeItem(int index)

Removes the item at positionindex from the toolbox. Note that the widget isnot deleted.

[slot]void QToolBox::setCurrentWidget(QWidget * widget)

Makeswidget the current widget. Thewidget must be an item in this tool box.

See alsoaddItem(),setCurrentIndex(), andcurrentWidget().

void QToolBox::setItemEnabled(int index,bool enabled)

Ifenabled is true then the item at positionindex is enabled; otherwise the item at positionindex is disabled.

See alsoisItemEnabled().

void QToolBox::setItemIcon(int index, constQIcon & icon)

Sets the icon of the item at positionindex toicon.

See alsoitemIcon().

void QToolBox::setItemText(int index, constQString & text)

Sets the text of the item at positionindex totext.

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 theQShortcut documentation for details (to display an actual ampersand, use '&&').

See alsoitemText().

void QToolBox::setItemToolTip(int index, constQString & toolTip)

Sets the tooltip of the item at positionindex totoolTip.

See alsoitemToolTip().

[virtual protected]void QToolBox::showEvent(QShowEvent * e)

Reimplemented fromQWidget::showEvent().

QWidget * QToolBox::widget(int index) const

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

© 2016 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of theGNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.


[8]ページ先頭

©2009-2025 Movatter.jp