CDPBaseTextSelector Class
The Text Selector displays different texts based on numeric values. More...
Header: | #include <CDPBaseWidgets/CDPBaseTextSelector.h> |
Inherits: | CDPBaseComboBox |
Properties
- 28 properties inherited from CDPBaseComboBox
Public Functions
CDPBaseTextSelector(QWidget *parent) | |
virtual | ~CDPBaseTextSelector() |
virtual Qt::Alignment | alignment() |
virtual void | mousePressEvent(QMouseEvent *ev) |
virtual void | setAlignment(Qt::Alignment alignment) |
virtual void | setUserEditable(bool editable) |
virtual bool | userEditable() |
Reimplemented Public Functions
virtual QColor | fontColor() |
virtual void | setFontColor(QColor fontColor) |
- 48 public functions inherited from CDPBaseComboBox
- 3 public functions inherited from StateChanger
- 17 public functions inherited from CDPBaseCom
- 4 public functions inherited from CDPBaseControlVisible
Additional Inherited Members
- 17 public slots inherited from CDPBaseComboBox
- 3 signals inherited from CDPBaseComboBox
- 2 static public members inherited from CDPBaseCom
- 8 protected functions inherited from CDPBaseComboBox
- 4 protected functions inherited from CDPBaseCom
- 1 protected function inherited from CDPBaseControlVisible
- 9 protected slots inherited from CDPBaseComboBox
Detailed Description
The Text Selector displays different texts based on numeric values.
Unlike the CDPBaseComboBox, this widget is read only and can not be changed by user clicks. Note that the above picture shows four different widget states (four widget instances showing different indexes).
Texts are added, removed and rearranged by right-clicking the widget and selecting “Edit Items...” from the context menu. Click on the green plus sign to add text items and note that the order is identical to the signal value for selecting it. Note that we can select to send/receive index numbers or content by editing the cdpUseIndexNr property, inherited from CDPBaseComboBox.
Note that the widget inherits CDPBaseComboBox and thus all of its properties. Some default settings is necessary to make the widget function as intended.
Styling by SVG
Use the svgFile property to style the widget using a svg file. Styling by svg enables switching between different themes in runtime (as long as the files are placed at identical locations within theme directories).
The CDPBaseTextSelector can use the standard svg structure of the CDPBaseComboBox. It can also have its own svg file following the naming conventions listed below.
svg └─── Layer1 ├─── cdpText (text) ├─── cdpBorderMarginTopLeft (transparent rect/path) ├─── cdpBorderMarginBottomRight (transparent rect/path) ├─── cdpBackground (element group) ├─── cdpButtonDown (element group) ├─── cdpButtonDownPressed (element group) ├─── cdpButtonDownDisabled (element group) └─── cdpIconDown (element group) ├─── < Path > (transparent rect/path) └─── < Group > (background graphics)
The following table explains the named elements in more detail.
Property | Type | Description |
---|---|---|
cdpText | text | The color and size of the font to be used on the unit text. At the moment we onely use the color from this layer. |
cdpBorderMarginTopLeft | Transparent rect/path | Transparent rectangle that specifies the right border margin by its width and the bottom border margin by its height. |
cdpBorderMarginBottomRight | Transparent rect/path | Transparent rectangle that specifies the right border margin by its width and the bottom border margin by its height. |
cdpBackground | rect or an element group containing a rect | The cdpBackground should contain the actual background graphics. |
cdpButtonDown | rect or an element group containing a rect | The cdpButtonDown should contain the actual button graphics. |
cdpButtonDownPressed | rect or an element group containing a rect | The cdpButtonDownPressed should contain the graphics to show when the button is pressed. |
cdpButtonDownDisabled | rect or an element group containing a rect | The cdpButtonDownDisabled should contain the actual button graphics. |
cdpIconDown | rect or an element group containing a rect | The cdpButtonDown should contain the actual button graphics. To ensure that the svg parser gets the correct background size (and aspect ratio), we have to place a transparent rect along with the graphics within a group element. |
Property Documentation
alignment : Qt::Alignment
This property holds the alignment of the text.
Access functions:
virtual Qt::Alignment | alignment() |
virtual void | setAlignment(Qt::Alignment alignment) |
editable : bool
This property holds whether to enable editing of the text.
Access functions:
virtual bool | userEditable() |
virtual void | setUserEditable(bool editable) |
Member Function Documentation
CDPBaseTextSelector::CDPBaseTextSelector(QWidget *parent)
Default constructs an instance of CDPBaseTextSelector.
[virtual]
CDPBaseTextSelector::~CDPBaseTextSelector()
Destroys the instance of CDPBaseTextSelector. The destructor is virtual.
[virtual]
QColor CDPBaseTextSelector::fontColor()
See also setFontColor().
[virtual]
void CDPBaseTextSelector::mousePressEvent(QMouseEvent *ev)
[virtual]
void CDPBaseTextSelector::setFontColor(QColor fontColor)
See also fontColor().
Get started with CDP Studio today
Let us help you take your great ideas and turn them into the products your customer will love.