• 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
  • CDPBaseTabWidget

CDPBaseTabWidget Class

The Tab Widget provides a stack of pages that can contain any widgets. More...

Header: #include <CDPBaseTabWidget>
Inherits: StateChanger,
  • List of all members, including inherited members

Public Types

typedef StylingSvgMap
enum StylingType { NoFile, CSS, SVG }

Properties

  • cssFile : QString
  • lockWidgetStyle : bool
  • stylingType : StylingType
  • svgFile : QString
  • tabPaneLine : bool
  • tabPosCss : const int
  • widgetStyle : int

Public Functions

CDPBaseTabWidget(QWidget *parent = 0)
~CDPBaseTabWidget()
void addWidget(QWidget *widget, const QString &title = "") override
QString cssFile()
void forceWidgetStyle(int style)
bool isCssStyling()
bool isSvgStyling()
bool lockWidgetStyle()
void removeWidgets() override
void setCssFile(const QString svg)
virtual void setIQtCDPPointer(IQtCDP *pIQtCDP)
void setLockWidgetStyle(bool enable)
void setStylingType(CDPBaseTabWidget::StylingType type)
void setSvgFile(const QString &svg)
void setTabPaneLine(bool enable)
StylingType stylingType()
QString svgFile()
bool tabPaneLine()
virtual int tabPosCss()
int widgetStyle()
  • 3 public functions inherited from StateChanger

Public Slots

void forwardStateChange(int dummy)
virtual void hideWidget()
virtual void setInCommand(bool cmd)
virtual void setSmoothPixmap(bool smooth)
virtual void setWidgetFont(const QString &font)
virtual void setWidgetStyle(int style)
virtual void setWidgetTheme(const QString &theme)
virtual void showWidget()

Protected Functions

virtual void tabInserted(int index)

Detailed Description

The Tab Widget provides a stack of pages that can contain any widgets.

To add more tabs to the widget, right-click and select Insert Page.

The tab buttons do not support showing markers/bubbles, toggling enabled/disabled, or hide/show like the other buttons in the CDP Studio Design mode. To get functionality like this we should rather use a Stacked Widget and add separate buttons outside it for controlling the page index.

In a design where the Tab Widget has all the required features except markers/bubbles on the tab buttons, this can be solved using a button placed in the same parent widget as the Tab Widget as explained in the button details.

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).

Main element structure

The following tree view shows the svg structure that can be used on the CDPBaseTabWidget.

svg
└─── Layer1
      ├─── cdpBorderWidth         (transparent rect/path)
      ├─── cdpTabBorderMargins    (transparent rect/path)
      ├─── cdpTabSpacing          (transparent rect/path)
      ├─── cdpPaneBorderPixPath   (text)
      ├─── cdpTabSelected         (element group)
      │     ├─── < Path >         (transparent rect/path)
      │     └─── < Group >        (graphics)
      ├─── cdpTabNormal           (element group)
      │     ├─── < Path >         (transparent rect/path)
      │     └─── < Group >        (graphics)
      ├─── cdpTabSelectedText     (text)
      └─── cdpTabNormalText       (text)

The following table explains the named elements in more detail.

PropertyTypeDescription
cdpBorderWidthrectThe width of this element sets the border width of pane and tabs.
cdpTabBorderMarginsrectTransparent rectangle that specifies the right tab border margin by its width and the bottom tab border margin by its height.
cdpTabSpacingrectTransparent rectangle that specifies tab spacing by its width.
cdpTabPaneBorderPixPathtextThe text on this element specifies the path to the pane border pixmap.
cdpTabNormalTexttextSet font and font size on the text that are to show on tabs.
cdpTabSelectedTexttextSet font and font size on the text that are to show on the selected tab. Note that the CDPBaseTabWidget currently uses normal text on both selected and normal.
cdpTabSelectedrect or an element group containing a rectSimilar to cdpPicture, but should contain the next picture in the sequence.
cdpTabNormalrect or an element group containing a rectSimilar to cdpPicture, but should contain the next picture in the sequence.

Style element structure

The following tree view shows the style structure of the tab widget.

svg
├─── Layer1
│     └─── ...                    (see previous section)
└─── Styles
      ├─── cdpPaneBorderPixPathX  (text)
      ├─── cdpTabSelectedX        (element group)
      │     ├─── < Path >         (transparent rect/path)
      │     └─── < Group >        (graphics)
      ├─── cdpTabNormalX          (element group)
      │     ├─── < Path >         (transparent rect/path)
      │     └─── < Group >        (graphics)
      ├─── cdpTabSelectedTextX    (text)
      └─── cdpTabNormalTextX      (text)

Member Type Documentation

typedef CDPBaseTabWidget::StylingSvgMap

enum CDPBaseTabWidget::StylingType

Property Documentation

cssFile : QString

This property holds the css file to use for customization.

http://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qspinbox

Access functions:

QString cssFile()
void setCssFile(const QString svg)

See also svgFile.

lockWidgetStyle : bool

This property holds whether the widget style can be changed or not.

Access functions:

bool lockWidgetStyle()
void setLockWidgetStyle(bool enable)

See also widgetStyle.

stylingType : StylingType

This property holds a selection of how to customize the widget.

Options are: "NoFile" (Don't use a file for customization) "CSS" (Use a css file specified by cssFile property for customization) "SVG" (Use a svg file specified by svgFile property for customization)

Note: To customize in QtDesigner, set this property to "NoFile".

Access functions:

StylingType stylingType()
void setStylingType(CDPBaseTabWidget::StylingType type)

See also svgFile and cssFile.

svgFile : QString

This property holds the path to the svg file that styles the widget.

The path can be either to a resource or a file on disk.

Note: Resources can be overridden by files on disk with identical names.

Access functions:

QString svgFile()
void setSvgFile(const QString &svg)

See also cssFile.

tabPaneLine : bool

This property holds whether to show a pane line below the tabs or not.

Access functions:

bool tabPaneLine()
void setTabPaneLine(bool enable)

tabPosCss : const int

Access functions:

virtual int tabPosCss()

widgetStyle : int

This property holds the widget style to use from the svg file.

Note: This ill only have effect if the svg file provides styles.

Access functions:

int widgetStyle()
void forceWidgetStyle(int style)

Member Function Documentation

CDPBaseTabWidget::CDPBaseTabWidget(QWidget *parent = 0)

Default constructs an instance of CDPBaseTabWidget.

CDPBaseTabWidget::~CDPBaseTabWidget()

Destroys the instance of CDPBaseTabWidget.

void CDPBaseTabWidget::addWidget(QWidget *widget, const QString &title = "")

[slot] void CDPBaseTabWidget::forwardStateChange(int dummy)

[virtual slot] void CDPBaseTabWidget::hideWidget()

bool CDPBaseTabWidget::isCssStyling()

bool CDPBaseTabWidget::isSvgStyling()

void CDPBaseTabWidget::removeWidgets()

[virtual] void CDPBaseTabWidget::setIQtCDPPointer(IQtCDP *pIQtCDP)

[virtual slot] void CDPBaseTabWidget::setInCommand(bool cmd)

[virtual slot] void CDPBaseTabWidget::setSmoothPixmap(bool smooth)

[virtual slot] void CDPBaseTabWidget::setWidgetFont(const QString &font)

[virtual slot] void CDPBaseTabWidget::setWidgetStyle(int style)

See also widgetStyle().

[virtual slot] void CDPBaseTabWidget::setWidgetTheme(const QString &theme)

[virtual slot] void CDPBaseTabWidget::showWidget()

[virtual protected] void CDPBaseTabWidget::tabInserted(int index)

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