• 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
  • Product
    • Design UI
    • Develop
    • Analyze and test
    • Deploy
    • Framework and toolbox
    • Compatibility
  • Services
  • Use cases
  • Pricing
  • Try CDP

CDP Studio Documentation

  • CDP Studio - Design Mode Manual
  • Dialogs

Connecting Widgets to CDP Virtual Keyboards

Dialogs

Dialogs

The CDPBaseButtonPopDlg widget makes it possible to open separate UI files when the button is pushed. Enter the name of the UI file in the property named, uiFileName. This will make the UI file load dynamically when the button is clicked. The UI file must be placed within the Application directory (the directory that also contains mainwidget.ui) or added to the application as a resource. The latter is required to ensure that studio can locate the UI independently of the working directory.

Create UI Files

Create UI files using File > New File... and select Qt > Qt Designer Form. In the next dialog, Choose a Form Template, and select CDPBaseDialog under Custom Widgets. Click Next and add name and location in the following dialog. The defaults should be fine in the remaining steps.

The following can be added as a dialog style sheet if you do not want to show the content background while editing the dialog form:

QWidget > QWidget { background: transparent; }

Select Different Dialogs in Design Mode

The mainwidget.ui file will get selected every time you enter Design mode even though work was being done on a different form. Switch between project forms by clicking on the form selector button in the top left corner of the page. Forms that have been opened from the file menu are selected by clicking on the file selector to the right of the form selector button. It will always show the name of the form that is currently showing.

Create a Resource File and Add a Dialog

Go into Code mode and right-click the GUI application where we want to add the resource file. Select Add New... and Qt > Qt Resource File. Give it a proper name and select the defaults in the following dialogs. This creates and adds a resource file to the application.

Add an existing UI file to the resource file. First, locate the resource file within the application tree, right-click and select Open in Editor. In the editor, click Add > Add Prefix and edit the prefix to /. Click add one more time, but this time we'll select Add Files. Select the UI file. Afterward, it could be useful to select it and add an Alias to avoid long names in the uiFileName property.

Settings Dialogs

A Settings Dialog will often allow the user to configure different settings and then decide whether to reset or save the changes. To achieve this, we will have to configure all input widgets, like spin boxes, line edits, and combo boxes to not immediately send their values to the control system when changed. In most input widgets, this is done by setting the property named updateOnSlotOnly. When this property is true, the widget will only send new values to the control system when its sendToCdp slot is triggered. The input widgets have a similar slot for resetting their value to be identical to the remote value, resetToCdp.

Instead of connecting the save and reset buttons to all input widgets in the settings dialog, we can place the widgets in a Container widget. The Container has slots similar to reset and save in the input widgets and will execute on all children when triggered.

Connecting Widgets to CDP Virtual Keyboards

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 2024 CDP Technologies. Privacy and cookie policy.

Return to top