[Interest] QMdiSubWindow resize() does include the frame

Immanuel Weber immanuel.weber at gmail.com
Tue Apr 23 22:22:33 CEST 2013


 Hi all,

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 (
http://qt-project.org/doc/qt-5.0/qtwidgets/application-windows.html#window-geometry)
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.
I add a minimal example, where you can see the normal behavior and the one
of the sub window.
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.

#include <QApplication>
#include <QtWidgets/QtWidgets>
#include <QDebug>


int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    QPushButton * button = new QPushButton("button");
    QMdiArea area;
    QMdiSubWindow * sub = area.addSubWindow(button);
    area.show();
    qDebug() << "strange: "<<  sub->size() << sub->frameSize();
    qDebug() << "expected: " << area.size() << area.frameSize();

//    area.resize(500, 500);

    return a.exec();
}

(all on Win7 x64 with a Qt 5.0.1/.2 x86 MSVC release)

Any ideas on that?
Greetings
Immanuel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20130423/2d78ac65/attachment.html>


More information about the Interest mailing list