Qt Designer; difficulty placing widgets in the right parent

qtqt-designer

Using the Qt Designer I've made a couple of QFrames in each other, each having a horizontal layout. Their stylesheet predicates that they should have no margin nor a padding. This means that in the Qt Designers view as well as in the final result, no space is seen between the QFrames.

Using drag-and-drop I can place widgets into the window, it shows a blue line where it will be placed (in a layout). However, it's impossible to add another QFrame to a QFrame parent I can't see (and thus drop on). There is also a tree in the right panel, but dropping on the parent makes it automatically go in one of the childs…

Example, I have this setup:

QMainWindow
- QWidget
  - QFrame (parent)
    - QFrame (child)
    - QFrame (child)

Adding a new frame, whatever I try, gives me:

QMainWindow
- QWidget
  - QFrame (parent)
    - QFrame (child)
    - QFrame (child)
    - QFrame (new child)

But I really want:

QMainWindow
- QWidget
  - QFrame (parent)
    - QFrame (child)
    - QFrame (child)
  - QFrame (new parent)

Is there any feature I haven't discovered to accurately place new widgets?

Best Answer

You can use the Object Inspector window, but you don't seem to be able to paste into a QFrame that has a locked layout.

So given your layout:

QMainWindow
- QWidget
  - QFrame (A)
    - QFrame (B)
    - QFrame (C)
    - QFrame (D)

Select QFrame D in the Object Inspector window and Cut it, right click QWidget and Break the layout (ctrl-0), then paste. Then re-apply the layout.

Related Topic