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

CDPBaseMainWindow Class

The Main Window inherits the standard QMainWindow of Qt and implements features like selecting day and night themes, full screen shortcut keys and shows the base widget library version. In short, this is the class to visit to enable global/externally controlled features. More...

Header: #include <CDPBaseMainWindow>
  • List of all members, including inherited members

Public Types

typedef StylingMap
enum StylingType { NoFile, CSS, Default }

Properties

  • certificateVerificationEnabled : bool
  • cssFile : QString
  • dialogFontSize : int
  • disabledStateOpacity : double
  • fullScreen : bool
  • fullScreenKey : QString
  • idleLockoutEnabled : bool
  • keyPadLayout : QString
  • keyPadName : QString
  • keyPadSize : QSize
  • loginDialog : QString
  • loginEnabled : bool
  • loginRole : QString
  • msgBoxBgSvg : QString
  • msgBoxBtnSvg : QString
  • msgBoxStyle : int
  • numPadName : QString
  • numPadSize : QSize
  • pixBackground : QString
  • pixBgLock : bool
  • soundFile1 : QString
  • soundFile2 : QString
  • soundRepeat : bool
  • soundRouting : QString
  • storeBottomMargin : bool
  • stylingType : StylingType
  • systemUseNotificationEnabled : bool
  • themeDay : QString
  • themeDayActive : bool
  • themeNight : QString
  • themeRootDir : QString
  • themeRouting : QString
  • timeDialogSize : QSize
  • timeOffsetRouting : QString

Public Functions

CDPBaseMainWindow(QWidget *parent = 0)
virtual ~CDPBaseMainWindow()
virtual QStringList availableThemes() const
virtual QPoint centerPos(QSize dialogSize = QSize( 0, 0 ))
virtual QString cssFile()
virtual bool cssStyling()
virtual QString currentTheme() const
virtual bool defaultStyling()
int dialogFontSize() const
virtual void forceBackgroundPix(QString backPix)
virtual bool fullScreen()
virtual QString fullScreenKey()
virtual StylingType getStylingType()
bool isCertificateVerificationEnabled() const
bool isIdleLockoutEnabled() const
bool isLoggedIn() const
bool isLoginEnabled() const
bool isSystemUseNotificationEnabled() const
virtual bool isThemeDay()
bool isUiLoaderFinished() const
virtual QString keyPad()
virtual QString keyPadLayout()
QSize keyPadSize() const
QString loginDialog() const
QString loginRole() const
virtual QString msgBoxBgSvg()
virtual QString msgBoxBtnSvg()
int msgBoxStyle()
virtual QString numPad()
QSize numPadSize() const
virtual QString pixBackground()
virtual bool pixBgLock()
virtual void setBackgroundPix(QString backPix, bool force = false, bool updateCss = true)
void setCertificateVerificationEnabled(bool enabled)
virtual void setCssFile(QString cssFile, bool updateCss = true)
void setDialogFontSize(int size)
virtual void setDisabledStateOpacity(double opacity)
virtual void setFullScreen(bool enable)
virtual void setFullScreenKey(QString version)
virtual void setIQtCDPPointer(IQtCDP *pIQtCDP)
void setIdleLockoutEnabled(bool enabled)
virtual void setKeyPad(QString name)
virtual void setKeyPadLayout(const QString &keys)
void setKeyPadSize(QSize size)
void setLoginDialog(const QString &path)
void setLoginEnabled(bool enabled)
void setLoginRole(const QString &role)
virtual void setMsgBoxBgSvg(QString svg, bool updateCss = true)
virtual void setMsgBoxBtnSvg(QString svg, bool updateCss = true)
virtual void setNumPad(QString name)
void setNumPadSize(QSize size)
virtual void setPixBgLock(bool lock)
virtual void setSoundFile1(QString name)
virtual void setSoundFile2(QString name)
virtual void setSoundRepeat(bool repeat)
virtual void setSoundRouting(QString routing)
void setStoreBottomMargin(bool enabled)
virtual void setStylingType(StylingType type)
void setSystemUseNotificationEnabled(bool enabled)
virtual void setThemeRootDir(const QString &path)
virtual void setThemeRouting(const QString &routing)
void setTimeDialogSize(QSize size)
virtual void setTimeOffsetRouting(QString routing)
virtual QString soundFile1()
virtual QString soundFile2()
virtual bool soundRepeat()
virtual QString soundRouting()
bool storeBottomMargin() const
virtual QString themeDay()
virtual QString themeNight()
virtual const QString &themeRootDir() const
virtual QString themeRouting()
QSize timeDialogSize() const
virtual QString timeOffsetRouting()

Public Slots

void enableNightMode(bool enabled)
void loadGlobalTimeOffsetDialog(bool cdpTime = false)
void loadGlobalTimeOffsetDialogShowingCdpClock()
void loadGlobalTimeOffsetDialogShowingSystemClock()
void logout()
void playSound(double number)
void playSound(int number = 1)
virtual void selectTheme()
void setBottomMargin(int margin)
void setDayTheme(bool enable = true)
void setGlobalFont(const QString &font)
void setGlobalInCommand(bool enable = true)
void setGlobalSmoothPixmap(bool smooth = true)
void setGlobalStyle(int style)
void setGlobalStyle(double style)
void setGlobalTimeOffsetHours(double hours)
void setGlobalTimeOffsetSecs(double seconds)
void setGlobalTimeOffsetSecs(int seconds)
virtual void setMsgBoxStyle(int style)
void setNightTheme(bool enable = true)
virtual void setThemeDay(const QString &name)
virtual void setThemeNight(const QString &name)
virtual void setTimeOffsetSecs(double timeOffsetSec)
virtual void setTranslation(const QString &translation)
void setWidgetTheme(const QString &name) override
void toggleFullScreen()
void updatePadSizes()

Signals

void aboutToClose()
void bottomMarginChanged(int)
void loggedIn(const QString &username)
void loggedIn()
void loggedOut()
void sizeChanged(int width, int height)
void themeDialogChangeAccepted()
void uiLoaderFinished()

Static Public Members

double disabledStateOpacity()
void initDynamicProperties(QObject *object)
CDPBaseMainWindow *mainWindow(QWidget *child = 0)
void registerInitDynamicProperties(QObject *object)
void registerOfflineInterfaceIfPresent(QObject *object)

Protected Functions

QString addUrl(QString path)
virtual void closeEvent(QCloseEvent *event)
QWidget *createSplashScreen(QWidget *parent) const
bool eventFilter(QObject *obj, QEvent *event)
virtual void hideWidget()
void initCertificateVerificationDialog()
void initLoginDialog()
virtual void loadSvg()
QString messageBoxButtonAndLabelCss()
QString messageBoxCss()
virtual void resizeEvent(QResizeEvent *event)
void sendCredentials(const QString &username, const QString &password, bool withNewPassword, const QString &newPassword = QString())
virtual void setInCommand(bool)
virtual void setSmoothPixmap(bool)
virtual void setWidgetFont(const QString &)
virtual void setWidgetStyle(int)
void showCertificateVerificationDialog(const QString &applicationName, const QString &certificate)
virtual void showWidget()
virtual void updateStyleSheet()
void updateWidgetFontSize(QWidget *widget, int fontSize)
void updateWidgetSizeAndFont(QWidget *widget, const QSize size)

Protected Slots

void cancelLogin()
void handleCertificateAcceptanceRequest(const QString &applicationName, const QString &certificate)
void hideLoginDialog()
void hideSplashScreen()
void setErrorMessage(const QString &message)
void setLoginButtonDisabled()
void setLoginButtonEnabled()
void showLoginDialog(const QString &applicationName = QString(), bool withNewPassword = false, const IQtCDPSecurity::PasswordCriteria &criteria = IQtCDPSecurity::PasswordCriteria())
void showSplashScreen()
void startLogoutTimer()

Detailed Description

The Main Window inherits the standard QMainWindow of Qt and implements features like selecting day and night themes, full screen shortcut keys and shows the base widget library version. In short, this is the class to visit to enable global/externally controlled features.

In design mode, the themes can be configured either by editing the themeNight or themeDay properties, or by clicking "Select theme..." from the CDPBaseMainWindow context menu. The context menu shows when right-clicking CDPBaseMainWindow in the form or in the object inspector.

The CDPBaseMainWindow supports playing .wav sound files. This feature is often used to control alarm sounds for critical events. Sound files are selected in the properties named soundFile1 and soundFile2. Add signal routing in the property named soundRouting to play/pause the different sounds. Use the property named soundRepeat to loop the playback of the sound file.

Selecting a different language file for all display texts can be done using the slot function named setTranslation. The language files are created as described in the slot description and in the studio design mode manual.

Changing the default startup language is usually done in code to avoid the overhead of language switching in runtime. Add the translation to the application main function just after initialization of QApplication:

#include <QTranslator>

QTranslator translator;
if (translator.load(QLatin1String("norwegian"), QApplication::applicationDirPath()))
    app.installTranslator(&translator);

The translatable texts in QML might require adding cdpTr.emptyString in addition to wrapping in qsTr(). See QuickWidget for an example.

Note: The class includes special slots for switching between themes and slots for toggling full screen on and off.

Users that create custom themes or add custom graphics should be aware of the property named themeRootDir. Files that are added as resources are sometimes not found while in design mode. Using this property will ensure that the SVG files are found though they are not loaded in the resource system. Set it to the dir where the files are located. Avoid alias in file names if you also wish the files to be found also when themeRootDir does not exist on the target system.

It is possible to require a user to log in by setting the loginEnabled property together with the loginRole property. Doing this will restrict access to the GUI, as documented in the Security Manual.

Member Type Documentation

typedef CDPBaseMainWindow::StylingMap

enum CDPBaseMainWindow::StylingType

This enum type specifies a styling type:

ConstantValueDescription
CDPBaseMainWindow::NoFile0Styling properties like cssFile, pixBackground and msgBox svg properties will be ignored.
CDPBaseMainWindow::CSS1Enables all styling properties and the cssFile property.
CDPBaseMainWindow::Default2Enables all styling properties and the cssFile property.

Property Documentation

certificateVerificationEnabled : bool

This property holds a flag that asks users to accept unknown SSL certificates when connecting to remote servers. Note that this setting becomes effective only when authentication is set required in the system security settings.

Access functions:

bool isCertificateVerificationEnabled() const
void setCertificateVerificationEnabled(bool enabled)

cssFile : QString

This property holds the path to the css file that should style the widget.

Note: The property is only enabled when the stylingType property is set to css.

Access functions:

virtual QString cssFile()
virtual void setCssFile(QString cssFile, bool updateCss = true)

See also stylingType.

dialogFontSize : int

This property holds the base font size of the global dialogs like num and key pads.

Access functions:

int dialogFontSize() const
void setDialogFontSize(int size)

disabledStateOpacity : double

This property holds the level of opacity to be used by input widget children when they are disabled.

The valid range of opacity is from 1.0 (completely opaque) to 0.0 (completely transparent).

The different input widgets, like combo boxes and spin boxes, can override the opacity using widget properties.

Access functions:

double disabledStateOpacity()
virtual void setDisabledStateOpacity(double opacity)

fullScreen : bool

This property holds whether or not to start the application in fullscren.

Access functions:

virtual bool fullScreen()
virtual void setFullScreen(bool enable)

See also fullScreenKey.

fullScreenKey : QString

This property holds the key combination to toggle fullscreen on and off (e.g. Ctrl+F).

Access functions:

virtual QString fullScreenKey()
virtual void setFullScreenKey(QString version)

See also fullScreen.

idleLockoutEnabled : bool

This property holds a flag that forces the GUI sessions to lock out. Idle lockout time can be specified in system security settings.

Access functions:

bool isIdleLockoutEnabled() const
void setIdleLockoutEnabled(bool enabled)

keyPadLayout : QString

This property holds the keyboard layout of the global key pad (norwegian qwerty when not set).

The layout string must contain exactly 29 characters describing the alphabetic keys of the keyboard. This include 3 keys that is required by languages like Norwegian and German.

Use spaces in the layout string to hide keys that are not needed. For instance, this is what the string will look like for an UK keyboard: "qwertyuiop asdfghjkl zxcvbnm".

Access functions:

virtual QString keyPadLayout()
virtual void setKeyPadLayout(const QString &keys)

See also keyPadName.

keyPadName : QString

This property holds the name of the class to be used as global key pad.

Access functions:

virtual QString keyPad()
virtual void setKeyPad(QString name)

keyPadSize : QSize

Access functions:

QSize keyPadSize() const
void setKeyPadSize(QSize size)

loginDialog : QString

This property holds a path to login dialog (*.ui) designer file. Read more from qthelp://designer/designer/design-mode-manual.html#securityDesign Mode Manual.

Access functions:

QString loginDialog() const
void setLoginDialog(const QString &path)

loginEnabled : bool

This property holds a flag that forces users to log in to the GUI. Note that this setting becomes effective only when authentication is set required in the system security settings and loginRole property is set. Disabling loginEnabled in WebAssembly is not supported, causing value propagation not to work.

Access functions:

bool isLoginEnabled() const
void setLoginEnabled(bool enabled)

loginRole : QString

This property holds a role that must be assigned to the users that should be able to log in via the GUI. Empty role means all users can log in.

Access functions:

QString loginRole() const
void setLoginRole(const QString &role)

msgBoxBgSvg : QString

This property holds the default svg file to set as background in message boxes.

Note: that the property will generate images and stylesheet, and that it styles the standard message box background (should thus not include transparency). Further, it requires a svg based on the CDPBaseContainer structure.

Access functions:

virtual QString msgBoxBgSvg()
virtual void setMsgBoxBgSvg(QString svg, bool updateCss = true)

msgBoxBtnSvg : QString

This property holds the default svg file to use for buttons in message boxes.

Access functions:

virtual QString msgBoxBtnSvg()
virtual void setMsgBoxBtnSvg(QString svg, bool updateCss = true)

msgBoxStyle : int

This property holds the current widget style number to use when rendering the svg.

Access functions:

int msgBoxStyle()
virtual void setMsgBoxStyle(int style)

numPadName : QString

This property holds the name of the class to be used as global num pad.

Access functions:

virtual QString numPad()
virtual void setNumPad(QString name)

numPadSize : QSize

Access functions:

QSize numPadSize() const
void setNumPadSize(QSize size)

pixBackground : QString

This property holds the path to the background pixmap.

Access functions:

virtual QString pixBackground()
virtual void forceBackgroundPix(QString backPix)

See also pixBgLock.

pixBgLock : bool

This property holds whether to lock the current background picture.

Access functions:

virtual bool pixBgLock()
virtual void setPixBgLock(bool lock)

soundFile1 : QString

This property holds the complete path to the .wav sound file.

Access functions:

virtual QString soundFile1()
virtual void setSoundFile1(QString name)

See also soundFile2, soundRepeat, and soundRouting.

soundFile2 : QString

This property holds the complete path to .wav sound file.

Access functions:

virtual QString soundFile2()
virtual void setSoundFile2(QString name)

See also soundFile1, soundRepeat, and soundRouting.

soundRepeat : bool

This property holds whether to loop the playback of the sound file.

Access functions:

virtual bool soundRepeat()
virtual void setSoundRepeat(bool repeat)

See also soundFile1, soundFile2, and soundRouting.

soundRouting : QString

This property holds the routing to the signal that is to start and stop the sound.

  • 0 = stop sound
  • 1 = play file one
  • 2 = play file two

Access functions:

virtual QString soundRouting()
virtual void setSoundRouting(QString routing)

See also soundFile1, soundFile2, and soundRepeat.

storeBottomMargin : bool

Setting the storeBottomMargin to true will save and load the margin from settings as long as it is set using the slot named setBottomMargin. The bottomMarginChanged signal will get emitted on startup and whenever the value is changed.

The initial value of the bottom margin is located in the centralwidget. This is a child inside the main window widget and thus you will not see the property, layoutBottomMargin, in the main window property list. Select the centralwidget to configure the property.

Note: The window object name is used when doing the save. Keep it unique to avoid sharing with other applications.

Access functions:

bool storeBottomMargin() const
void setStoreBottomMargin(bool enabled)

See also setStoreBottomMargin and setBottomMargin.

stylingType : StylingType

This property holds the styling method of the widget.

Access functions:

virtual StylingType getStylingType()
virtual void setStylingType(StylingType type)

systemUseNotificationEnabled : bool

This property holds a flag that sets System Use Notification to be shown on GUI login screen. System Use Notification can be specified in system security settings.

Access functions:

bool isSystemUseNotificationEnabled() const
void setSystemUseNotificationEnabled(bool enabled)

themeDay : QString

This property holds the name of the theme to use during day.

This property can be edited using the theme selector dialog. The dialog is launched by right-clicking the main widget and pressing "Select theme..." from the context menu.

Access functions:

virtual QString themeDay()
virtual void setThemeDay(const QString &name)

See also themeNight and themeDayActive.

themeDayActive : bool

This property holds whether to use the night or day theme.

Access functions:

virtual bool isThemeDay()
void setDayTheme(bool enable = true)

See also themeNight and themeDay.

themeNight : QString

This property holds the name of the theme to use during night.

This property can be edited using the theme selector dialog. The dialog is launched by right-clicking the main widget and pressing "Select theme..." from the context menu.

Access functions:

virtual QString themeNight()
virtual void setThemeNight(const QString &name)

See also themeDay and themeDayActive.

themeRootDir : QString

This property holds an optional path for locating theme files.

The property has several use cases. Its main purpose is to enable sharing a theme directory between multiple applications on the same device. Working on the GUI in CDP Studio Design mode requires that the path is valid both locally and on the target device. If it is only valid on the target device, we need to also place the custom themes directory in the CDP Studio working directory (the directory containing the CDP Studio executable). Note that the directory must be manually deployed to the target device.

A different use case is to ensure that CDP Studio Design mode is able to show custom graphics added as resources or placed at a non-standard location.

The property is set to the project Application directory by default. This is the directory that also contains mainwidget.ui and other files that will get deployed to the target along with the executable. Adding custom graphics at this location will make the images show both in CDP Studio Design mode and in the running application.

The following explains how the property works when running an application. A button is configured with svgFile set to themes/my_theme/buttons/btn.png. When the GUI is loaded, it will first look for btn.png at that path in the working directory. If not found, it will search for the path among the compiled resources. Finally, if still not found, themeRootDir is added to the beginning of the path. E.g. if themeRootDir is set to C:/customfiles, the full path of the above example will be resolved to C:/customfiles/themes/my_theme/buttons/btn.png.

The above example is valid also for CDP Studio Design mode, but there the working directory is the directory where CDP Studio was executed.

Access functions:

virtual const QString &themeRootDir() const
virtual void setThemeRootDir(const QString &path)

themeRouting : QString

This property holds the routing to the cdp object responsible for switching between day and night themes.

  • 0 = themeDay
  • 1 = themeNight

Access functions:

virtual QString themeRouting()
virtual void setThemeRouting(const QString &routing)

See also themeDay, themeNight, and themeDayActive.

timeDialogSize : QSize

Access functions:

QSize timeDialogSize() const
void setTimeDialogSize(QSize size)

timeOffsetRouting : QString

This property holds the routing to the cdp object that are to control time offset.

Note: When this property is set, we can no longer call the local time offset, used by widgets like the CDPBaseClock and CDPBaseClockDigi, a local offset as it can also be changed externally. Changes done using the global time offset dialog will the routed object.

Note: The offset is provided in seconds.

Access functions:

virtual QString timeOffsetRouting()
virtual void setTimeOffsetRouting(QString routing)

Member Function Documentation

CDPBaseMainWindow::CDPBaseMainWindow(QWidget *parent = 0)

Default constructs an instance of CDPBaseMainWindow.

[virtual] CDPBaseMainWindow::~CDPBaseMainWindow()

Destroys the instance of CDPBaseMainWindow. The destructor is virtual.

[signal] void CDPBaseMainWindow::aboutToClose()

[protected] QString CDPBaseMainWindow::addUrl(QString path)

[virtual] QStringList CDPBaseMainWindow::availableThemes() const

[signal] void CDPBaseMainWindow::bottomMarginChanged(int)

[protected slot] void CDPBaseMainWindow::cancelLogin()

[virtual] QPoint CDPBaseMainWindow::centerPos(QSize dialogSize = QSize( 0, 0 ))

[virtual protected] void CDPBaseMainWindow::closeEvent(QCloseEvent *event)

[protected] QWidget *CDPBaseMainWindow::createSplashScreen(QWidget *parent) const

[virtual] bool CDPBaseMainWindow::cssStyling()

[virtual] QString CDPBaseMainWindow::currentTheme() const

[virtual] bool CDPBaseMainWindow::defaultStyling()

[slot] void CDPBaseMainWindow::enableNightMode(bool enabled)

[protected] bool CDPBaseMainWindow::eventFilter(QObject *obj, QEvent *event)

[protected slot] void CDPBaseMainWindow::handleCertificateAcceptanceRequest(const QString &applicationName, const QString &certificate)

[protected slot] void CDPBaseMainWindow::hideLoginDialog()

[protected slot] void CDPBaseMainWindow::hideSplashScreen()

[virtual protected] void CDPBaseMainWindow::hideWidget()

[protected] void CDPBaseMainWindow::initCertificateVerificationDialog()

[static] void CDPBaseMainWindow::initDynamicProperties(QObject *object)

Running this function on an object allows binding any of its existing properties to CDP using dynamic string-based properties. The dynamic property name must match the property name that you want to control. In addition, you need to end the property name with Routing. The value of the property is a routing string similar to other widget routing properties.

The function must be executed on the object after all properties have been set on the widget. Hence, executing the function in a widget constructor does not make sense as dynamic properties are not yet loaded from the ui file. To ensure that the properties are done loading, use registerInitDynamicProperties instead of executing this function directly.

[protected] void CDPBaseMainWindow::initLoginDialog()

bool CDPBaseMainWindow::isLoggedIn() const

bool CDPBaseMainWindow::isUiLoaderFinished() const

[slot] void CDPBaseMainWindow::loadGlobalTimeOffsetDialog(bool cdpTime = false)

[slot] void CDPBaseMainWindow::loadGlobalTimeOffsetDialogShowingCdpClock()

[slot] void CDPBaseMainWindow::loadGlobalTimeOffsetDialogShowingSystemClock()

[virtual protected] void CDPBaseMainWindow::loadSvg()

[signal] void CDPBaseMainWindow::loggedIn(const QString &username)

Note: Signal loggedIn 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(cDPBaseMainWindow, static_cast<void(CDPBaseMainWindow::*)(const QString &)>(&CDPBaseMainWindow::loggedIn),
    [=](const QString &username){ /* ... */ });

[signal] void CDPBaseMainWindow::loggedIn()

Note: Signal loggedIn 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(cDPBaseMainWindow, static_cast<void(CDPBaseMainWindow::*)()>(&CDPBaseMainWindow::loggedIn),
    [=](){ /* ... */ });

[signal] void CDPBaseMainWindow::loggedOut()

[slot] void CDPBaseMainWindow::logout()

[static] CDPBaseMainWindow *CDPBaseMainWindow::mainWindow(QWidget *child = 0)

[protected] QString CDPBaseMainWindow::messageBoxButtonAndLabelCss()

[protected] QString CDPBaseMainWindow::messageBoxCss()

[slot] void CDPBaseMainWindow::playSound(double number)

Play the sound set in soundFile1 or soundFile2 by setting number to 1 or 2. Set the number argument to 0 to stop the playback.

See also soundFile1, soundFile2, soundRepeat, and soundRouting.

[slot] void CDPBaseMainWindow::playSound(int number = 1)

Play the sound set in soundFile1 or soundFile2 by setting number to 1 or 2. Set the number argument to 0 to stop the playback.

See also soundFile1, soundFile2, soundRepeat, and soundRouting.

[static] void CDPBaseMainWindow::registerInitDynamicProperties(QObject *object)

This function will execute initDynamicProperties on an object when the main window reports that the ui loader has finished loading widgets and properties. If the main window is not available or uiLoaderFinished signal has already been emitted, a timeout will be used instead.

[static] void CDPBaseMainWindow::registerOfflineInterfaceIfPresent(QObject *object)

[virtual protected] void CDPBaseMainWindow::resizeEvent(QResizeEvent *event)

[virtual slot] void CDPBaseMainWindow::selectTheme()

Launch the select theme dialog to do run-time theme switching

See also themeNight and themeDay.

[protected] void CDPBaseMainWindow::sendCredentials(const QString &username, const QString &password, bool withNewPassword, const QString &newPassword = QString())

[virtual] void CDPBaseMainWindow::setBackgroundPix(QString backPix, bool force = false, bool updateCss = true)

[slot] void CDPBaseMainWindow::setBottomMargin(int margin)

Slot that will set the bottom margin of the window.

Setting the storeBottomMargin will save and load the margin from settings. The window object name is used when doing the save. Keep it unique to avoid sharing with other applications.

See also storeBottomMargin.

[protected slot] void CDPBaseMainWindow::setErrorMessage(const QString &message)

[slot] void CDPBaseMainWindow::setGlobalFont(const QString &font)

Set global font family for all CDP base widgets that implement this feature.

[slot] void CDPBaseMainWindow::setGlobalInCommand(bool enable = true)

Set global in-command by setting enable to true or false. This will disable/enable CDP base widgets that implement this feature.

Note: This feature is usually controlled from the control system.

[slot] void CDPBaseMainWindow::setGlobalSmoothPixmap(bool smooth = true)

Set global smooth pixmap transform to true or false. This will disable/enable smoothing after transformations in widgets that implements the feature.

Note: Disabling smooth pixmap transform might improve performance on systems with limited resources, but will also make transformed/rotated pixmaps look pixelated.

[slot] void CDPBaseMainWindow::setGlobalStyle(int style)

Set a global widget style number to be used by all CDP base widgets that implement this widget styling.

[slot] void CDPBaseMainWindow::setGlobalStyle(double style)

Set a global widget style number to be used by all CDP base widgets that implement this widget styling.

[slot] void CDPBaseMainWindow::setGlobalTimeOffsetHours(double hours)

[slot] void CDPBaseMainWindow::setGlobalTimeOffsetSecs(double seconds)

[slot] void CDPBaseMainWindow::setGlobalTimeOffsetSecs(int seconds)

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

[virtual protected] void CDPBaseMainWindow::setInCommand(bool)

[protected slot] void CDPBaseMainWindow::setLoginButtonDisabled()

[protected slot] void CDPBaseMainWindow::setLoginButtonEnabled()

[slot] void CDPBaseMainWindow::setNightTheme(bool enable = true)

[virtual protected] void CDPBaseMainWindow::setSmoothPixmap(bool)

void CDPBaseMainWindow::setStoreBottomMargin(bool enabled)

Setting enabled to true will save and load the bottom window margin as described in the storeBottomMargin property.

Note: Setter function for property storeBottomMargin.

See also storeBottomMargin.

[virtual slot] void CDPBaseMainWindow::setThemeDay(const QString &name)

Sets the theme name to show when toggling to day mode.

Note: Setter function for property themeDay.

See also themeDay().

[virtual slot] void CDPBaseMainWindow::setThemeNight(const QString &name)

Sets the theme name to show when toggling to night mode.

Note: Setter function for property themeNight.

See also themeNight().

[virtual slot] void CDPBaseMainWindow::setTimeOffsetSecs(double timeOffsetSec)

[virtual slot] void CDPBaseMainWindow::setTranslation(const QString &translation)

Sets a language translation file (*.qm) that will be used to translate strings in all application form (*.ui) files.

Use this slot along with a widget like the combo box. Add your translations to the combo by right clicking and select "Edit items...". Press "F4" to enter signal editing mode. Create a connection by pressing and dragging from the combo box and releasing the mouse somewhere on the main window. Then select the signal named currentIndexChanged(QString) and the setTranslation(QString) slot. Go back to normal design mode using "F3".

Users that rather want buttons to switch language can do this by adding and connecting the button clicked(int) signal to the combo box slot named setCurrentIndex(int). Configure the valueToEmit button property to select which translation in the combo to set. Afterwards, the combo can be made hidden setting visible to false.

The language/translation files can be created as explained in Language Support.

Note: Changing the default startup language is usually done in code as described in the detailed class description.

[virtual protected] void CDPBaseMainWindow::setWidgetFont(const QString &)

[virtual protected] void CDPBaseMainWindow::setWidgetStyle(int)

[slot] void CDPBaseMainWindow::setWidgetTheme(const QString &name)

Sets the current theme by name no matter which mode is active.

[protected] void CDPBaseMainWindow::showCertificateVerificationDialog(const QString &applicationName, const QString &certificate)

[protected slot] void CDPBaseMainWindow::showLoginDialog(const QString &applicationName = QString(), bool withNewPassword = false, const IQtCDPSecurity::PasswordCriteria &criteria = IQtCDPSecurity::PasswordCriteria())

[protected slot] void CDPBaseMainWindow::showSplashScreen()

[virtual protected] void CDPBaseMainWindow::showWidget()

[signal] void CDPBaseMainWindow::sizeChanged(int width, int height)

[protected slot] void CDPBaseMainWindow::startLogoutTimer()

[signal] void CDPBaseMainWindow::themeDialogChangeAccepted()

[slot] void CDPBaseMainWindow::toggleFullScreen()

[signal] void CDPBaseMainWindow::uiLoaderFinished()

[slot] void CDPBaseMainWindow::updatePadSizes()

Slot that updates the global num and key pad size.

[virtual protected] void CDPBaseMainWindow::updateStyleSheet()

[protected] void CDPBaseMainWindow::updateWidgetFontSize(QWidget *widget, int fontSize)

[protected] void CDPBaseMainWindow::updateWidgetSizeAndFont(QWidget *widget, const QSize size)

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