equal
deleted
inserted
replaced
1 /**************************************************************************** |
1 /**************************************************************************** |
2 ** |
2 ** |
3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). |
3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
4 ** All rights reserved. |
4 ** All rights reserved. |
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
6 ** |
6 ** |
7 ** This file is part of the QtGui module of the Qt Toolkit. |
7 ** This file is part of the QtGui module of the Qt Toolkit. |
8 ** |
8 ** |
67 #elif defined(Q_OS_SYMBIAN) |
67 #elif defined(Q_OS_SYMBIAN) |
68 # include "qfiledialog.h" |
68 # include "qfiledialog.h" |
69 # include "qfontdialog.h" |
69 # include "qfontdialog.h" |
70 # include "qcolordialog.h" |
70 # include "qcolordialog.h" |
71 # include "qwizard.h" |
71 # include "qwizard.h" |
72 # include "qmenubar.h" |
|
73 #endif |
72 #endif |
74 |
73 |
75 #if defined(Q_WS_S60) |
74 #if defined(Q_WS_S60) |
76 #include "private/qt_s60_p.h" |
75 #include "private/qt_s60_p.h" |
77 #endif |
76 #endif |
263 { |
262 { |
264 #ifdef Q_WS_WINCE |
263 #ifdef Q_WS_WINCE |
265 if (!qt_wince_is_smartphone()) |
264 if (!qt_wince_is_smartphone()) |
266 setWindowFlags(windowFlags() | Qt::WindowOkButtonHint | QFlag(qt_wince_is_mobile() ? 0 : Qt::WindowCancelButtonHint)); |
265 setWindowFlags(windowFlags() | Qt::WindowOkButtonHint | QFlag(qt_wince_is_mobile() ? 0 : Qt::WindowCancelButtonHint)); |
267 #endif |
266 #endif |
|
267 |
|
268 #ifdef Q_WS_S60 |
|
269 if (S60->avkonComponentsSupportTransparency) { |
|
270 bool noSystemBackground = testAttribute(Qt::WA_NoSystemBackground); |
|
271 setAttribute(Qt::WA_TranslucentBackground); // also sets WA_NoSystemBackground |
|
272 setAttribute(Qt::WA_NoSystemBackground, noSystemBackground); // restore system background attribute |
|
273 } |
|
274 #endif |
268 } |
275 } |
269 |
276 |
270 #ifdef QT3_SUPPORT |
277 #ifdef QT3_SUPPORT |
271 /*! |
278 /*! |
272 \overload |
279 \overload |
291 : QWidget(dd, parent, f | QFlag((f & Qt::WindowType_Mask) == 0 ? Qt::Dialog : 0)) |
298 : QWidget(dd, parent, f | QFlag((f & Qt::WindowType_Mask) == 0 ? Qt::Dialog : 0)) |
292 { |
299 { |
293 #ifdef Q_WS_WINCE |
300 #ifdef Q_WS_WINCE |
294 if (!qt_wince_is_smartphone()) |
301 if (!qt_wince_is_smartphone()) |
295 setWindowFlags(windowFlags() | Qt::WindowOkButtonHint | QFlag(qt_wince_is_mobile() ? 0 : Qt::WindowCancelButtonHint)); |
302 setWindowFlags(windowFlags() | Qt::WindowOkButtonHint | QFlag(qt_wince_is_mobile() ? 0 : Qt::WindowCancelButtonHint)); |
|
303 #endif |
|
304 |
|
305 #ifdef Q_WS_S60 |
|
306 if (S60->avkonComponentsSupportTransparency) { |
|
307 bool noSystemBackground = testAttribute(Qt::WA_NoSystemBackground); |
|
308 setAttribute(Qt::WA_TranslucentBackground); // also sets WA_NoSystemBackground |
|
309 setAttribute(Qt::WA_NoSystemBackground, noSystemBackground); // restore system background attribute |
|
310 } |
296 #endif |
311 #endif |
297 } |
312 } |
298 |
313 |
299 /*! |
314 /*! |
300 Destroys the QDialog, deleting all its children. |
315 Destroys the QDialog, deleting all its children. |
397 if (e->type() == QEvent::OkRequest) { |
412 if (e->type() == QEvent::OkRequest) { |
398 accept(); |
413 accept(); |
399 result = true; |
414 result = true; |
400 } |
415 } |
401 #else |
416 #else |
402 if ((e->type() == QEvent::StyleChange) || (e->type() == QEvent::Resize )) |
417 if ((e->type() == QEvent::StyleChange) || (e->type() == QEvent::Resize )) { |
403 adjustPosition(parentWidget()); |
418 if (!testAttribute(Qt::WA_Moved)) { |
|
419 Qt::WindowStates state = windowState(); |
|
420 adjustPosition(parentWidget()); |
|
421 setAttribute(Qt::WA_Moved, false); // not really an explicit position |
|
422 if (state != windowState()) |
|
423 setWindowState(state); |
|
424 } |
|
425 } |
404 #endif |
426 #endif |
405 return result; |
427 return result; |
406 } |
428 } |
407 #endif |
429 #endif |
408 |
430 |
504 } |
526 } |
505 #endif //QT_NO_MENUBAR |
527 #endif //QT_NO_MENUBAR |
506 #endif //Q_WS_WINCE_WM |
528 #endif //Q_WS_WINCE_WM |
507 |
529 |
508 #ifdef Q_OS_SYMBIAN |
530 #ifdef Q_OS_SYMBIAN |
509 #ifndef QT_NO_MENUBAR |
|
510 QMenuBar *menuBar = 0; |
|
511 if (!findChild<QMenuBar *>()) |
|
512 menuBar = new QMenuBar(this); |
|
513 #endif |
|
514 |
|
515 if (qobject_cast<QFileDialog *>(this) || qobject_cast<QFontDialog *>(this) || |
531 if (qobject_cast<QFileDialog *>(this) || qobject_cast<QFontDialog *>(this) || |
516 qobject_cast<QColorDialog *>(this) || qobject_cast<QWizard *>(this)) |
532 qobject_cast<QColorDialog *>(this) || qobject_cast<QWizard *>(this)) |
517 showMaximized(); |
533 showMaximized(); |
518 else |
534 else |
519 #endif // Q_OS_SYMBIAN |
535 #endif // Q_OS_SYMBIAN |
541 #ifndef QT_NO_MENUBAR |
557 #ifndef QT_NO_MENUBAR |
542 else if (menuBar) |
558 else if (menuBar) |
543 delete menuBar; |
559 delete menuBar; |
544 #endif //QT_NO_MENUBAR |
560 #endif //QT_NO_MENUBAR |
545 #endif //Q_WS_WINCE_WM |
561 #endif //Q_WS_WINCE_WM |
546 #ifdef Q_OS_SYMBIAN |
|
547 #ifndef QT_NO_MENUBAR |
|
548 else if (menuBar) |
|
549 delete menuBar; |
|
550 #endif //QT_NO_MENUBAR |
|
551 #endif //Q_OS_SYMBIAN |
|
552 |
|
553 return res; |
562 return res; |
554 } |
563 } |
555 |
564 |
556 |
565 |
557 /*! |
566 /*! |
789 |
798 |
790 /*!\reimp */ |
799 /*!\reimp */ |
791 void QDialog::showEvent(QShowEvent *event) |
800 void QDialog::showEvent(QShowEvent *event) |
792 { |
801 { |
793 if (!event->spontaneous() && !testAttribute(Qt::WA_Moved)) { |
802 if (!event->spontaneous() && !testAttribute(Qt::WA_Moved)) { |
794 Qt::WindowStates state = windowState(); |
803 Qt::WindowStates state = windowState(); |
795 adjustPosition(parentWidget()); |
804 adjustPosition(parentWidget()); |
796 setAttribute(Qt::WA_Moved, false); // not really an explicit position |
805 setAttribute(Qt::WA_Moved, false); // not really an explicit position |
797 if (state != windowState()) |
806 if (state != windowState()) |
798 setWindowState(state); |
807 setWindowState(state); |
799 } |
808 } |
800 } |
809 } |
801 |
810 |
802 /*! \internal */ |
811 /*! \internal */ |
803 void QDialog::adjustPosition(QWidget* w) |
812 void QDialog::adjustPosition(QWidget* w) |
886 const int statusPaneHeight = (S60->screenHeightInPixels - mainAreaSize.height())>>1; |
895 const int statusPaneHeight = (S60->screenHeightInPixels - mainAreaSize.height())>>1; |
887 const bool doS60Positioning = !(isFullScreen()||isMaximized()); |
896 const bool doS60Positioning = !(isFullScreen()||isMaximized()); |
888 if (doS60Positioning) { |
897 if (doS60Positioning) { |
889 // naive way to deduce screen orientation |
898 // naive way to deduce screen orientation |
890 if (S60->screenHeightInPixels > S60->screenWidthInPixels) { |
899 if (S60->screenHeightInPixels > S60->screenWidthInPixels) { |
891 p.setY(S60->screenHeightInPixels-height()-qt_TSize2QSize(S60->buttonGroupContainer()->Size()).height()); |
900 int cbaHeight; |
|
901 const CEikButtonGroupContainer* bgContainer = S60->buttonGroupContainer(); |
|
902 if (!bgContainer) { |
|
903 cbaHeight = 0; |
|
904 } else { |
|
905 cbaHeight = qt_TSize2QSize(bgContainer->Size()).height(); |
|
906 } |
|
907 p.setY(S60->screenHeightInPixels-height()-cbaHeight); |
892 p.setX(0); |
908 p.setX(0); |
893 } else { |
909 } else { |
894 const int scrollbarWidth = style()->pixelMetric(QStyle::PM_ScrollBarExtent); |
910 const int scrollbarWidth = style()->pixelMetric(QStyle::PM_ScrollBarExtent); |
895 TRect cbaRect = TRect(); |
911 TRect cbaRect = TRect(); |
896 AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EControlPane, cbaRect); |
912 AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EControlPane, cbaRect); |