Changeset 846 for trunk/src/gui/dialogs/qdialog.cpp
- Timestamp:
- May 5, 2011, 5:36:53 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.7.2 (added) merged: 845 /branches/vendor/nokia/qt/current merged: 844 /branches/vendor/nokia/qt/4.6.3 removed
- Property svn:mergeinfo changed
-
trunk/src/gui/dialogs/qdialog.cpp
r769 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 68 68 # include "qfiledialog.h" 69 69 # include "qfontdialog.h" 70 # include "qcolordialog.h"71 70 # include "qwizard.h" 71 # include "private/qt_s60_p.h" 72 72 #endif 73 73 74 74 #if defined(Q_WS_S60) 75 #include "private/qt_s60_p.h"75 #include <AknUtils.h> // AknLayoutUtils 76 76 #endif 77 77 … … 259 259 QDialog::QDialog(QWidget *parent, Qt::WindowFlags f) 260 260 : QWidget(*new QDialogPrivate, parent, 261 f | QFlag((f & Qt::WindowType_Mask) == 0 ? Qt::Dialog : 0))261 f | ((f & Qt::WindowType_Mask) == 0 ? Qt::Dialog : Qt::WindowType(0))) 262 262 { 263 263 #ifdef Q_WS_WINCE … … 283 283 : QWidget(*new QDialogPrivate, parent, 284 284 f 285 | QFlag(modal ? Qt::WShowModal : 0)286 | QFlag((f & Qt::WindowType_Mask) == 0 ? Qt::Dialog : 0)285 | QFlag(modal ? Qt::WShowModal : Qt::WindowType(0)) 286 | QFlag((f & Qt::WindowType_Mask) == 0 ? Qt::Dialog : Qt::WindowType(0)) 287 287 ) 288 288 { … … 296 296 */ 297 297 QDialog::QDialog(QDialogPrivate &dd, QWidget *parent, Qt::WindowFlags f) 298 : QWidget(dd, parent, f | QFlag((f & Qt::WindowType_Mask) == 0 ? Qt::Dialog : 0))298 : QWidget(dd, parent, f | ((f & Qt::WindowType_Mask) == 0 ? Qt::Dialog : Qt::WindowType(0))) 299 299 { 300 300 #ifdef Q_WS_WINCE … … 394 394 } 395 395 396 #if defined(Q_WS_WINCE) || defined(Q_ WS_S60)396 #if defined(Q_WS_WINCE) || defined(Q_OS_SYMBIAN) 397 397 #ifdef Q_WS_WINCE_WM 398 398 void QDialogPrivate::_q_doneAction() … … 414 414 result = true; 415 415 } 416 #el se416 #elif defined(Q_WS_S60) 417 417 if ((e->type() == QEvent::StyleChange) || (e->type() == QEvent::Resize )) { 418 418 if (!testAttribute(Qt::WA_Moved)) { … … 424 424 } 425 425 } 426 // TODO is Symbian, non-S60 behaviour required? 426 427 #endif 427 428 return result; … … 528 529 #endif //Q_WS_WINCE_WM 529 530 531 bool showSystemDialogFullScreen = false; 530 532 #ifdef Q_OS_SYMBIAN 531 533 if (qobject_cast<QFileDialog *>(this) || qobject_cast<QFontDialog *>(this) || 532 qobject_cast<Q ColorDialog *>(this) || qobject_cast<QWizard *>(this))533 show Maximized();534 else534 qobject_cast<QWizard *>(this)) { 535 showSystemDialogFullScreen = true; 536 } 535 537 #endif // Q_OS_SYMBIAN 536 538 537 show(); 539 if (showSystemDialogFullScreen) { 540 setWindowFlags(windowFlags() | Qt::WindowSoftkeysVisibleHint); 541 setWindowState(Qt::WindowFullScreen); 542 } 543 show(); 538 544 539 545 #ifdef Q_WS_MAC … … 642 648 w = w->isWindow() ? 0 : w->parentWidget(); 643 649 if (w) { 644 Q Menu p(this);645 QAction *wt = p. addAction(tr("What's This?"));646 if (p. exec(e->globalPos()) == wt) {650 QWeakPointer<QMenu> p = new QMenu(this); 651 QAction *wt = p.data()->addAction(tr("What's This?")); 652 if (p.data()->exec(e->globalPos()) == wt) { 647 653 QHelpEvent e(QEvent::WhatsThis, w->rect().center(), 648 654 w->mapToGlobal(w->rect().center())); 649 655 QApplication::sendEvent(w, &e); 650 656 } 657 delete p.data(); 651 658 } 652 659 #endif … … 818 825 #endif 819 826 820 #ifdef Q_ WS_S60821 if (s 60AdjustedPosition())827 #ifdef Q_OS_SYMBIAN 828 if (symbianAdjustedPosition()) 822 829 //dialog has already been positioned 823 830 return; … … 887 894 } 888 895 896 #if defined(Q_OS_SYMBIAN) 897 /*! \internal */ 898 bool QDialog::symbianAdjustedPosition() 899 { 889 900 #if defined(Q_WS_S60) 890 /*! \internal */891 bool QDialog::s60AdjustedPosition()892 {893 901 QPoint p; 894 const QSize mainAreaSize = QApplication::desktop()->availableGeometry(QCursor::pos()).size(); 895 const int statusPaneHeight = (S60->screenHeightInPixels - mainAreaSize.height())>>1; 896 const bool doS60Positioning = !(isFullScreen()||isMaximized()); 897 if (doS60Positioning) { 902 QPoint oldPos = pos(); 903 if (isFullScreen()) { 904 p.setX(0); 905 p.setY(0); 906 } else if (isMaximized()) { 907 TRect statusPaneRect = TRect(); 908 if (S60->screenHeightInPixels > S60->screenWidthInPixels) { 909 AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EStatusPane, statusPaneRect); 910 } else { 911 AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EStaconTop, statusPaneRect); 912 } 913 914 p.setX(0); 915 p.setY(statusPaneRect.Height()); 916 } else { 898 917 // naive way to deduce screen orientation 899 918 if (S60->screenHeightInPixels > S60->screenWidthInPixels) { 900 919 int cbaHeight; 901 const CEikButtonGroupContainer* bgContainer = S60->buttonGroupContainer(); 902 if (!bgContainer) { 903 cbaHeight = 0; 904 } else { 905 cbaHeight = qt_TSize2QSize(bgContainer->Size()).height(); 906 } 920 TRect rect; 921 AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EControlPane, rect); 922 cbaHeight = rect.Height(); 907 923 p.setY(S60->screenHeightInPixels - height() - cbaHeight); 908 924 p.setX(0); … … 934 950 } 935 951 } 952 } 953 if (oldPos != p || p.y() < 0) 936 954 move(p); 937 } 938 return doS60Positioning; 955 return true; 956 #else 957 // TODO - check positioning requirement for Symbian, non-s60 958 return false; 959 #endif 939 960 } 940 961 #endif … … 1102 1123 if (minimumSize() != maximumSize()) { 1103 1124 // In S60, dialogs are always the width of screen (in portrait, regardless of current layout) 1104 return QSize(qM ax(S60->screenHeightInPixels, S60->screenWidthInPixels), QWidget::sizeHint().height());1125 return QSize(qMin(S60->screenHeightInPixels, S60->screenWidthInPixels), QWidget::sizeHint().height()); 1105 1126 } else { 1106 1127 return QWidget::sizeHint();
Note:
See TracChangeset
for help on using the changeset viewer.