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... | |
QWidget * | currentWidget () 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... | |
QWidget * | widget (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... | |
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.
ToolBox::ToolBox | ( | QWidget * | parent = nullptr | ) |
Constructs a toolbox called name with parent parent and flags f.
References draftgeoutils.intersections::connect(), and currentChanged().
|
virtual |
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.
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.
|
protected |
If to a new language is switched this method gets called.
References count(), setItemText(), and widget().
int ToolBox::count | ( | ) | const |
Returns the number of items contained in the toolbox.
Referenced by changeEvent(), importDXF.dxfcounter::incr(), importSVG.svgHandler::startElement(), Mod.Test.BaseTests.ConsoleTestCase::testAsynchronPrintFromThread(), and Mod.Test.BaseTests.ConsoleTestCase::testSynchronPrintFromThread().
|
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().
int ToolBox::currentIndex | ( | ) | const |
Returns the index of the current item, or -1 if the toolbox is empty.
QWidget * ToolBox::currentWidget | ( | ) | const |
Returns the toolbox's current item, or 0 if the toolbox is empty.
Returns the index of item item, or -1 if the item does not exist.
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.
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.
Returns true if the item at position index is enabled; otherwise returns false.
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.
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.
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.
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.
|
slot |
Sets the index of the current item, or -1 if the toolbox is empty to index.
|
slot |
Sets the current item to be item.
If enabled is true then the item at position index is enabled; otherwise item index is disabled.
void ToolBox::setItemIcon | ( | int | index, |
const QIcon & | iconSet | ||
) |
Sets the icon of the item at position index to iconSet.
void ToolBox::setItemText | ( | int | index, |
const QString & | label | ||
) |
Sets the label of the item at position index to label.
Referenced by changeEvent().
void ToolBox::setItemToolTip | ( | int | index, |
const QString & | toolTip | ||
) |
Sets the tooltip of the item at position index to toolTip.
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().