Cannot set specified sizes when using layouts/splitters
I'm running into a very frustrating issue. I set up my GUI in QtDesigner. Everything is laid out perfectly. I add horizontal and vertical splitters to my GUI and resize to fill my Form. Everything is still laid out perfectly. I hit save, close out, and build my application.
When I run my application, my GUI does not appear as I set it up in QtDesigner. So I reopen QtDesigner and to my surprise the GUI is not laid out the way I had it.
What is going on? Is there not a way to set up everything in QtDesigner using splitters? Do I have to resize the splitters programmatically? It would be much preferred to not have to do this programmatically if at all possible.
did you use setSizes?
I did the following steps:
- Add widgets to the form.
- Set the geometry position/sizes.
- Add horizontal splitter.
- Set horizontal splitter geometry position/size.
- Add vertical splitter with horizontal splitter and another widget as child.
- Set vertical splitter geometry position/size.
Note: I can do this programmatically no problem.
const auto osgWindowPixelWidth = 800;
const auto osgWindowPixelHeight = 450;
const auto width = this->m_window.vSplitter->width();
const auto treeViewPixelWidth = (width - osgWindowPixelWidth) / 2;
const auto propertyViewPixelWidth = width - osgWindowPixelWidth - treeViewPixelWidth;
const auto height = this->m_window.vSplitter->height();
const auto loggerPixelHeight = height - osgWindowPixelHeight;
The above code works just fine. The problem is, why can't I do this in QtDesigner? Or why have I been unsuccessful at it? Like I said above, I've got everything positioned and sized just perfectly but when I build/run my app the sizes are incorrect.
AFAIK you have to do this using code like you did. The "sizes" property isn't available in designer and i see no other way to do it, sorry.