Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Struggling with QtDesigner and colocated controls



  • I have a windows dialog that I am trying to convert to a Qt using QtDesigner.

    The windows rc file has a number of controls that are co-located and initially invisible. They are only made visible as needed and are laid out in two rows and two columns.

    So it might look like:
    f2e225d1-7c02-4c63-a270-daa67cae464b-image.png

    or
    3b216e2c-4f0b-4159-8e50-5ead40f63aca-image.png

    The relevant portion of the .rc file looks like:

        CONTROL         "Dark Optimization",IDC_DARKOPTIMIZATION,"Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,7,133,72,10
        CONTROL         "Hot Pixels detection and removal",IDC_HOTPIXELS,"Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,7,119,127,10
        CONTROL         "Bad Columns detection and removal",IDC_BADCOLUMNREMOVAL,
                        "Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,140,119,161,10
        CONTROL         "Dark Multiplication Factor:",IDC_USEDARKFACTOR,"Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,140,133,93,10
        EDITTEXT        IDC_DARKMULTIPLICATIONFACTOR,235,133,31,8,ES_RIGHT | ES_AUTOHSCROLL | NOT WS_VISIBLE | NOT WS_BORDER
        CONTROL         "Debloom",IDC_DEBLOOM,"Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,140,133,43,10
        LTEXT           "No Background Calibration",IDC_BACKGROUNDCALIBRATION,8,133,129,8,NOT WS_VISIBLE | NOT WS_GROUP
        PUSHBUTTON      "Settings...",IDC_DEBLOOMSETTINGS,184,130,50,14,NOT WS_VISIBLE
    
    

    I'm struggling to achieve this in QtDesigner, and would appreciate some guidance.

    Thanks, David



  • I managed to achieve what I wanted by placing all the controls into a GroupBox which let me locate them exactly where I wanted to. Placing one control on top of another control works just fine.


  • Lifetime Qt Champion

    Hi
    One option is to use a QStackWidget.
    It allows you to have pages and in that way you can easily make such layout where you simply
    switch page for the look 2.
    https://doc.qt.io/qt-5/qstackedwidget.html



  • I managed to achieve what I wanted by placing all the controls into a GroupBox which let me locate them exactly where I wanted to. Placing one control on top of another control works just fine.


Log in to reply