Docking widgets in the parent widget.
-
I have a tabWidget with some tabs.
all widgets in the tab_params are tied to the tab - expending and shrinking with it.
I want the same behavior on others tabs. How can I do it?
I've noticed - no red mark on tab_params. I didn't do any special movements for it. -
@jenya7 said in Docking widgets in the parent widget.:
How can I do it?
Add a layout to them.
tab_params has one, the others apparently don't. -
@jsulm said in Docking widgets in the parent widget.:
Add a layout to them.
tab_params has one, the others apparently don't.How can I do it?
Let's take for example the tab_terminal. Should I set a layout to every widget in the tab?
The only option on the splitter widget - Break Layout - it ruins my splitter.
What should I choose? -
@jenya7 Add a layout to your tab widgets (like tab_terminal) - one of the "Lay Out ..." options.
Please read https://doc.qt.io/qt-5/layout.html -
@jsulm said in Docking widgets in the parent widget.:
@jenya7 Add a layout to your tab widgets (like tab_terminal) - one of the "Lay Out ..." options.
Please read https://doc.qt.io/qt-5/layout.htmlBut a tab doesn't have Lay out menu
In the document all widgets and layouts created in the code. Isn't it insane a bit?
-
@jenya7 said in Docking widgets in the parent widget.:
In the document all widgets and layouts created in the code. Isn't it insane a bit?
Which document? Do you mean in the documentation?
Right-Click in designer on an empty place of your tab_terminal (not in Object tree) - then you should be able to add layout.
See https://doc.qt.io/qt-5/designer-layouts.html -
@jsulm said in Docking widgets in the parent widget.:
@jenya7 said in Docking widgets in the parent widget.:
In the document all widgets and layouts created in the code. Isn't it insane a bit?
Which document? Do you mean in the documentation?
Right-Click in designer on an empty place of your tab_terminal (not in Object tree) - then you should be able to add layout.
See https://doc.qt.io/qt-5/designer-layouts.htmlI did so. Still no docking, also the tab looks good (no red sign).
Also I noticed on tab_params - in properties window there is a Layout section, on tab_terminal - no Layout section.
-
@jsulm said in Docking widgets in the parent widget.:
@jenya7 Your centralWidget also does not have a layout.
I assigned a layout to centralWidget. Now tab_terminal has a Layout section but still no docking.
I suppose not every widget is dockable. Also in the tab_terminal I arranged all widgets in frames.
-
@jenya7 said in Docking widgets in the parent widget.:
I suppose not every widget is dockable
Not sure what you mean with "dockable"?
-
@jsulm said in Docking widgets in the parent widget.:
@jenya7 said in Docking widgets in the parent widget.:
I suppose not every widget is dockable
Not sure what you mean with "dockable"?
It means all child widgets resized along with a parent widget. In Visual Studio we have a Dock property, also it has an Anchor property that allows to "glue" a child to a parent on top, bottom, left, right.
Too bad I have so much pain for so simple operation. -
@jenya7
Just to be explicit. You see in your screenshots that widgets which do not have a layout assigned are shown with a red "no-entry" symbol in the Object Browser in Designer. You should go through every widget at every level in your hierarchy ensuring that not a single one has that no-entry sign. Until you have done that rigorously you cannot rely on the layout behaviour of your UI. At least get that crossed off your potential issue list. -
@jenya7 said in Docking widgets in the parent widget.:
I consider to stick to a console application
You should not give up just because you have some issues at the beginning.
Layouts can be frustrating at the beginning, but once you understood how they work they are very handy.
You can upload your app (you can remove everything not related to this issue or what you don't want to share) to somewhere then I can take a look and fix it. -
@jenya7 said in Docking widgets in the parent widget.:
I consider to stick to a console application.
That would seem to be a most retrograde step!
Your current application achieves (or attempts to achieve) an awful lot more than a response-by-response command-line program would. For a first UI application it does quite a lot (tabs, frames, widgets...), so it might be expected that it would take a bit of time to get it right. Effort which will aid you in future UI additions. So as @jsulm says from where you are now it would be good if you choose to persist with the UI.