diff options
Diffstat (limited to 'src/gui/kernel/qwindow.cpp')
| -rw-r--r-- | src/gui/kernel/qwindow.cpp | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index 2fcad5706f9..65530f676a6 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -126,6 +126,18 @@ QT_BEGIN_NAMESPACE and can keep rendering until it isExposed() returns false. To find out when isExposed() changes, reimplement exposeEvent(). The window will always get a resize event before the first expose event. + + \section1 Initial geometry + + If the window's width and height are left uninitialized, the window will + get a reasonable default geometry from the platform window. If the position + is left uninitialized, then the platform window will allow the windowing + system to position the window. For example on X11, the window manager + usually does some kind of smart positioning to try to avoid having new + windows completely obscure existing windows. However setGeometry() + initializes both the position and the size, so if you want a fixed size but + an automatic position, you should call resize() or setWidth() and + setHeight() instead. */ /*! @@ -962,7 +974,7 @@ void QWindow::setY(int arg) void QWindow::setWidth(int arg) { if (width() != arg) - setGeometry(QRect(x(), y(), arg, height())); + resize(arg, height()); } /*! @@ -972,7 +984,7 @@ void QWindow::setWidth(int arg) void QWindow::setHeight(int arg) { if (height() != arg) - setGeometry(QRect(x(), y(), width(), arg)); + resize(width(), arg); } /*! @@ -1095,6 +1107,7 @@ void QWindow::setGeometry(int posx, int posy, int w, int h) void QWindow::setGeometry(const QRect &rect) { Q_D(QWindow); + d->positionAutomatic = false; if (rect == geometry()) return; QRect oldRect = geometry(); @@ -1246,7 +1259,12 @@ void QWindow::resize(const QSize &newSize) if (d->platformWindow) { d->platformWindow->setGeometry(QRect(position(), newSize)); } else { + const QSize oldSize = d->geometry.size(); d->geometry.setSize(newSize); + if (newSize.width() != oldSize.width()) + emit widthChanged(newSize.width()); + if (newSize.height() != oldSize.height()) + emit heightChanged(newSize.height()); } } @@ -1436,13 +1454,15 @@ QObject *QWindow::focusObject() const Shows the window. This equivalent to calling showFullScreen() or showNormal(), depending - on whether the platform defaults to windows being fullscreen or not. + on whether the platform defaults to windows being fullscreen or not, and + whether the window is a popup. - \sa showFullScreen(), showNormal(), hide(), QStyleHints::showIsFullScreen() + \sa showFullScreen(), showNormal(), hide(), QStyleHints::showIsFullScreen(), flags() */ void QWindow::show() { - if (qApp->styleHints()->showIsFullScreen()) + bool isPopup = d_func()->windowFlags & Qt::Popup & ~Qt::Window; + if (!isPopup && qApp->styleHints()->showIsFullScreen()) showFullScreen(); else showNormal(); |
