<div style="font-family: Helvetica; font-size: 13px; ">Thanks John for the code. It works fine. I'm not really into the qt internals, I don't know if it is enough to overload in QMdiSubWindow size() and resize() to account for your code snippets. Should this be reported as a bug?<br></div>
                <div></div>
                 
                <p style="color: #A0A0A8;">Am Mittwoch, 24. April 2013 um 17:49 schrieb John Weeks:</p>
                <blockquote type="cite" style="border-left-style:solid;border-width:1px;margin-left:0px;padding-left:10px;">
                    <span><div><div><div>OK- this time I got the correct message sent to the correct address. Sorry about that whole series of mistakes. I gotta say, I really disagree with the general notion that putting the list as the Reply To: is a bad thing...</div><div><br></div><div><br></div><div><br></div><div><br></div>Yep- I got caught by this one, too. The explanation is that a QMdiSubWindow isn't actually a window, it's a child widget of the QMdiArea that contains it. Consequently, what looks like a window title bar is actually a child widget drawn by Qt. As such, the whole "window" is the QMdiSubWindow.<div><br></div><div>That doesn't really help, does it?</div><div><br></div><div>Here's my code to get the titlebar height in order to correct it:</div><div><br></div><div>----------------------------</div><div> <span style="white-space:pre">   </span>if ( (myWidget()->windowFlags() & Qt::FramelessWindowHint) != 0)<br><span style="white-space:pre">              </span>return 0;<br><span style="white-space:pre">     </span><br><span style="white-space:pre">   </span>QStyle * wStyle = myWidget()->style();<br><span style="white-space:pre">      </span>QStyleOptionTitleBar so;<br><span style="white-space:pre">      </span>so.titleBarState = 1;<span style="white-space:pre">              </span>// kThemeStateActive<br><span style="white-space:pre">       </span>so.titleBarFlags = Qt::Window;<br><span style="white-space:pre">   </span><br><span style="white-space:pre">   </span>// it seems that pixelMetric includes the frame in the titlebar height.<br><span style="white-space:pre">    </span>int titleBarHeight = wStyle->pixelMetric(QStyle::PM_TitleBarHeight, &so, myWidget());<br>#ifdef MACIGOR<br><span style="white-space:pre"> </span>titleBarHeight -= 4;<span style="white-space:pre">               </span>// pixelMetric adds 4 pixels for some unknown reason.<br>#endif<br><br><span style="white-space:pre">    </span>return titleBarHeight;</div><div><div>----------------------------</div></div><div><br></div><div>You will also need the frame width:</div><div><br></div><div>----------------------------</div><div> <span style="white-space:pre">    </span>if ( (myWidget()->windowFlags() & Qt::FramelessWindowHint) != 0)<br><span style="white-space:pre">              </span>return 0;<br><br></div><div><span style="white-space:pre">    </span>QStyle * wStyle = myWidget()->style();<br><span style="white-space:pre">      </span>QStyleOptionTitleBar so;<br><span style="white-space:pre">      </span>so.titleBarState = 1;<span style="white-space:pre">              </span>// kThemeStateActive<br><span style="white-space:pre">       </span>so.titleBarFlags = Qt::Window;<br><span style="white-space:pre">   </span><br><span style="white-space:pre">   </span>return wStyle->pixelMetric(QStyle::PM_MdiSubWindowFrameWidth , &so, myWidget());<br><div>----------------------------</div><div><br></div><br></div><div>If anyone sees a problem with this, I'd be interested in hearing about it. So far it seems to work, at least on Macintosh and Windows.</div><div><br></div><div><div><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; font-family: Geneva; "><div>-John Weeks</div><div><br></div></div></div></div><div><br><div><div>On 23-Apr-2013, at 1:22 PM, Immanuel Weber wrote:</div><br><blockquote type="cite"><div><div dir="ltr">
                <div>
                    Hi all,
                </div><div><br></div><div>I'm trying to set the inner area of a QMdiSubArea to a specific size, but the the resize(..) member of QMdiSubArea includes the frame. As stated in the documentation (<a href="http://qt-project.org/doc/qt-5.0/qtwidgets/application-windows.html#window-geometry" target="_blank">http://qt-project.org/doc/qt-5.0/qtwidgets/application-windows.html#window-geometry</a>) resize(..) (belonging to size()) should exclude the frame and set the size of the inner area, but it sets the size of the complete sub window. Matching that, size() returns the same frame-including-value as frameSize() does. I know that there are (non-beautiful/simple) ways to do that, by determining the border width of a sub window, but I'm just curious why we have such an inconsitency here.</div>
<div>I add a minimal example, where you can see the normal behavior and the one of the sub window.</div><div>In addition there is a commented resize command, which produces (uncommented) on my machines another strange behavior: the window is moved to the top left corner of the screen, so that the header bar of the window lies outside of it.</div>
<div><br></div>#include <QApplication><br>#include <QtWidgets/QtWidgets><br>#include <QDebug><br><br><br>int main(int argc, char *argv[])<br>{<br>    QApplication a(argc, argv);<br>    QPushButton * button = new QPushButton("button");<br>
    QMdiArea area;<br>    QMdiSubWindow * sub = area.addSubWindow(button);<br>    area.show();<br>    qDebug() << "strange: "<<  sub->size() << sub->frameSize();<br>    qDebug() << "expected: " << area.size() << area.frameSize();<br>
<br><div>//    area.resize(500, 500);<br><br>    return a.exec();<br>}</div><div><br></div><div>(all on Win7 x64 with a Qt 5.0.1/.2 x86 MSVC release)<br><div><br></div><div>Any ideas on that?</div><div>Greetings</div><div>
Immanuel</div><div><br></div><div><br></div><div><br></div>
                 
            </div></div>
_______________________________________________<br>Interest mailing list<br><a href="mailto:Interest@qt-project.org">Interest@qt-project.org</a><br><a href="http://lists.qt-project.org/mailman/listinfo/interest">http://lists.qt-project.org/mailman/listinfo/interest</a><br></div></blockquote></div><br></div></div><div><div>_______________________________________________</div><div>Interest mailing list</div><div><a href="mailto:Interest@qt-project.org">Interest@qt-project.org</a></div><div><a href="http://lists.qt-project.org/mailman/listinfo/interest">http://lists.qt-project.org/mailman/listinfo/interest</a></div></div></div></span>
                 
                 
                 
                 
                </blockquote>
                 
                <div>
                    <br>
                </div>