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=0)
 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 = 0)

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(), plotSave.TaskPanel.TaskPanel::accept(), shipAreasCurve.TaskPanel.TaskPanel::accept(), shipCapacityCurve.TaskPanel.TaskPanel::accept(), shipCreateShip.TaskPanel.TaskPanel::accept(), shipCreateTank.TaskPanel.TaskPanel::accept(), shipCreateWeight.TaskPanel.TaskPanel::accept(), shipGZ.TaskPanel.TaskPanel::accept(), shipHydrostatics.TaskPanel.TaskPanel::accept(), shipLoadExample.TaskPanel.TaskPanel::accept(), Mod.PartDesign.WizardShaft.WizardShaftTable.WizardShaftTable::addColumn(), MaterialEditor.MaterialEditor::addCustomProperty(), changeEvent(), MaterialEditor.MaterialEditor::chooseMaterial(), MaterialEditor.MaterialEditor::deleteCustomProperty(), MaterialEditor.MaterialEditor::exec_(), PathScripts.PathGui.QuantitySpinBox::expression(), plotSeries.TaskPanel.TaskPanel::fillStyles(), 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(), shipAreasCurve.TaskPanel.TaskPanel::initValues(), shipHydrostatics.TaskPanel.TaskPanel::initValues(), shipOutlineDraw.TaskPanel.TaskPanel::loadSections(), plotAxes.TaskPanel.TaskPanel::onAlign(), plotAxes.TaskPanel.TaskPanel::onAxesId(), plotLabels.TaskPanel.TaskPanel::onAxesId(), MaterialEditor.MaterialEditor::onClickTree(), plotSeries.TaskPanel.TaskPanel::onColor(), shipOutlineDraw.TaskPanel.TaskPanel::onCreateButton(), plotSeries.TaskPanel.TaskPanel::onData(), plotPositions.TaskPanel.TaskPanel::onData(), shipAreasCurve.TaskPanel.TaskPanel::onData(), shipCreateShip.TaskPanel.TaskPanel::onData(), shipHydrostatics.TaskPanel.TaskPanel::onData(), shipOutlineDraw.TaskPanel.TaskPanel::onDeleteButton(), plotAxes.TaskPanel.TaskPanel::onDims(), plotLabels.TaskPanel.TaskPanel::onFontSizes(), plotLabels.TaskPanel.TaskPanel::onLabels(), plotAxes.TaskPanel.TaskPanel::onNew(), plotAxes.TaskPanel.TaskPanel::onOffset(), plotSave.TaskPanel.TaskPanel::onPathButton(), plotAxes.TaskPanel.TaskPanel::onRemove(), plotAxes.TaskPanel.TaskPanel::onScales(), shipOutlineDraw.TaskPanel.TaskPanel::onSectionType(), shipOutlineDraw.TaskPanel.TaskPanel::onTableItem(), shipAreasCurve.TaskPanel.TaskPanel::onUpdate(), MaterialEditor.MaterialEditor::openfile(), MaterialEditor.MaterialEditor::openProductURL(), MaterialEditor.MaterialEditor::reject(), plotAxes.TaskPanel.TaskPanel::retranslateUi(), plotLabels.TaskPanel.TaskPanel::retranslateUi(), plotPositions.TaskPanel.TaskPanel::retranslateUi(), plotSave.TaskPanel.TaskPanel::retranslateUi(), plotSeries.TaskPanel.TaskPanel::retranslateUi(), shipAreasCurve.TaskPanel.TaskPanel::retranslateUi(), shipCapacityCurve.TaskPanel.TaskPanel::retranslateUi(), shipCreateShip.TaskPanel.TaskPanel::retranslateUi(), shipCreateTank.TaskPanel.TaskPanel::retranslateUi(), shipCreateWeight.TaskPanel.TaskPanel::retranslateUi(), shipGZ.TaskPanel.TaskPanel::retranslateUi(), shipHydrostatics.TaskPanel.TaskPanel::retranslateUi(), shipLoadExample.TaskPanel.TaskPanel::retranslateUi(), shipOutlineDraw.TaskPanel.TaskPanel::retranslateUi(), shipAreasCurve.TaskPanel.TaskPanel::save(), shipGZ.TaskPanel.TaskPanel::save(), shipHydrostatics.TaskPanel.TaskPanel::save(), MaterialEditor.MaterialEditor::savefile(), Mod.PartDesign.WizardShaft.WizardShaftTable.WizardShaftTable::setDoubleValue(), plotPositions.TaskPanel.TaskPanel::setList(), plotSeries.TaskPanel.TaskPanel::setList(), Mod.PartDesign.WizardShaft.WizardShaftTable.WizardShaftTable::setListValue(), PathScripts.PathGui.QuantitySpinBox::setMinimum(), shipOutlineDraw.TaskPanel.TaskPanel::setSectionType(), MaterialEditor.MaterialEditor::show(), MaterialEditor.MaterialEditor::storeSize(), MaterialEditor.MaterialEditor::updateCardsInCombo(), MaterialEditor.MaterialEditor::updateMatParamsInTree(), MaterialEditor.MaterialEditor::updatePreviews(), PathScripts.PathGui.QuantitySpinBox::updateProperty(), PathScripts.PathGui.QuantitySpinBox::updateSpinBox(), plotAxes.TaskPanel.TaskPanel::updateUI(), plotLabels.TaskPanel.TaskPanel::updateUI(), plotPositions.TaskPanel.TaskPanel::updateUI(), plotSave.TaskPanel.TaskPanel::updateUI(), and plotSeries.TaskPanel.TaskPanel::updateUI().


The documentation for this class was generated from the following files:
  • Sources/FreeCAD/src/Gui/ToolBox.h
  • Sources/FreeCAD/src/Gui/ToolBox.cpp