CDPBaseTabWidget Class

The Tab Widget class provides a stack of tabbed widgets. More...

Header: #include <CDPBaseTabWidget>
Inherits: StateChanger,

Public Types

typedef StylingSvgMap
enum StylingType { NoFile, CSS, SVG }

Properties

Public Functions

CDPBaseTabWidget(QWidget *parent = 0)
~CDPBaseTabWidget()
QString cssFile()
void forceWidgetStyle(int style)
bool isCssStyling()
bool isSvgStyling()
bool lockWidgetStyle()
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()

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 class provides a stack of tabbed widgets.

CDPBaseTabWidget can be styled from a svg file. To add more tabs to the widget, “right-click” and select “Insert Page”. Note that the tab widget supports tab markers/bubbles by adding buttons of type CDPBaseButtonPopDlg to a page. Make sure that the button has markerShared enabled and that markers are positioned relative to the tab widget and not the button.

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.

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

[virtual slot] void CDPBaseTabWidget::hideWidget()

bool CDPBaseTabWidget::isCssStyling()

bool CDPBaseTabWidget::isSvgStyling()

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