I have problem with positioning controls in QMdiSubWindow derivate. I designed my window using QtDesigner, and it looks like this:
When I run the app it looks like this (button on the title bar): It gets ok only in maximized mode: But I would like it to always look OK. Here's a part of .ui file:
<widget class="QPushButton" name="btnToggleEdit">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Edit</string>
</property>
</widget>
It seems, as if it is rendered relative to window corner - regardless of the Title Bar of th window... How can I fix it? I am using Qt 5.2.1 (and qt add-in for Visual Studio 2010).
Well, adding layout didn't fix the problem. Of course WITH one it all works better than without (scaling), but it was not the key thing. The problem was, that I missed one paragraph in the doc:
The most common way to construct a QMdiSubWindow is to call QMdiArea::addSubWindow() with the internal widget as the argument. You can also create a subwindow yourself, and set an internal widget by calling setWidget().
My window was subclassed from QMdiSubWindow , but I didn't call setWidget() anywhere. This problem can be fixed either by calling this method when caling QMdiArea::addSubWindow(), or changing base class of my window to something diffrent that QMdiSubWindow (eg. QWidget)
So - as always: RTFM :)