Adding a layout inside an existing layout
-
Hi all,
I'm new to QT Design, using it mostly to generate UIs for Python.
Using QT Design only - not the studio version that gives access to the code (I think that's what it's called anyway).
Something I encountered that I'm unsure how to resolve 'cleanly':I worked on a UI and added various buttons and layouts.
Now, I want to add a new button, and have it aligned with an existing LineEdit widget:My issue, is that when I try to add a new button and align them, the only available option is to break the layout:
That is usually very messy. How do I 'cleanly' add another layout and then move both widgets into it?
I tried to add another layout and 'drag' the buttons into it, but it's thin, and you can't actually drag anything into it. It doesn't look like I can re-order items in the object inspector either:
Just to demonstrate, I did break the layout and re-create it just to explain better what I wanted it to look like, but again, breaking the layout every time isn't comfortable:
Any advice would be appreciated!
-
Hi all,
I'm new to QT Design, using it mostly to generate UIs for Python.
Using QT Design only - not the studio version that gives access to the code (I think that's what it's called anyway).
Something I encountered that I'm unsure how to resolve 'cleanly':I worked on a UI and added various buttons and layouts.
Now, I want to add a new button, and have it aligned with an existing LineEdit widget:My issue, is that when I try to add a new button and align them, the only available option is to break the layout:
That is usually very messy. How do I 'cleanly' add another layout and then move both widgets into it?
I tried to add another layout and 'drag' the buttons into it, but it's thin, and you can't actually drag anything into it. It doesn't look like I can re-order items in the object inspector either:
Just to demonstrate, I did break the layout and re-create it just to explain better what I wanted it to look like, but again, breaking the layout every time isn't comfortable:
Any advice would be appreciated!
@Nmatan said in Adding a layout inside an existing layout:
I tried to add another layout and 'drag' the buttons into it, but it's thin, and you can't actually drag anything into it. It doesn't look like I can re-order items in the object inspector either:
This is the way to do it! If it's narrow I temporarily set the new layout's "minimum height" to 50 or similar while I get widgets onto it. Then you can remove that setting.
I will try not to say too much. I am a big fan of Qt. I sometimes use Designer but IMHO it's far weaker than, say, Visual Studio was 20 years. Similar-ish for Creator itself. Ho hum.
You cannot copy/paste objects in Designer to move around where they are. Crazy. There is a way to copy/paste, if you need it, but it's so "secret" I doubt most people even know about it....
-
@Nmatan said in Adding a layout inside an existing layout:
I tried to add another layout and 'drag' the buttons into it, but it's thin, and you can't actually drag anything into it. It doesn't look like I can re-order items in the object inspector either:
This is the way to do it! If it's narrow I temporarily set the new layout's "minimum height" to 50 or similar while I get widgets onto it. Then you can remove that setting.
I will try not to say too much. I am a big fan of Qt. I sometimes use Designer but IMHO it's far weaker than, say, Visual Studio was 20 years. Similar-ish for Creator itself. Ho hum.
You cannot copy/paste objects in Designer to move around where they are. Crazy. There is a way to copy/paste, if you need it, but it's so "secret" I doubt most people even know about it....
@JonB Oh my god I feel like such an idiot, I never thought to try and increase the margin for the layout from the property editor, I assumed it's like that since you can't resize anything inside a layout.
The one I use is "Designer" I think which is the 'simple' one? Since all I needed was an easy way to generate UI files for Pycharm, I figured creator should be fine, and this topic was my main 'beef' with it - which you've helped me navigate :)
Thanks again!
-
-
@JonB Oh my god I feel like such an idiot, I never thought to try and increase the margin for the layout from the property editor, I assumed it's like that since you can't resize anything inside a layout.
The one I use is "Designer" I think which is the 'simple' one? Since all I needed was an easy way to generate UI files for Pycharm, I figured creator should be fine, and this topic was my main 'beef' with it - which you've helped me navigate :)
Thanks again!
@Nmatan
Yes, Designer is the UI designer (producing a.ui
file) component in Creator, which is the rest of the code editor/building/running/debugging IDE. When I did Python stuff I too just generated the.ui
from Designer/Creator and used PyCharm as my preferred Python IDE. Nowadays Creator has some support for Python coding and PySide, but I don't know how it compares to PyCharm, doubtless that is better. -
Hi all,
I'm new to QT Design, using it mostly to generate UIs for Python.
Using QT Design only - not the studio version that gives access to the code (I think that's what it's called anyway).
Something I encountered that I'm unsure how to resolve 'cleanly':I worked on a UI and added various buttons and layouts.
Now, I want to add a new button, and have it aligned with an existing LineEdit widget:My issue, is that when I try to add a new button and align them, the only available option is to break the layout:
That is usually very messy. How do I 'cleanly' add another layout and then move both widgets into it?
I tried to add another layout and 'drag' the buttons into it, but it's thin, and you can't actually drag anything into it. It doesn't look like I can re-order items in the object inspector either:
Just to demonstrate, I did break the layout and re-create it just to explain better what I wanted it to look like, but again, breaking the layout every time isn't comfortable:
Any advice would be appreciated!
@Nmatan said in Adding a layout inside an existing layout:
I tried to add another layout and 'drag' the buttons into it, but it's thin, and you can't actually drag anything into it
Another way is dragging the elements in the object inspector list.
If you have a layout which appears too tiny to edit in the form editor on the left, dragging the element to some existing layout helps.For the rest: what @JonB said :)
@JonB said in Adding a layout inside an existing layout:
There is a way to copy/paste, if you need it, but it's so "secret" I doubt most people even know about it....
Isn't this just
Ctrl + C/V
-'ing a selection of widgets on the form?
Haven't done anything with Designer for quite some time, but IIRC I've even managed to copy whole forms (including all child widgets) from one UI file to another ?! Not 100% sure though... -
@Nmatan said in Adding a layout inside an existing layout:
I tried to add another layout and 'drag' the buttons into it, but it's thin, and you can't actually drag anything into it
Another way is dragging the elements in the object inspector list.
If you have a layout which appears too tiny to edit in the form editor on the left, dragging the element to some existing layout helps.For the rest: what @JonB said :)
@JonB said in Adding a layout inside an existing layout:
There is a way to copy/paste, if you need it, but it's so "secret" I doubt most people even know about it....
Isn't this just
Ctrl + C/V
-'ing a selection of widgets on the form?
Haven't done anything with Designer for quite some time, but IIRC I've even managed to copy whole forms (including all child widgets) from one UI file to another ?! Not 100% sure though... -
@Pl45m4 said in Adding a layout inside an existing layout:
Isn't this just Ctrl + C/V-'ing a selection of widgets on the form?
Have you tried this...? :)
@JonB said in Adding a layout inside an existing layout:
Have you tried this...? :)
Yup, now, it works. The obvious way.
You can even clone a selection of widgets in the object inspector.@JonB said in Adding a layout inside an existing layout:
There is a way to copy/paste, if you need it, but it's so "secret" I doubt most people even know about it....
So that was ironic?! :D
Because Ctrl C, Ctrl V is not "secret"?! :D
If so, I missed that, because, well... we all know QtDesigner has some useless features, things that you should avoid and sometimes "feels" kinda weird. -
I posted in an unanswered thread a while back my frustration that designer would sometimes grey-out certain widget fields unless I made copies of those widgets, and then those copies would allow editing, but not the master they were cloned from. So yes, designer is not great, but I suppose it's better than nothing for RAD/RAP.
-
@JonB said in Adding a layout inside an existing layout:
Have you tried this...? :)
Yup, now, it works. The obvious way.
You can even clone a selection of widgets in the object inspector.@JonB said in Adding a layout inside an existing layout:
There is a way to copy/paste, if you need it, but it's so "secret" I doubt most people even know about it....
So that was ironic?! :D
Because Ctrl C, Ctrl V is not "secret"?! :D
If so, I missed that, because, well... we all know QtDesigner has some useless features, things that you should avoid and sometimes "feels" kinda weird.