#include <YQItemSelector.h>
Signals | |
void | selectionChanged (YQSelectorItemWidget *itemWidget, bool selected) |
Public Member Functions | |
YQSelectorItemWidget (YQItemSelector *parent, YItem *item) | |
virtual | ~YQSelectorItemWidget () |
virtual void | createWidgets () |
virtual void | setSelected (bool sel=true) |
virtual bool | selected () const |
bool | singleSelection () const |
bool | multiSelection () const |
void | setFirstItemProperty (bool value=true) |
void | setLabel (const QString &label) |
QAbstractButton * | headingToggle () const |
YQItemSelector * | parent () const |
QLabel * | descriptionLabel () const |
QLabel * | iconLabel () const |
YItem * | item () const |
Protected Slots | |
void | slotSelectionChanged (bool selected) |
Protected Member Functions | |
virtual void | createWidgets (const std::string &label, const std::string &description, const std::string &iconName, bool selected=false) |
virtual QAbstractButton * | createHeadingToggle (const std::string &label, QWidget *parent) |
virtual int | itemDescriptionIndent () const |
Protected Attributes | |
YQItemSelector * | _parent |
YItem * | _item |
QHBoxLayout * | _hBox |
QVBoxLayout * | _vBox |
QAbstractButton * | _headingToggle |
QLabel * | _descriptionLabel |
QLabel * | _iconLabel |
Class for the widgets of one ItemSelector item
YQSelectorItemWidget::YQSelectorItemWidget | ( | YQItemSelector * | parent, |
YItem * | item ) |
Constructor.
|
virtual |
Destructor.
|
protectedvirtual |
Create the appropriate toggle button for this item and connect it to appropriate slots.
This base class will create a QRadioButton or a QCheckBox, depending on the parent YQItemSelector's single or multi selection mode.
Derived classes can overwrite this to create a different widget.
Reimplemented in YQCustomStatusSelectorItemWidget.
|
virtual |
Create the subwidgets. This needs to be called from the outside immediately after creating an instance of this class.
|
inline |
Return the widget that handles the selection: Either a QRadioButton or a QCheckBox. Both inherit QAbstractButton which has 'isChecked()' and 'setChecked()'.
|
protectedvirtual |
Return the amount of indentation in pixels for the description text.
Reimplemented in YQCustomStatusSelectorItemWidget.
|
inline |
Return 'true' if the parent YItemSelector has multi selection (n-of-m).
|
virtual |
Return 'true' if this item is selected, 'false' otherwise.
void YQSelectorItemWidget::setFirstItemProperty | ( | bool | value = true | ) |
Set a dynamic property "first-item" for use in QSS styling.
Use this in QSS as one of the following:
*[first-item="true"] { background-color: orange; } #selectorItem[first-item="true"] { background-color: orange; } #selectorItem[first-item="false"] { background-color: cyan; } #selectorItem { background-color: white; }
YQItemSelector [first-item="true"] { background-color: orange; } YQItemSelector [first-item="false"] { background-color: cyan; }
YQItemSelector #selectorItem { background-color: white; } YQItemSelector #selectorItem[first-item="true"] { background-color: orange; } YQItemSelector #selectorItem[first-item="false"] { background-color: cyan; }
See also https://doc.qt.io/qt-5/stylesheet-examples.html#customizing-using-dynamic-properties
void YQSelectorItemWidget::setLabel | ( | const QString & | label | ) |
Set a new label.
This method is mainly used when fixing shortcuts conflicts.
|
virtual |
Select the appropriate widget according to the parent's selection policy (single or multi selection).
bool YQSelectorItemWidget::singleSelection | ( | ) | const |
Return 'true' if the parent YItemSelector has single selection (1-of-n).