CDPBaseButton Class
The Button widget is a push button with lots of features for communication and styling. More...
Header: | #include <CDPBaseWidgets/CDPBaseButton.h> |
Inherits: | CDPBasePadLauncher, StateChanger, CDPBaseControlVisible, |
Inherited By: |
Public Types
enum | GlobalDialog { None, NumPad, KeyPad, PinPad } |
typedef | StylingMap |
enum | StylingType { NoFile, CSS, SVG, Default, ..., Radio } |
enum | SvgImageParsing { ParseImages, ParseNormal, ParseChecked } |
Properties
|
|
Public Functions
CDPBaseButton(QWidget *parent = NULL) | |
virtual | ~CDPBaseButton() |
StylingType | buttonType() const |
QString | cdpChecked() |
QString | cdpEnabled() |
bool | cdpEnabledRoutedValue() const |
QString | cdpPressed() |
QString | cdpStyle() |
bool | checkableByClick() const |
bool | checkableByEmitValue() const |
QString | cssFile() const |
virtual double | disabledStateOpacity() const |
QString | imageChecked() const |
QString | imageNormal() const |
bool | isImageCheckedAvailable() const |
bool | isImageNormalAvailable() const |
bool | isScaleAvailable() const |
bool | isSvgType() const |
bool | isTypeCss() const |
bool | isTypeSvg() const |
bool | lockAspectRatio() const |
virtual bool | lockWidgetStyle() |
virtual bool | opaquePaintEvent() |
virtual GlobalDialog | padType() |
virtual const QStringList & | pushRoutables() const |
bool | scaledContents() const |
void | setButtonType(StylingType type) |
void | setCdpChecked(QString routing) |
void | setCdpEnabled(QString routing) |
void | setCdpPressed(QString routing) |
void | setCdpStyle(QString routing) |
void | setCheckableByClick(bool checkable) |
void | setCheckableByEmitValue(bool checkable) |
void | setCssFile(QString css, bool bUpdateTheme = true) |
virtual void | setDisabledStateOpacity(double opacity) |
virtual void | setIQtCDPPointer(IQtCDP *pIQtCDP) |
void | setImageChecked(QString pixPath) |
void | setImageNormal(QString pixPath) |
void | setLockAspectRatio(bool enable) |
virtual void | setLockWidgetStyle(bool enable) |
virtual void | setOpaquePaintEvent(bool enable) |
virtual void | setPadType(GlobalDialog dialog) |
void | setScaledContents(bool enable) |
void | setSvgBorderPixmap(bool borderPixmap) |
void | setSvgDebugEnabled(bool enabled) |
void | setSvgFile(const QString &svg) |
void | setSvgFileChecked(const QString &svg) |
void | setSvgFileOrImageBasedOnFormat(QString svg, bool bUpdateTheme = true) |
void | setSvgImageParsing(SvgImageParsing image) |
void | setTextColor(QColor color) |
void | setToggleOnPressed(bool toggle) |
virtual void | setValueToEmit(int value) |
QSize | sizeHint() const override |
bool | svgBorderPixmap() const |
QString | svgFile() const |
QString | svgFileChecked() const |
QString | svgFileOrImageBasedOnFormat() const |
SvgImageParsing | svgImageParsing() const |
QColor | textColor() |
QColor | textColorForCurrentState() const |
bool | toggleOnPressed() const |
virtual int | valueToEmit() |
int | widgetPicture() |
int | widgetStyle() |
- 26 public functions inherited from CDPBasePadLauncher
- 3 public functions inherited from StateChanger
- 4 public functions inherited from CDPBaseControlVisible
Public Slots
virtual void | forceWidgetStyle(int style) |
virtual void | forceWidgetStyle(double style) |
virtual void | handleVisible(double visible) |
virtual void | hideWidget() |
virtual void | selectImageChecked(int checked) |
virtual void | selectImageChecked(bool bSet = true) |
virtual void | selectImageNormal(bool bSet = true) |
virtual void | setButtonText(const QString &text) |
virtual void | setInCommand(bool cmd) |
virtual void | setSmoothPixmap(bool smooth) |
virtual void | setWidgetFont(const QString &font) |
virtual void | setWidgetPicture(int pic) |
virtual void | setWidgetStyle(int style) |
virtual void | setWidgetTheme(const QString &theme) |
virtual void | showWidget() |
Signals
void | checked(int value) |
void | clicked(int value) |
void | enabled(bool enabled) |
void | pushRoutablesChanged(const QStringList &pushers) |
void | signalAcceptedValue(int) |
void | signalAcceptedValue(double) |
void | signalAcceptedValue(QString) |
Protected Functions
void | changeEvent(QEvent *e) override |
const QIcon & | getCurrentImage(QMargins &margins) |
virtual void | loadSvg(bool checked) |
virtual QPixmap | loadSvgPixmap(ButtonSVG::StyleMap &map, QSvgRenderer *pRender, ButtonSVG::StyleMap &mapBg) |
QSize | minimumSizeHint() const override |
void | mousePressEvent(QMouseEvent *e) override |
void | mouseReleaseEvent(QMouseEvent *e) override |
void | nextCheckState() override |
void | paintEvent(QPaintEvent *ev) override |
virtual QSize | pixmapTargetSize(const QSize &pixSize, QMargins *margins = 0) const |
virtual QPoint | rectPos(const QRect &rect) |
void | resizeEvent(QResizeEvent *ev) override |
void | updateImage(QIcon::State state, const QIcon &icon, QIcon &iconToUpdate) |
- 1 protected function inherited from CDPBasePadLauncher
- 1 protected function inherited from CDPBaseControlVisible
Protected Slots
virtual void | acceptedValue(double value = 0) |
virtual void | acceptedValue(QString value) |
virtual void | checkEnable(double value) |
virtual void | emitValueChecked(bool dummy = true) |
virtual void | emitValueClicked() |
void | initDeprecated() |
virtual void | setCheckedByValue(double value) |
virtual void | updateCheckedFromCdp() |
virtual void | updateTextColorFromSvg(bool dummy = true) |
Detailed Description
The Button widget is a push button with lots of features for communication and styling.
See the examples for complete usage guides.
The button has several different states; normal, disabled, pressed, checked and visible. Each of the visible states can have a separate styling in the SVG file as described in Styling by SVG or by using raster images provided in imageNormal and imageChecked.
State | Description |
---|---|
Normal | The default state of the button. |
Disabled | A disabled button is usually grayed out and is not clickable. The state can be toggled using the property named, enabled. It can also be controlled from a CDP object/property by adding routing to the property named, cdpEnabledRouting. |
Pressed | The button is pressed down. This state usually shows the button in a flat contrasted color. To make the button notify CDP that it is pressed, configure cdpPressedRouting with routing to a CDP object/property. The value "1" is sent when the button is pressed and value "0" is sent when the button is released. |
Checked | This is an optional state that can be used to toggle the button on and off. It can be used to make the button function like a stand alone "check box" or as a radio button if grouped with other checkable buttons. The most typical use case is to make the button both display some external state and make it send requests for external state change when pressed. For an example, have a look at How to make buttons show the state of remote objects. The following properties are important when working with the checked state:
|
Visible | Use the property named visible to toggle the visibility of the button or add routing in cdpVisibleRouting to show/hide the button from CDP. |
There are also buttons that extend the current one with features like CDP message sending, CDPBaseButtonMsg, and dialog launching, CDPBaseButtonPopDlg. See the section named Examples, further down the page for button examples.
All widgets support controlling any class property of string or numeric types using routing. When there is no routing property available for a certain feature, we can add it using a Dynamic Property. For more information about this, see the Design Mode Manual regarding Dynamic Routing.
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 shows the svg structure of a simple button with four states.
svg └─── Layer1 ├─── cdpText (text) ├─── cdpTextDisabled (text) ├─── cdpBorderMarginTopLeft (transparent rect/path) ├─── cdpBorderMarginBottomRight (transparent rect/path) ├─── cdpBackground (element group) │ ├─── < Path > (transparent rect/path) │ └─── < Group > (background graphics) ├─── cdpBackgroundPressed (element group) │ ├─── < Path > (transparent rect/path) │ └─── < Group > (background graphics) ├─── cdpButton (element group) │ ├─── < Path > (transparent rect/path) │ └─── < Group > (background graphics) ├─── cdpButtonPressed (element group) │ ├─── < Path > (transparent rect/path) │ └─── < Group > (background graphics) ├─── cdpButtonChecked (element group) │ ├─── < Path > (transparent rect/path) │ └─── < Group > (background graphics) ├─── cdpButtonDisabled (element group) │ ├─── < Path > (transparent rect/path) │ └─── < Group > (background graphics) └─── cdpButtonDisabledChecked (element group) ├─── < Path > (transparent rect/path) └─── < Group > (actual graphics)
The following table explains the named elements in more detail.
Property | Type | Description |
---|---|---|
cdpText | text | The color of the button text. |
cdpTextDisabled | text | The color of the button text in disabled state. |
cdpBorderMarginBottomRight | text | Transparent rectangle that specifies the right border margin by its width and the bottom border margin by its height. |
cdpBorderMarginTopLeft | rect | Transparent rectangle that specifies the left border margin by its width and the top border margin by its height. |
cdpBackground[0..X] | rect or an element group containing a rect | Optional element that can be used to draw a background below the ordinary button image. This element is useful when creating svg with multiple button icons that all share the same background. Modifying the buttons later on will thus only require updating one element. Note: The pressed state can override this element with a background of its own, named cdpBackgroundPressed. Note: The background styles are added with numbers following the name. |
cdpBackgroundPressed[0..X] | rect or an element group containing a rect | Similar to cdpBackground, but for the pressed state. |
cdpButton | rect or an element group containing a rect | The cdpButton 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. |
cdpButtonPressed | rect or an element group containing a rect | The cdpButtonPressed should contain the graphics to show when the button is pressed. 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. |
cdpButtonChecked | rect or an element group containing a rect | The cdpButtonChecked must be present in checkable buttons to make the checked and unchecked states of the button look different. |
cdpButtonDisabled | rect or an element group containing a rect | The cdpButtonDisabled element can be added when wanting something different than the gray image generated by the button. This can be useful when making dark themes where the default disabled look more like an active/enabled button. |
cdpButtonDisabledChecked | rect or an element group containing a rect | The cdpButtonDisabledChecked element should be added when the file has both a cdpButtonDisabled and a cdpButtonChecked element. Use it to make sure that the button shows correct checked state also when disabled. |
Note: Elements that are written with pointy brackets, like < Path >, can be given any name. Avoid cdp prefix as these are special to the parser.
Note: Not all elements have to be present. For instance, if cdpButtonPressed is left out it will make the button show cdpButton also when pressed.
Style element structure
The button also supports styles that can be changed by the widgetStyle property or by cdp signal/object. Styles are useful when wanting the button to show different states of a remote object or when wanting to have multiple button variants/styles in the same file. Note that the button supports adding any number of elements for a certain style. If an element is not present for a certain style number, the button will fall back to the first/ base element.
svg ├─── Layer1 │ └─── ... (see previous section) └─── Styles ├─── cdpTextStyleX (text) ├─── cdpTextDisabledStyleX (text) ├─── cdpButtonStyleX (element group) │ ├─── < Path > (transparent rect/path) │ └─── < Group > (background graphics) ├─── cdpButtonPressedStyleX (element group) │ ├─── < Path > (transparent rect/path) │ └─── < Group > (background graphics) ├─── cdpButtonCheckedStyleX (element group) │ ├─── < Path > (transparent rect/path) │ └─── < Group > (background graphics) ├─── cdpButtonDisabledStyleX (element group) │ ├─── < Path > (transparent rect/path) │ └─── < Group > (background graphics) └─── cdpButtonDisabledCheckedStyleX (element group) ├─── < Path > (transparent rect/path) └─── < Group > (actual graphics)
Note: The “X” in the above names must be replaced with a number and that there is no limit to the number of styles a button can handle.
Picture element structure
The button also supports the svg structure of CDPBasePictureSequence. The cdpBackground elements can be used to add backgrounds to show below the picture styles. This enables the designer to add one background that can be used by multiple elements. The purpose is to only have to edit one background if decided to change a state background on all buttons of a certain type.
Styling examples
Button
A simple button supporting normal, pressed, checked and disabled states only have to include the following elements in Layer1; cdpButton, cdpPressed, cdpChecked and cdpDisabled. Note that the Styles layer is not required and that all states except cdpButton is optional.
Button with styles
A button can have several selectable shapes/colors in one file by utilizing the styles feature. In addition to the Layer1 elements, described in the previous section, this requires adding numbered element in a layer named Styles. Note that the all style elements are optional and it is fully possible to just add one style element like for instance, cdpButtonPressedStyle1. When widgetStyle is set to 1, this will display the button similar to widgetStyle 0, except when pressing the button. Note that styles can be selected either in the designer when developing GUI or by a cdp signal in run time.
Button with styles and common background
In some scenarios, developers might want to create a file with one button and multiple selectable icons. This can be done using the cdpBackground element. To create a pressable button with multiple selectable icons, we can add cdpBackground, cdpBackgroundPressed and cdpButton (containing the first icon) to Layer1, and the remaining icons in the Styles layer, named cdpButtonStyle1 and numbered upwards.
Note that it is also common to save a checked state version of the svg with an outlined cdpBackground and icons in a different color.
Button with a matrix of styles
To create a button that have any number of states and any number of styles, we have to use the picture sequence functionality. This makes it possible for the GUI developer to choose between multiple pictures/icons using one file while still having the ability to make a cdp signal change the state/style of widget by adding routing. To simplify the svg drawing even further we can use the cdpBackground element.
For instance if we want a traffic light button with multiple versions/ icons on top, we could add the following: cdpBackground0, 1 and 2 for the green, yellow and red backgrounds and cdpPicture0 and upwards for the different icons. If we want the icons to show in different colors when the background changes, we can add these versions in the Styles layer; cdpPicture0Style1 and cdpPicture0Style2 for the icon in cdpPicture0 and cdpPicture1Style1, cdpPicture1Style2 for cdpPicture1.
Examples
- How to show markers/bubbles on buttons
- How to make buttons load dialogs
- How to make buttons send CDP messages
- How to make buttons set a CDP signal or property value
- How to make buttons in GUI identical to IO buttons
- How to make buttons show the state of remote objects
- How to configure buttons in a radio group
- How to use buttons in a menu
Member Type Documentation
enum CDPBaseButton::GlobalDialog
This enum type specifies a dialog type:
Constant | Value | Description |
---|---|---|
CDPBaseButton::None | CDPBasePadLauncher::None | Do not use a global dialog. |
CDPBaseButton::NumPad | CDPBasePadLauncher::NumPad | A numeric key pad. |
CDPBaseButton::KeyPad | CDPBasePadLauncher::KeyPad | A key pad with for numbers and letters. |
CDPBaseButton::PinPad | CDPBasePadLauncher::PinPad | A num pad for typing passwords. |
typedef CDPBaseButton::StylingMap
enum CDPBaseButton::StylingType
This enum type specifies a styling type:
Constant | Value | Description |
---|---|---|
CDPBaseButton::NoFile | 0 | No custom styling. |
CDPBaseButton::CSS | 1 | Style by css file. |
CDPBaseButton::SVG | 2 | Style by svg file. |
CDPBaseButton::Default | 3 | Style using default styling. |
CDPBaseButton::Images | 4 | Style using images. |
CDPBaseButton::ToggleLamp | 5 | Style with toggle lamp. |
CDPBaseButton::ToggleLampM | 6 | Style with medium size toggle lamp. |
CDPBaseButton::Radio | 7 | Style to look like a radio button. |
enum CDPBaseButton::SvgImageParsing
This enum type specifies what images to parse from svg:
Constant | Value | Description |
---|---|---|
CDPBaseButton::ParseImages | 1 | Parse all images. |
CDPBaseButton::ParseNormal | 2 | Parse the normal state image. |
CDPBaseButton::ParseChecked | 3 | Parse the checked state image. |
Property Documentation
cdpCheckedRouting : QString
This property holds the routing to a CDP object that is to control the checked state of the widget.
The routing is bi-directional, meaning that the button will both send and receive values by default. A button click will send value 1 on checked and 0 when unchecked. The same values will make the button toggle when changed remotely.
To send/receive a different value for the checked state, set checkableByEmitValue to true
and use valueToEmit to set the value that should control the checked state. Receiving any value other than valueToEmit will make it unchecked. Clicking the button will no longer send 0 when entering the unchecked state. This is to enable use in button groups where different buttons sets the same routed object to different values.
The property named checkable must be set to true to allow the checked state.
Note that it is also possible to have separate routings for sending and receiving by setting checkableByClick to false. The button will still get checked by the object routed in cdpCheckedRouting, but you will now have to configure the button to send a message or change a remote value using other properties. See the usage guides for more details and be aware that you need to use a more advanced button than the standard CDPBaseButton. Instead, use CDPBaseButtonPopDlg or similar.
Take a look at the examples for complete usage guides.
Note: If the value is a setting in the control system that should be remembered after restart/reboot, the routed object should be a CDPParameter.
Access functions:
QString | cdpChecked() |
void | setCdpChecked(QString routing) |
See also valueToEmit, checkableByEmitValue, and checkableByClick.
cdpEnabledRouting : QString
This property holds the routing of the CDP object that is to enable/disable the button.
When the routed object is 0, the button will be disabled and will not react to user clicks. All values, starting at 1 and above will make the button enabled and ready for user interaction.
Access functions:
QString | cdpEnabled() |
void | setCdpEnabled(QString routing) |
cdpPressedRouting : QString
This property holds the routing to a CDP object that should be set to 1 while the button is pressed.
The pressed routing makes the button behave like a hardware or I/O button as explained here. The control system needs to detect the user click in the component that owns the input signal or by using an edge triggered operator on the input.
Access functions:
QString | cdpPressed() |
void | setCdpPressed(QString routing) |
cdpStyleRouting : QString
This property holds the routing of the CDP object that is to change the widget SVG style.
Most buttons do not have styles. The style must be provided to the button in the SVG file as described in the style section above. Different styles could show as a different color or button shape. Try adjusting widgetStyle to see what is in the SVG.
Access functions:
QString | cdpStyle() |
void | setCdpStyle(QString routing) |
cdpVisibleRouting : const QString
This property holds the full path of the CDP object that is to control the visible state of the button.
Note: Values not equal to 1 are considered false.
See also visible.
checkableByClick : bool
This property holds whether to make it possible to check a button by click.
Note that the button can only get checked when the property named checkable is set true.
Access functions:
bool | checkableByClick() const |
void | setCheckableByClick(bool checkable) |
checkableByEmitValue : bool
This property holds or enables the button to get checked/unchecked when received value matches emit value.
When this property is set, the button will get checked only when the value received from cdpChecked is identical to valueToEmit, otherwise the button will get unchecked. Note that the button can only get checked when the property named checkable is set true. Also note that the autoExclusive property must be set to false if we want to enable that none of the buttons in a group have to be checked (often used in combination with checkableByClick set to false).
Access functions:
bool | checkableByEmitValue() const |
void | setCheckableByEmitValue(bool checkable) |
cssFile : QString
This property holds the css file to style the widget when styling type is set to css.
Access functions:
QString | cssFile() const |
void | setCssFile(QString css, bool bUpdateTheme = true) |
See also stylingType.
disabledStateOpacity : double
This property holds the level of opacity for the widget in the disabled state.
The valid range of opacity is from 1.0 (completely opaque) to 0.0 (completely transparent).
Setting this property configures a fixed opacity that can be different than the global opacity used in other widgets.
Access functions:
virtual double | disabledStateOpacity() const |
virtual void | setDisabledStateOpacity(double opacity) |
imageChecked : QString
This property holds the path of an image to show when checked.
Note: the image is overridden by the svg if enabled to do so in svgParsing (and with svg enabled in svgType).
Access functions:
QString | imageChecked() const |
void | setImageChecked(QString pixPath) |
imageNormal : QString
This property holds the path of an image to show when normal.
Note: the image is overridden by the svg if enabled to do so in svgParsing (and with svg enabled in svgType)
Access functions:
QString | imageNormal() const |
void | setImageNormal(QString pixPath) |
lockAspectRatio : bool
This property holds whether to keep the aspect ratio of the parsed image.
Note: scaledContent need to be set for this to have any effect.
Access functions:
bool | lockAspectRatio() const |
void | setLockAspectRatio(bool enable) |
lockWidgetStyle : bool
This property holds whether the widget style can be changed or not.
Access functions:
virtual bool | lockWidgetStyle() |
virtual void | setLockWidgetStyle(bool enable) |
See also widgetStyle.
opaquePaintEvent : bool
This property holds whether the widget is transparent.
Set true
to optimize painting when having no transparency in widget graphics This property should be set true
on all widgets that does not require transparency. It will prevent Qt from painting widgets behind current widget and thus increase performance.
Access functions:
virtual bool | opaquePaintEvent() |
virtual void | setOpaquePaintEvent(bool enable) |
padInfoText1 : const QString
This property holds the first info text on the pad.
The property requires that the class set in CDPBaseMainWindow::numPadName implements the info text element. See the details of CDPBaseNumPad for more information.
See also padInfoText2.
padInfoText2 : const QString
This property holds the second info text on the pad.
The property requires that the class set in CDPBaseMainWindow::numPadName implements the info text element. See the details of CDPBaseNumPad for more information.
See also padInfoText1.
padTitle : const QString
This property holds the title name of the pad.
padType : GlobalDialog
This property holds pad type to get launched by the button.
When set to something other than none, the button will open a dialog of type NumPad, KeyPad or PinPad. The latter is normally used in the CDPBaseButtonPopDlg and not in the standard button as we also need to provide a pin code for this to be useful.
Access functions:
virtual GlobalDialog | padType() |
virtual void | setPadType(GlobalDialog dialog) |
pushRoutables : const QStringList
Access functions:
virtual const QStringList & | pushRoutables() const |
Notifier signal:
void | pushRoutablesChanged(const QStringList &pushers) |
scaledContents : bool
This property holds whether to scale the parsed image with the widget.
Access functions:
bool | scaledContents() const |
void | setScaledContents(bool enable) |
stylingType : StylingType
This property holds the styling type to style the widget.
Access functions:
StylingType | buttonType() const |
void | setButtonType(StylingType type) |
See also svgFile.
svgBorderPixmap : bool
This property holds whether to Enable or disable border pixmap provided by the svg file.
The border pixmap makes the button maintain its corners and border sizes while being resized.
Access functions:
bool | svgBorderPixmap() const |
void | setSvgBorderPixmap(bool borderPixmap) |
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 that resources can be overridden by files on disk with identical names. In this widget, the svgFile property can only be edited when the svgType property is set to Custom.
Access functions:
QString | svgFile() const |
void | setSvgFile(const QString &svg) |
svgFileChecked : QString
This property holds the path to the svg file that styles the widget in checked state.
Access functions:
QString | svgFileChecked() const |
void | setSvgFileChecked(const QString &svg) |
svgParsing : SvgImageParsing
This property holds svg parsing decisions regarding where and when to use images.
The svgParsing property decides where/when to use the image parsed from svg. When svgType is set to NoSvg this property is ignored and the widget will use the images provided in imageNormal or imageChecked. When svg is enabled and svgParsing is set to ParseImages, the widget will use the svg images. Setting the property to ParseNormal will use the svg when button is normal and show the image provided in imageChecked when checked.
Access functions:
SvgImageParsing | svgImageParsing() const |
void | setSvgImageParsing(SvgImageParsing image) |
textColor : QColor
This property holds the text color in the normal button state.
Setting this property will override the default theme text color if the styling type is set to SVG. Other styling types will ignore the textColor property completely.
The property will not override colors in other button states, like disabled or checked, if such styling is provided by the SVG.
Access functions:
QColor | textColor() |
void | setTextColor(QColor color) |
toggleOnPressed : bool
This property holds whether the button should get checked when pressing the button down or when it is released.
Making the button checked on release makes it possible for the user to change his/her mind after clicking the button by moving the mouse outside the button before releasing.
Access functions:
bool | toggleOnPressed() const |
void | setToggleOnPressed(bool toggle) |
valueToEmit : int
This property holds the value that will get emitted in clicked(int) and checked(int) and is also used in various other properties like checkableByEmitValue.
Access functions:
virtual int | valueToEmit() |
virtual void | setValueToEmit(int value) |
visible : const bool
This property holds whether or not the widget is visible.
widgetPicture : int
This property holds switch between pictures in the selected style if provided in svg. If set a number of that don't exist in svg, picture 0 is shown.
Access functions:
int | widgetPicture() |
virtual void | setWidgetPicture(int pic) |
widgetStyle : int
This property holds the widget style to use in the svg file (will only have effect if the svg file provides styles).
Access functions:
int | widgetStyle() |
virtual void | forceWidgetStyle(int style) |
virtual void | forceWidgetStyle(double style) |
See also lockWidgetStyle.
Member Function Documentation
CDPBaseButton::CDPBaseButton(QWidget *parent = NULL)
Default constructs an instance of CDPBaseButton.
[virtual]
CDPBaseButton::~CDPBaseButton()
Destroys the instance of CDPBaseButton. The destructor is virtual.
[virtual protected slot]
void CDPBaseButton::acceptedValue(double value = 0)
[virtual protected slot]
void CDPBaseButton::acceptedValue(QString value)
bool CDPBaseButton::cdpEnabledRoutedValue() const
[protected]
void CDPBaseButton::changeEvent(QEvent *e)
[virtual protected slot]
void CDPBaseButton::checkEnable(double value)
[signal]
void CDPBaseButton::checked(int value)
[signal]
void CDPBaseButton::clicked(int value)
[virtual protected slot]
void CDPBaseButton::emitValueChecked(bool dummy = true)
[virtual protected slot]
void CDPBaseButton::emitValueClicked()
[signal]
void CDPBaseButton::enabled(bool enabled)
[protected]
const QIcon &CDPBaseButton::getCurrentImage(QMargins &margins)
[virtual slot]
void CDPBaseButton::handleVisible(double visible)
[virtual slot]
void CDPBaseButton::hideWidget()
[protected slot]
void CDPBaseButton::initDeprecated()
bool CDPBaseButton::isImageCheckedAvailable() const
bool CDPBaseButton::isImageNormalAvailable() const
bool CDPBaseButton::isScaleAvailable() const
bool CDPBaseButton::isSvgType() const
bool CDPBaseButton::isTypeCss() const
bool CDPBaseButton::isTypeSvg() const
[virtual protected]
void CDPBaseButton::loadSvg(bool checked)
[virtual protected]
QPixmap CDPBaseButton::loadSvgPixmap(ButtonSVG::StyleMap &map, QSvgRenderer *pRender, ButtonSVG::StyleMap &mapBg)
[protected]
QSize CDPBaseButton::minimumSizeHint() const
[protected]
void CDPBaseButton::mousePressEvent(QMouseEvent *e)
[protected]
void CDPBaseButton::mouseReleaseEvent(QMouseEvent *e)
[protected]
void CDPBaseButton::nextCheckState()
[protected]
void CDPBaseButton::paintEvent(QPaintEvent *ev)
[virtual protected]
QSize CDPBaseButton::pixmapTargetSize(const QSize &pixSize, QMargins *margins = 0) const
[virtual protected]
QPoint CDPBaseButton::rectPos(const QRect &rect)
[protected]
void CDPBaseButton::resizeEvent(QResizeEvent *ev)
[virtual slot]
void CDPBaseButton::selectImageChecked(int checked)
[virtual slot]
void CDPBaseButton::selectImageChecked(bool bSet = true)
[virtual slot]
void CDPBaseButton::selectImageNormal(bool bSet = true)
[virtual slot]
void CDPBaseButton::setButtonText(const QString &text)
Slot that sets the button text.
[virtual protected slot]
void CDPBaseButton::setCheckedByValue(double value)
[virtual]
void CDPBaseButton::setIQtCDPPointer(IQtCDP *pIQtCDP)
[virtual slot]
void CDPBaseButton::setInCommand(bool cmd)
[virtual slot]
void CDPBaseButton::setSmoothPixmap(bool smooth)
void CDPBaseButton::setSvgDebugEnabled(bool enabled)
void CDPBaseButton::setSvgFileOrImageBasedOnFormat(QString svg, bool bUpdateTheme = true)
See also svgFileOrImageBasedOnFormat().
[virtual slot]
void CDPBaseButton::setWidgetFont(const QString &font)
[virtual slot]
void CDPBaseButton::setWidgetStyle(int style)
See also widgetStyle().
[virtual slot]
void CDPBaseButton::setWidgetTheme(const QString &theme)
[virtual slot]
void CDPBaseButton::showWidget()
[signal]
void CDPBaseButton::signalAcceptedValue(int)
Note: Signal signalAcceptedValue is overloaded in this class. To connect to this one using the function pointer syntax, you must specify the signal type in a static cast, as shown in this example:
connect(cDPBaseButton, static_cast<void(CDPBaseButton::*)(int)>(&CDPBaseButton::signalAcceptedValue), [=](int ){ /* ... */ });
[signal]
void CDPBaseButton::signalAcceptedValue(double)
Note: Signal signalAcceptedValue is overloaded in this class. To connect to this one using the function pointer syntax, you must specify the signal type in a static cast, as shown in this example:
connect(cDPBaseButton, static_cast<void(CDPBaseButton::*)(double)>(&CDPBaseButton::signalAcceptedValue), [=](double ){ /* ... */ });
[signal]
void CDPBaseButton::signalAcceptedValue(QString)
Note: Signal signalAcceptedValue is overloaded in this class. To connect to this one using the function pointer syntax, you must specify the signal type in a static cast, as shown in this example:
connect(cDPBaseButton, static_cast<void(CDPBaseButton::*)(QString)>(&CDPBaseButton::signalAcceptedValue), [=](QString ){ /* ... */ });
QSize CDPBaseButton::sizeHint() const
QString CDPBaseButton::svgFileOrImageBasedOnFormat() const
See also setSvgFileOrImageBasedOnFormat().
QColor CDPBaseButton::textColorForCurrentState() const
[virtual protected slot]
void CDPBaseButton::updateCheckedFromCdp()
[protected]
void CDPBaseButton::updateImage(QIcon::State state, const QIcon &icon, QIcon &iconToUpdate)
[virtual protected slot]
void CDPBaseButton::updateTextColorFromSvg(bool dummy = true)
Get started with CDP Studio today
Let us help you take your great ideas and turn them into the products your customer will love.