gqtbuttonswidget
Loading...
Searching...
No Matches
ButtonInfo Struct Reference

Logical description of one icon-button entry used by GQTButtonsWidget. More...

#include <gQtButtonsWidget.h>

Public Member Functions

 ButtonInfo (const std::string &icon)
 Constructs a ButtonInfo for a given base icon name.
 
QIcon iconForState (int state) const
 Returns the icon for a given interaction state.
 

Data Fields

QListWidgetItem * thisButton
 The UI item representing this logical button.
 

Detailed Description

ButtonInfo binds together:

  • a base icon "name" (typically a Qt resource prefix such as ":/images/myButton")
  • a QListWidgetItem used by the UI list view

The helper iconForState() converts the base icon name into a filename using a state suffix:

<base>_<state>.svg
Note
This struct allocates a QListWidgetItem in its constructor and stores it in thisButton. Ownership and lifetime are managed by the container widget that creates these objects.

Definition at line 32 of file gQtButtonsWidget.h.

Constructor & Destructor Documentation

◆ ButtonInfo()

ButtonInfo::ButtonInfo ( const std::string & icon)
explicit
Parameters
iconBase icon name used to build the icon filenames for different states. Typical value is a Qt resource prefix such as ":/images/firstButton".

Definition at line 13 of file gQtButtonsWidget.cc.

Member Function Documentation

◆ iconForState()

QIcon ButtonInfo::iconForState ( int state) const

The file name is constructed as:

<base_icon_name>_<state>.svg

If the file exists, a QIcon is returned. Otherwise an empty QIcon is returned.

Parameters
stateState identifier used in the filename suffix. Convention in this module:
  • 1 : normal
  • 2 : pressed
Returns
QIcon for the requested state or an empty icon if the file does not exist.

Definition at line 24 of file gQtButtonsWidget.cc.

Field Documentation

◆ thisButton

QListWidgetItem* ButtonInfo::thisButton

The item is created in the ButtonInfo constructor and is later inserted into a QListWidget.

Warning
External code should treat this pointer as internal state owned by the widget; do not delete it.

Definition at line 51 of file gQtButtonsWidget.h.


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