summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qwidget_mac.mm
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-02-16 21:55:24 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-02-16 21:55:24 (GMT)
commit8776b276a828005f8b1ebfddf4d3e7a63f268866 (patch)
tree470f2d3ce6ccdff261c19f045eb25e53ecbcd08d /src/gui/kernel/qwidget_mac.mm
parentfd3f9dd0f31efeea3aa0ec28b54c70d85712c7ba (diff)
parentb92dd64af875d62bf4f64097dedaa0b2224304db (diff)
downloadQt-8776b276a828005f8b1ebfddf4d3e7a63f268866.zip
Qt-8776b276a828005f8b1ebfddf4d3e7a63f268866.tar.gz
Qt-8776b276a828005f8b1ebfddf4d3e7a63f268866.tar.bz2
Merge branch 'master' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into master-integration
* 'master' of scm.dev.nokia.troll.no:qt/oslo-staging-1: (42 commits) doc: Fixed some qdoc errors. doc: Fixed some qdoc errors. Fix copyright year. Fix broken license headers. doc: Fixed some qdoc errors. Reusing sheets on Mac OS X 10.5 & above shows painting artifacts. doc: Fixed some qdoc errors. QNetworkAccessManager: add method to send custom requests doc: Fixed some qdoc errors. Optimization: Avoid calling out to public API function Mac: submenu shows up at the wrong position Add operator< and qHash for QSharedPointer and fix operator-. Don't use QSystemLocale if QT_NO_SYSTEMLOCALE (like QWS) Don't use QSystemLocale if QT_NO_SYSTEMLOCALE (like QWS) Optimized QLocale to access system locale on demand. Fix QRegion under Mac OS X. update according to Thiago's comments. Changes: add functionality for dbus auto start to qt Add license header to this file readdir64 is not available on HP-UX ...
Diffstat (limited to 'src/gui/kernel/qwidget_mac.mm')
-rw-r--r--src/gui/kernel/qwidget_mac.mm44
1 files changed, 21 insertions, 23 deletions
diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm
index a5633d3..9e642b9 100644
--- a/src/gui/kernel/qwidget_mac.mm
+++ b/src/gui/kernel/qwidget_mac.mm
@@ -3346,38 +3346,20 @@ void QWidgetPrivate::show_sys()
return;
bool realWindow = isRealWindow();
+#ifndef QT_MAC_USE_COCOA
if (realWindow && !q->testAttribute(Qt::WA_Moved)) {
+ if (qt_mac_is_macsheet(q))
+ recreateMacWindow();
q->createWinId();
if (QWidget *p = q->parentWidget()) {
p->createWinId();
-#ifndef QT_MAC_USE_COCOA
RepositionWindow(qt_mac_window_for(q), qt_mac_window_for(p), kWindowCenterOnParentWindow);
-#else
- CGRect parentFrame = NSRectToCGRect([qt_mac_window_for(p) frame]);
- OSWindowRef windowRef = qt_mac_window_for(q);
- NSRect windowFrame = [windowRef frame];
- NSPoint parentCenter = NSMakePoint(CGRectGetMidX(parentFrame), CGRectGetMidY(parentFrame));
- [windowRef setFrameTopLeftPoint:NSMakePoint(parentCenter.x - (windowFrame.size.width / 2),
- (parentCenter.y + (windowFrame.size.height / 2)))];
-#endif
} else {
-#ifndef QT_MAC_USE_COCOA
RepositionWindow(qt_mac_window_for(q), 0, kWindowCenterOnMainScreen);
-#else
- // Ideally we would do a "center" here, but NSWindow's center is more equivalent to
- // kWindowAlertPositionOnMainScreen instead of kWindowCenterOnMainScreen.
- QRect availGeo = QApplication::desktop()->availableGeometry(q);
- // Center the content only.
- data.crect.moveCenter(availGeo.center());
- QRect fStrut = frameStrut();
- QRect frameRect(data.crect.x() - fStrut.left(), data.crect.y() - fStrut.top(),
- fStrut.left() + fStrut.right() + data.crect.width(),
- fStrut.top() + fStrut.bottom() + data.crect.height());
- NSRect cocoaFrameRect = NSMakeRect(frameRect.x(), flipYCoordinate(frameRect.bottom() + 1), frameRect.width(), frameRect.height());
- [qt_mac_window_for(q) setFrame:cocoaFrameRect display:NO];
-#endif
}
}
+#endif
+
data.fstrut_dirty = true;
if (realWindow) {
// Delegates can change window state, so record some things earlier.
@@ -4270,6 +4252,22 @@ void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove)
setGeometry_sys_helper(x, y, w, h, isMove);
}
#else
+ if (!isMove && !q->testAttribute(Qt::WA_Moved) && !q->isVisible()) {
+ // INVARIANT: The location of the window has not yet been set. The default will
+ // instead be to center it on the desktop, or over the parent, if any. Since we now
+ // resize the window, we need to adjust the top left position to keep the window
+ // centeralized. And we need to to this now (and before show) in case the positioning
+ // of other windows (e.g. sub-windows) depend on this position:
+ if (QWidget *p = q->parentWidget()) {
+ x = p->geometry().center().x() - (w / 2);
+ y = p->geometry().center().y() - (h / 2);
+ } else {
+ QRect availGeo = QApplication::desktop()->availableGeometry(q);
+ x = availGeo.center().x() - (w / 2);
+ y = availGeo.center().y() - (h / 2);
+ }
+ }
+
QSize olds = q->size();
const bool isResize = (olds != QSize(w, h));
NSWindow *window = qt_mac_window_for(q);