• Skip to main content
  • Skip to header right navigation
  • Skip to site footer
CDP Studio logo

CDP Studio

The no-code and full-code software development tool for distributed control systems and HMI

  • Doc
  • Why CDP
    • Software developers
    • Automation engineers
    • Managers
  • Products
    • Automation Designer
    • HMI Designer
    • Maritime HMIs
  • Services
  • Use cases
  • Pricing
  • Try CDP

CDP Studio Documentation

  • GUI - CDP Widgets
  • CDPBaseTextSelector

CDPBaseTextSelector Class

The Text Selector displays different texts based on numeric values. More...

Header: #include <CDPBaseTextSelector>
Inherits: CDPBaseComboBox
  • List of all members, including inherited members

Properties

  • alignment : Qt::Alignment
  • editable : bool
  • 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.

PropertyTypeDescription
cdpTexttextThe color and size of the font to be used on the unit text. At the moment we onely use the color from this layer.
cdpBorderMarginTopLeftTransparent rect/pathTransparent rectangle that specifies the right border margin by its width and the bottom border margin by its height.
cdpBorderMarginBottomRightTransparent rect/pathTransparent rectangle that specifies the right border margin by its width and the bottom border margin by its height.
cdpBackgroundrect or an element group containing a rectThe cdpBackground should contain the actual background graphics.
cdpButtonDownrect or an element group containing a rectThe cdpButtonDown should contain the actual button graphics.
cdpButtonDownPressedrect or an element group containing a rectThe cdpButtonDownPressed should contain the graphics to show when the button is pressed.
cdpButtonDownDisabledrect or an element group containing a rectThe cdpButtonDownDisabled should contain the actual button graphics.
cdpIconDownrect or an element group containing a rectThe 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().

The content of this document is confidential information not to be published without the consent of CDP Technologies AS.

CDP Technologies AS, www.cdpstudio.com

Get started with CDP Studio today

Let us help you take your great ideas and turn them into the products your customer will love.

Try CDP Studio for free
Why CDP Studio?

CDP Technologies AS
Hundsværgata 8,
P.O. Box 144
6001 Ålesund, Norway

Tel: +47 990 80 900
E-mail: info@cdptech.com

Company

About CDP

Contact us

Services

Partners

Blog

Developers

Get started

User manuals

Support

Document download

Release notes

My account

Follow CDP

  • LinkedIn
  • YouTube
  • GitHub

© Copyright 2025 CDP Technologies. Privacy and cookie policy.

Return to top