Formatting Object in Form Layout
-
wrote on 20 May 2019, 17:52 last edited by mzimmers
Hi all -
I'm trying to use a form layout to organize several details in a widget. Most of the details are line text items, but one is another widget that looks like this:
(I had to use the stylesheet to set the background to white.)
When it displays in my form, here's what it looks like:
The spacing isn't right, and it looks like something is misaligned vertically. Plus I'd like to have a black border (I could add that to the style sheet, I suppose).
Can someone advise on how to properly space an object within the layout? Thanks.
-
Hi,
How do you build that assignment source widget ?
-
wrote on 20 May 2019, 20:55 last edited by
Massive brain failure here. My other post about the cross headers was meant as a reply here.
As stated, I create the IpSource object in Designer, and use it in another Widget (also created in Designer). Not sure if this answers your question...
-
Partially, I'm thinking about using a QFrame to contain the checkboxes. That might give you the visual you are looking for.
-
wrote on 20 May 2019, 21:10 last edited by
Would the QFrame be instead of the QGroupBox I'm currently using?
-
That's what I had mind yes.
Basically:
- QFrame
- QVBoxLayout
- QRadioButton
-
Your widget doesn't have a layout. It contains a layout, but it itself doesn't have one.
-
wrote on 20 May 2019, 21:38 last edited by
I assume you're talking about the top-level widget. Does not having a top-level layout contribute to the problem I'm experiencing?
-
I assume you're talking about the top-level widget. Does not having a top-level layout contribute to the problem I'm experiencing?
@mzimmers said in Formatting Object in Form Layout:
I assume you're talking about the top-level widget.
No, I'm talking about the small widget you're inserting into the top-level widget.
But the consideration applies to the top level widget as well, if it doesn't have a layout, give it one. -
wrote on 20 May 2019, 22:28 last edited by mzimmers
Trying to consolidate kshugunov's suggestion with SGaist's...I created a QFrame, QVBoxLayout, and two QRadioButtons. Oddly enough, when I don't use a form layout on my details, the information shows up (though it's not yet formatted as I'd like):
But when I do a form layout on the stuff on the left, The frame shrinks and the buttons disappear:
Do I need some explicit geometry on the frame to prevent it from getting shrunk?
-
Trying to consolidate kshugunov's suggestion with SGaist's...I created a QFrame, QVBoxLayout, and two QRadioButtons. Oddly enough, when I don't use a form layout on my details, the information shows up (though it's not yet formatted as I'd like):
But when I do a form layout on the stuff on the left, The frame shrinks and the buttons disappear:
Do I need some explicit geometry on the frame to prevent it from getting shrunk?
@mzimmers said in Formatting Object in Form Layout:
Do I need some explicit geometry on the frame to prevent it from getting shrunk?
Mind uploading the .ui file somewhere so I can open it with the designer?
-
wrote on 21 May 2019, 13:45 last edited by
Thanks...
-
Thanks...
Look here. It just is getting used to the layout system is all. And give your widgets layouts, so they can put their child widgets correctly.
-
wrote on 21 May 2019, 18:34 last edited by
Thanks for taking the time to do that, kshegunov. So, I guess the takeaway is that pretty much everything needs layouts? I'd been limiting my use of them to where I could see they were needed, but if failing to use them results in stuff (like my radio buttons) not showing up, then I guess they're needed in more places than are immediately evident.
-
Thanks for taking the time to do that, kshegunov. So, I guess the takeaway is that pretty much everything needs layouts? I'd been limiting my use of them to where I could see they were needed, but if failing to use them results in stuff (like my radio buttons) not showing up, then I guess they're needed in more places than are immediately evident.
@mzimmers said in Formatting Object in Form Layout:
So, I guess the takeaway is that pretty much everything needs layouts?
Yes, pretty much. The widget depends on its layout to manage the geometry of the children, so if there's none the children float freely. Child layouts (the ones in red) are much more rarely needed, but the widgets have to have them to display properly.
-
wrote on 21 May 2019, 20:15 last edited by
Makes sense. With the addition of some spacers, I was able to get the layout a little more to my liking.
So, what's the verdict on my IP selector: should I be using a Frame or a QGroupBox?
-
Use whatever gets you the result you are looking for.
-
wrote on 21 May 2019, 21:11 last edited by
-
Might be a silly question but do you have any empty row ?
-
wrote on 21 May 2019, 21:28 last edited by
1/35