diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2016-07-26 10:43:29 +0200 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2016-07-26 10:43:29 +0200 |
commit | 6c5de416c9e77433b20b95621c75666a47fbffbd (patch) | |
tree | 313690f41f9d6a1d8dd569b47156305463e3d615 /src/gui/kernel | |
parent | 091e61b3525c700ce4198086bbd0d95a59fcb31f (diff) | |
parent | 8ea6e8d525b9dd8703ebdd0938706bd9785858a4 (diff) |
Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
src/corelib/io/qtemporarydir.cpp
One side encapsulated a repeated piece of #if-ery in a local define;
the other added to the #if-ery. Made its addition to the other's.
src/corelib/kernel/qeventdispatcher_unix_p.h
One side moved some members into a struct; this collided with a #undef
check that neither side now has. Discarded the #undef part.
src/gui/opengl/qopengltexturehelper_p.h
5.7 deleted a bunch of methods; not clear why merge got confused.
src/tools/moc/moc.cpp
One added a name to the copyright header; another changed its URL.
Change-Id: I9e9032b819f030d67f1915445acf2793e98713fa
Diffstat (limited to 'src/gui/kernel')
-rw-r--r-- | src/gui/kernel/qevent.h | 2 | ||||
-rw-r--r-- | src/gui/kernel/qplatformwindow.cpp | 31 |
2 files changed, 23 insertions, 10 deletions
diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h index 0a207667ad..570212966f 100644 --- a/src/gui/kernel/qevent.h +++ b/src/gui/kernel/qevent.h @@ -534,7 +534,7 @@ public: }; class Attribute { public: - Attribute(AttributeType t, int s, int l, QVariant val) : type(t), start(s), length(l), value(qMove(val)) {} + Attribute(AttributeType typ, int s, int l, QVariant val) : type(typ), start(s), length(l), value(qMove(val)) {} AttributeType type; int start; diff --git a/src/gui/kernel/qplatformwindow.cpp b/src/gui/kernel/qplatformwindow.cpp index e45a1d61ba..bcd3e830dd 100644 --- a/src/gui/kernel/qplatformwindow.cpp +++ b/src/gui/kernel/qplatformwindow.cpp @@ -581,6 +581,20 @@ void QPlatformWindow::invalidateSurface() { } +static QSize fixInitialSize(QSize size, const QWindow *w, + int defaultWidth, int defaultHeight) +{ + if (size.width() == 0) { + const int minWidth = w->minimumWidth(); + size.setWidth(minWidth > 0 ? minWidth : defaultWidth); + } + if (size.height() == 0) { + const int minHeight = w->minimumHeight(); + size.setHeight(minHeight > 0 ? minHeight : defaultHeight); + } + return size; +} + /*! Helper function to get initial geometry on windowing systems which do not do smart positioning and also do not provide a means of centering a @@ -593,19 +607,18 @@ void QPlatformWindow::invalidateSurface() QRect QPlatformWindow::initialGeometry(const QWindow *w, const QRect &initialGeometry, int defaultWidth, int defaultHeight) { + if (!w->isTopLevel()) { + const qreal factor = QHighDpiScaling::factor(w); + const QSize size = fixInitialSize(QHighDpi::fromNative(initialGeometry.size(), factor), + w, defaultWidth, defaultHeight); + return QRect(initialGeometry.topLeft(), QHighDpi::toNative(size, factor)); + } const QScreen *screen = effectiveScreen(w); if (!screen) return initialGeometry; QRect rect(QHighDpi::fromNativePixels(initialGeometry, w)); - if (rect.width() == 0) { - const int minWidth = w->minimumWidth(); - rect.setWidth(minWidth > 0 ? minWidth : defaultWidth); - } - if (rect.height() == 0) { - const int minHeight = w->minimumHeight(); - rect.setHeight(minHeight > 0 ? minHeight : defaultHeight); - } - if (w->isTopLevel() && qt_window_private(const_cast<QWindow*>(w))->positionAutomatic + rect.setSize(fixInitialSize(rect.size(), w, defaultWidth, defaultHeight)); + if (qt_window_private(const_cast<QWindow*>(w))->positionAutomatic && w->type() != Qt::Popup) { const QRect availableGeometry = screen->availableGeometry(); // Center unless the geometry ( + unknown window frame) is too large for the screen). |