Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. Qt Designer - unable to replicate qtdesigner-manual form
Forum Updated to NodeBB v4.3 + New Features

Qt Designer - unable to replicate qtdesigner-manual form

Scheduled Pinned Locked Moved Unsolved Qt for Python
12 Posts 2 Posters 350 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    ReyCBXZRX
    wrote last edited by
    #1

    11/01/25

    Howdy.

    Newbie to this forum...and it may be the wrong one...
    I've done several tutorials primarily following the hand coded design meth and opted to try using Qt Designer for Python as I seem to mis-understand how to place the various widget on a form notably the labels next to the text edit objs.

    Following the pages in https://doc.qt.io/qt-6/qtdesigner-manual.html.

    Am at the Qt Widgets Designer's Widget Editing Mode and am trying to "replicate" the widget at the beginning of the page.

    Unfortunately, no success.

    In Qt, select the widget option and add the various labels and edit fields (line edit, combo field, etc) but not the Ok/Cancel btns.

    Have tried combining the name and lineedit objs together as well as the other objs and then attempted to set layout to horizontal and that was totally wrong.

    Another version has the various objs side by side and now show alignment by labels to incl the field objs. But in trying to reduce the height of the text fields, the flds do reduce in height but on releasing the mouse, the fld reverts to its initial size.

    So would appreciate info on where I am going wrong and/or tutorial that "holds" my hand in setting the layout of a Qt designer obj to incl hand coded forms/widgets.

    Also, is there a search field for the forum as this question/issue may have surfaced previously?

    Thank you, Rey

    cd667a27-b160-40a0-bd2e-fd28e07661dd-image.png

    JonBJ 1 Reply Last reply
    0
    • R ReyCBXZRX

      11/01/25

      Howdy.

      Newbie to this forum...and it may be the wrong one...
      I've done several tutorials primarily following the hand coded design meth and opted to try using Qt Designer for Python as I seem to mis-understand how to place the various widget on a form notably the labels next to the text edit objs.

      Following the pages in https://doc.qt.io/qt-6/qtdesigner-manual.html.

      Am at the Qt Widgets Designer's Widget Editing Mode and am trying to "replicate" the widget at the beginning of the page.

      Unfortunately, no success.

      In Qt, select the widget option and add the various labels and edit fields (line edit, combo field, etc) but not the Ok/Cancel btns.

      Have tried combining the name and lineedit objs together as well as the other objs and then attempted to set layout to horizontal and that was totally wrong.

      Another version has the various objs side by side and now show alignment by labels to incl the field objs. But in trying to reduce the height of the text fields, the flds do reduce in height but on releasing the mouse, the fld reverts to its initial size.

      So would appreciate info on where I am going wrong and/or tutorial that "holds" my hand in setting the layout of a Qt designer obj to incl hand coded forms/widgets.

      Also, is there a search field for the forum as this question/issue may have surfaced previously?

      Thank you, Rey

      cd667a27-b160-40a0-bd2e-fd28e07661dd-image.png

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote last edited by JonB
      #2

      @ReyCBXZRX
      I am unsure what you are trying here. The vital thing you will want to achieve this is layouts, https://doc.qt.io/qt-6/designer-layouts.html. Your "form", whether widget, window, dialog or whatever, needs a layout on it, and your widgets are placed on the layout(s). Here you might have any of:

      • A vertical layout for the top-level with a number of horizontal layouts on it, each holding the label + widget. While this is often used, here it is probably not what you want as it will not align the right-hand widgets vertically at their left-hand sides.

      • A grid layout, with two columns and number of rows (here four).

      • The specialized form layout, which is specifically designed for (any number of rows of) two columns, one to hold the label and the other the input widget. This is laid out/aligned in a style "native" to your OS for "filling in a form", and varies slightly between Windows/Linux/Mac.

      I don't know quite what you see for this forum, but in my browser I see a vertical bar at the right-hand side of the page which has Search with a magnifying glass on it. However I find the search can be a bit hit or miss, you may get just as good/better results with a judicious Google where you can always select the hits on this site.

      1 Reply Last reply
      2
      • R Offline
        R Offline
        ReyCBXZRX
        wrote last edited by
        #3

        Neglect to say I'm using Qt Designer 6.4.3 and Python 3.11.

        1 Reply Last reply
        0
        • R Offline
          R Offline
          ReyCBXZRX
          wrote last edited by
          #4

          Howdy JonB.
          Found search when I had browser (Vivaldi) fully open 8-)
          Will try/experiment more as the lineEdits do not show the up and down icons on right side like the example and while form does resize on changing form width the lineEdit objs do not allow height chng. Thanks for reply and suggestions, Rey
          image.png

          1 Reply Last reply
          0
          • JonBJ Offline
            JonBJ Offline
            JonB
            wrote last edited by
            #5

            If you don't show or give a link to whatever example people don't know what you are looking at. For a QTextEdit I think by default you will only see scrollbars if needed by the current content, see enum Qt::ScrollBarPolicy.

            1 Reply Last reply
            0
            • R Offline
              R Offline
              ReyCBXZRX
              wrote last edited by
              #6

              Howdy JonB. The form I'm looking at is at https://doc.qt.io/qt-6/designer-widget-mode.html. Took a break and now will get back at it...Thanks, Rey

              JonBJ 1 Reply Last reply
              0
              • R ReyCBXZRX

                Howdy JonB. The form I'm looking at is at https://doc.qt.io/qt-6/designer-widget-mode.html. Took a break and now will get back at it...Thanks, Rey

                JonBJ Offline
                JonBJ Offline
                JonB
                wrote last edited by JonB
                #7

                @ReyCBXZRX
                Well nowhere on that page is there a QTextEdit, let alone one with scrollbars. QLineEdits do not allow height change. And they have QGridLayout and QHBoxLayout where you have no explicit layouts (you may have set Form layout on the widget I cannot tell). If you are not using layouts you will get nowhere with e.g. resizing. So all in all your situation is pretty different....

                1 Reply Last reply
                0
                • R Offline
                  R Offline
                  ReyCBXZRX
                  wrote last edited by
                  #8

                  Howdy again. The Qt Designer ver I'm using has no QTextEdit but has a plainLineEdit obj that when height resized shows scrollbar.
                  Went through tutorial (https://www.youtube.com/watch?v=EmZZvBEKBxc) that uses frames where layout added after widget objs inserted.
                  Thru trial and err - pain - finally understood why I was having problems with label and lineEdits not aligning but lineEdit above label...and that was that I had the label TOO close to line edit where label size was touching or extending into the lineEdit field. Once I adjusted the label or lineEdit so they were not touching/overlapping, then they lined up horizontally. In many of my attempts, I would put the label and lineEdit into a horizontal layout and then add to vertical layout screwing things up AGAIN.
                  Will try using label and lineEdit in horizontal layout and adding to frame to see what happens.
                  As is said, trial and err is best learning experience BUT bad for keyboards 8-)
                  Thanks for assistance, will update and my results. Rey

                  JonBJ 1 Reply Last reply
                  0
                  • R ReyCBXZRX

                    Howdy again. The Qt Designer ver I'm using has no QTextEdit but has a plainLineEdit obj that when height resized shows scrollbar.
                    Went through tutorial (https://www.youtube.com/watch?v=EmZZvBEKBxc) that uses frames where layout added after widget objs inserted.
                    Thru trial and err - pain - finally understood why I was having problems with label and lineEdits not aligning but lineEdit above label...and that was that I had the label TOO close to line edit where label size was touching or extending into the lineEdit field. Once I adjusted the label or lineEdit so they were not touching/overlapping, then they lined up horizontally. In many of my attempts, I would put the label and lineEdit into a horizontal layout and then add to vertical layout screwing things up AGAIN.
                    Will try using label and lineEdit in horizontal layout and adding to frame to see what happens.
                    As is said, trial and err is best learning experience BUT bad for keyboards 8-)
                    Thanks for assistance, will update and my results. Rey

                    JonBJ Offline
                    JonBJ Offline
                    JonB
                    wrote last edited by
                    #9

                    @ReyCBXZRX said in Qt Designer - unable to replicate qtdesigner-manual form:

                    The Qt Designer ver I'm using has no QTextEdit

                    All versions of Designer offer a QTextEdit widget along with all the other widgets.

                    but has a plainLineEdit obj that when height resized shows scrollbar

                    I do not know what "plainLineEdit obj" is. Qt has QTextEdit and QPlainTextEdit, both of which are multiline, can be resized vertically, and can show scrollbars (both vertically or horizontally). OTOH there is also a QLineEdit widget which is single-line, does not show scrollbars and cannot be resized vertically.

                    line edit where label size was touching or extending into the lineEdit field

                    I do not know what you are saying or doing here. It sounds a bit like you are using "absolute positioning" of widgets by dragging them around, not sure. If so you should not be using that: you want to use layouts, that will position your widgets so that e.g. they do not "touch or overlap" and will move them around for resizing.

                    1 Reply Last reply
                    1
                    • R Offline
                      R Offline
                      ReyCBXZRX
                      wrote last edited by
                      #10

                      OK. Seems I'm getting hang of this...simple layout as I'd be bald if not 8-)
                      But one issue was that I was using plainTextEdit instead of spinbox obj which has up/down btns and thus field size stayed constant whereas the plainTextEdit obj started as square which I resized but when running form would change/increase size. Played on separate form and realized my error. Regarding the widget overlap, I place widgets inside frame, space then so there is no overlap and THEN apply layout inside frame. When "done", I set layout for the form in this case vertical.
                      Will try your overlap suggestion and continue "learning." Thanks

                      JonBJ 1 Reply Last reply
                      0
                      • R Offline
                        R Offline
                        ReyCBXZRX
                        wrote last edited by
                        #11

                        Here's form at this time: image.png

                        1 Reply Last reply
                        0
                        • R ReyCBXZRX

                          OK. Seems I'm getting hang of this...simple layout as I'd be bald if not 8-)
                          But one issue was that I was using plainTextEdit instead of spinbox obj which has up/down btns and thus field size stayed constant whereas the plainTextEdit obj started as square which I resized but when running form would change/increase size. Played on separate form and realized my error. Regarding the widget overlap, I place widgets inside frame, space then so there is no overlap and THEN apply layout inside frame. When "done", I set layout for the form in this case vertical.
                          Will try your overlap suggestion and continue "learning." Thanks

                          JonBJ Offline
                          JonBJ Offline
                          JonB
                          wrote last edited by
                          #12

                          @ReyCBXZRX
                          I don't always follow the logic or English of what you write, but never mind :)

                          A QSpinBox has a pair of "scroll arrows" at the right but it is not a "scrollbar". These are for inc/decrementing the number value and have nothing to do with scrolling or sizing. A QLineEdit is for entering text (rather than number), is single line and has no scrollbars. A QTextEdit or QPlainTextEdit is for multiline text, can be resized vertically and can have scrollbars.

                          There are two ways of adding a layout to a widget in Designer. Each widget can have a layout set by right-clicking on it and selecting Layout > menu item. However for unknown/inexplicable reason this is only enabled when the parent widget has had at least one child widget placed on it, you cannot do it before you add any child widget, which is rather odd. Alternatively there are explicit layout items available at the top of the all the items you can drag from the left-hand side toolbar, these can be dragged and placed anytime. I have never understood/investigated whether there is any difference in result between these two methods.

                          With layouts there should be no "overlapping", it is their job to prevent this.

                          One tip: If you look at the Object Explorer --- the pane at the right which shows all your placed widgets in their hierarchy --- you will see a "red no entry" symbol on any widgets you have created which do not have a layout but should have. If you see that you know you should be adding a layout there.

                          1 Reply Last reply
                          0

                          • Login

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • Users
                          • Groups
                          • Search
                          • Get Qt Extensions
                          • Unsolved