Gui::DockWnd::ToolBox Class Reference

The ToolBox class provides a column of tabbed widget items. More...

#include <ToolBox.h>

Public Slots

void setCurrentIndex (int index)
 Sets the index of the current item, or -1 if the toolbox is empty to index. More...
 
void setCurrentWidget (QWidget *item)
 Sets the current item to be item. More...
 

Signals

void currentChanged (int index)
 This signal is emitted when the current item changed. More...
 

Public Member Functions

int addItem (QWidget *item, const QIcon &iconSet, const QString &label)
 Adds the widget item in a new tab at bottom of the toolbox. More...
 
int addItem (QWidget *w, const QString &label)
 Adds the widget w in a new tab at bottom of the toolbox. More...
 
int count () const
 Returns the number of items contained in the toolbox. More...
 
int currentIndex () const
 Returns the index of the current item, or -1 if the toolbox is empty. More...
 
QWidgetcurrentWidget () const
 Returns the toolbox's current item, or 0 if the toolbox is empty. More...
 
int indexOf (QWidget *item) const
 Returns the index of item item, or -1 if the item does not exist. More...
 
int insertItem (int index, QWidget *item, const QIcon &iconSet, const QString &label)
 Inserts the widget item at position index, or at the bottom of the toolbox if index is out of range. More...
 
int insertItem (int index, QWidget *item, const QString &label)
 This is an overloaded member function, provided for convenience. More...
 
bool isItemEnabled (int index) const
 Returns true if the item at position index is enabled; otherwise returns false. More...
 
QIcon itemIcon (int index) const
 Returns the icon of the item at position index, or a null icon if index is out of range. More...
 
QString itemText (int index) const
 Returns the label of the item at position index, or a null string if index is out of range. More...
 
QString itemToolTip (int index) const
 Returns the tooltip of the item at position index, or a null string if index is out of range. More...
 
void removeItem (int index)
 Removes the widget item from the toolbox. More...
 
void setItemEnabled (int index, bool enabled)
 If enabled is true then the item at position index is enabled; otherwise item index is disabled. More...
 
void setItemIcon (int index, const QIcon &iconSet)
 Sets the icon of the item at position index to iconSet. More...
 
void setItemText (int index, const QString &label)
 Sets the label of the item at position index to label. More...
 
void setItemToolTip (int index, const QString &toolTip)
 Sets the tooltip of the item at position index to toolTip. More...
 
 ToolBox (QWidget *parent=nullptr)
 Constructs a toolbox called name with parent parent and flags f. More...
 
QWidgetwidget (int index) const
 Returns the item at position index, or 0 if there is no such item. More...
 
virtual ~ToolBox ()
 

Protected Member Functions

void changeEvent (QEvent *e)
 If to a new language is switched this method gets called. More...
 

Detailed Description

The ToolBox 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 a QWidget.

Each item has an itemLabel(), an optional icon, itemIconSet(), an optional itemToolTip(), and a widget. The item's attributes can be changed with setItemLabel(), setItemIconSet() and setItemToolTip().

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 to move items to different positions.

The current item widget is returned by currentItem() and set with setCurrentItem(). If you prefer you can work in terms of indexes using currentIndex(), setCurrentIndex(), indexOf() and item().

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

Note: This class implements the same API as the QToolBox does provided by Qt unless removeItem(), which also deletes the item to be removed.

Author
Werner Mayer

Constructor & Destructor Documentation

◆ ToolBox()

ToolBox::ToolBox ( QWidget parent = nullptr)

Constructs a toolbox called name with parent parent and flags f.

References draftgeoutils.intersections::connect(), and currentChanged().

◆ ~ToolBox()

ToolBox::~ToolBox ( )
virtual

Member Function Documentation

◆ addItem() [1/2]

int ToolBox::addItem ( QWidget item,
const QIcon &  iconSet,
const QString &  label 
)

Adds the widget item in a new tab at bottom of the toolbox.

The new tab's label is set to label, and the iconSet is displayed to the left of the label. Returns the new tab's index.

◆ addItem() [2/2]

int ToolBox::addItem ( QWidget w,
const QString &  label 
)

Adds the widget w in a new tab at bottom of the toolbox.

The new tab's label is set to label. Returns the new tab's index.

◆ changeEvent()

void ToolBox::changeEvent ( QEvent e)
protected

If to a new language is switched this method gets called.

References count(), setItemText(), and widget().

◆ count()

◆ currentChanged

void Gui::DockWnd::ToolBox::currentChanged ( int  index)
signal

This signal is emitted when the current item changed.

The new current item's index is passed in index, or -1 if there is no current item.

Referenced by ToolBox().

◆ currentIndex()

int ToolBox::currentIndex ( ) const

Returns the index of the current item, or -1 if the toolbox is empty.

◆ currentWidget()

QWidget * ToolBox::currentWidget ( ) const

Returns the toolbox's current item, or 0 if the toolbox is empty.

◆ indexOf()

int ToolBox::indexOf ( QWidget item) const

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

◆ insertItem() [1/2]

int ToolBox::insertItem ( int  index,
QWidget item,
const QIcon &  iconSet,
const QString &  label 
)

Inserts the widget item at position index, or at the bottom of the toolbox if index is out of range.

The new item's label is set to label, and the iconSet is displayed to the left of the label. Returns the new item's index.

◆ insertItem() [2/2]

int ToolBox::insertItem ( int  index,
QWidget item,
const QString &  label 
)

This is an overloaded member function, provided for convenience.

It behaves essentially like the above function.

Inserts the widget item at position index, or at the bottom of the toolbox if index is out of range. The new item's label is set to label. Returns the new item's index.

◆ isItemEnabled()

bool ToolBox::isItemEnabled ( int  index) const

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

◆ itemIcon()

QIcon ToolBox::itemIcon ( int  index) const

Returns the icon of the item at position index, or a null icon if index is out of range.

◆ itemText()

QString ToolBox::itemText ( int  index) const

Returns the label of the item at position index, or a null string if index is out of range.

◆ itemToolTip()

QString ToolBox::itemToolTip ( int  index) const

Returns the tooltip of the item at position index, or a null string if index is out of range.

◆ removeItem()

void ToolBox::removeItem ( int  index)

Removes the widget item from the toolbox.

Returns the removed widget's index, or -1 if the widget was not in this tool box.

◆ setCurrentIndex

void ToolBox::setCurrentIndex ( int  index)
slot

Sets the index of the current item, or -1 if the toolbox is empty to index.

◆ setCurrentWidget

void ToolBox::setCurrentWidget ( QWidget item)
slot

Sets the current item to be item.

◆ setItemEnabled()

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

If enabled is true then the item at position index is enabled; otherwise item index is disabled.

◆ setItemIcon()

void ToolBox::setItemIcon ( int  index,
const QIcon &  iconSet 
)

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

◆ setItemText()

void ToolBox::setItemText ( int  index,
const QString &  label 
)

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

Referenced by changeEvent().

◆ setItemToolTip()

void ToolBox::setItemToolTip ( int  index,
const QString &  toolTip 
)

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

◆ widget()

QWidget * ToolBox::widget ( int  index) const

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

Referenced by MaterialEditor.MaterialEditor::accept(), Mod.PartDesign.WizardShaft.WizardShaftTable.WizardShaftTable::addColumn(), MaterialEditor.MaterialEditor::addCustomProperty(), PathScripts.PathGui.QuantitySpinBox::attachTo(), changeEvent(), MaterialEditor.MaterialEditor::chooseMaterial(), MaterialEditor.MaterialEditor::deleteCustomProperty(), MaterialEditor.MaterialEditor::exec_(), PathScripts.PathGui.QuantitySpinBox::expression(), MaterialEditor.MaterialEditor::getDict(), Mod.PartDesign.WizardShaft.WizardShaftTable.WizardShaftTable::getDoubleValue(), Mod.PartDesign.WizardShaft.WizardShaftTable.WizardShaftTable::getFocusedCell(), Mod.PartDesign.WizardShaft.WizardShaftTable.WizardShaftTable::getFocusedColumn(), Mod.PartDesign.WizardShaft.WizardShaftTable.WizardShaftTable::getListValue(), MaterialEditor.MaterialEditor::implementModel(), MaterialEditor.MaterialEditor::onClickTree(), PathScripts.PathGui.QuantitySpinBox::onWidgetValueChanged(), MaterialEditor.MaterialEditor::openfile(), MaterialEditor.MaterialEditor::openProductURL(), MaterialEditor.MaterialEditor::outputDict(), package_list.PackageListItemDelegate::paint(), MaterialEditor.MaterialEditor::reject(), MaterialEditor.MaterialEditor::savefile(), Mod.PartDesign.WizardShaft.WizardShaftTable.WizardShaftTable::setDoubleValue(), Mod.PartDesign.WizardShaft.WizardShaftTable.WizardShaftTable::setListValue(), PathScripts.PathGui.QuantitySpinBox::setMinimum(), MaterialEditor.MaterialEditor::show(), package_list.PackageListItemDelegate::sizeHint(), MaterialEditor.MaterialEditor::storeSize(), package_list.PackageListItemDelegate::update_content(), MaterialEditor.MaterialEditor::updateCardsInCombo(), MaterialEditor.MaterialEditor::updateMatParamsInTree(), MaterialEditor.MaterialEditor::updatePreviews(), PathScripts.PathGui.QuantitySpinBox::updateProperty(), and PathScripts.PathGui.QuantitySpinBox::updateSpinBox().


The documentation for this class was generated from the following files: