libyui-qt
 
Loading...
Searching...
No Matches
YQSelectorItemWidget Class Reference

#include <YQItemSelector.h>

Inheritance diagram for YQSelectorItemWidget:
Collaboration diagram for YQSelectorItemWidget:

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
 
YQItemSelectorparent () 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
 

Detailed Description

Class for the widgets of one ItemSelector item

Constructor & Destructor Documentation

◆ YQSelectorItemWidget()

YQSelectorItemWidget::YQSelectorItemWidget ( YQItemSelector * parent,
YItem * item )

Constructor.

◆ ~YQSelectorItemWidget()

YQSelectorItemWidget::~YQSelectorItemWidget ( )
virtual

Destructor.

Member Function Documentation

◆ createHeadingToggle()

QAbstractButton * YQSelectorItemWidget::createHeadingToggle ( const std::string & label,
QWidget * parent )
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.

◆ createWidgets()

void YQSelectorItemWidget::createWidgets ( )
virtual

Create the subwidgets. This needs to be called from the outside immediately after creating an instance of this class.

◆ headingToggle()

QAbstractButton * YQSelectorItemWidget::headingToggle ( ) const
inline

Return the widget that handles the selection: Either a QRadioButton or a QCheckBox. Both inherit QAbstractButton which has 'isChecked()' and 'setChecked()'.

◆ itemDescriptionIndent()

int YQSelectorItemWidget::itemDescriptionIndent ( ) const
protectedvirtual

Return the amount of indentation in pixels for the description text.

Reimplemented in YQCustomStatusSelectorItemWidget.

◆ multiSelection()

bool YQSelectorItemWidget::multiSelection ( ) const
inline

Return 'true' if the parent YItemSelector has multi selection (n-of-m).

◆ selected()

bool YQSelectorItemWidget::selected ( ) const
virtual

Return 'true' if this item is selected, 'false' otherwise.

◆ setFirstItemProperty()

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

◆ setLabel()

void YQSelectorItemWidget::setLabel ( const QString & label)

Set a new label.

This method is mainly used when fixing shortcuts conflicts.

◆ setSelected()

void YQSelectorItemWidget::setSelected ( bool sel = true)
virtual

Select the appropriate widget according to the parent's selection policy (single or multi selection).

◆ singleSelection()

bool YQSelectorItemWidget::singleSelection ( ) const

Return 'true' if the parent YItemSelector has single selection (1-of-n).


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