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 ** |
108 |
108 |
109 #include "qwidget_p.h" |
109 #include "qwidget_p.h" |
110 #include "qevent_p.h" |
110 #include "qevent_p.h" |
111 #include "qdnd_p.h" |
111 #include "qdnd_p.h" |
112 #include <QtGui/qgraphicsproxywidget.h> |
112 #include <QtGui/qgraphicsproxywidget.h> |
|
113 #include "qmainwindow.h" |
113 |
114 |
114 QT_BEGIN_NAMESPACE |
115 QT_BEGIN_NAMESPACE |
115 |
116 |
116 #define XCOORD_MAX 16383 |
117 #define XCOORD_MAX 16383 |
117 #define WRECT_MAX 8191 |
118 #define WRECT_MAX 8191 |
1719 QWidget member functions |
1720 QWidget member functions |
1720 *****************************************************************************/ |
1721 *****************************************************************************/ |
1721 void QWidgetPrivate::determineWindowClass() |
1722 void QWidgetPrivate::determineWindowClass() |
1722 { |
1723 { |
1723 Q_Q(QWidget); |
1724 Q_Q(QWidget); |
|
1725 #if !defined(QT_NO_MAINWINDOW) && !defined(QT_NO_TOOLBAR) |
|
1726 // Make sure that QMainWindow has the MacWindowToolBarButtonHint when the |
|
1727 // unifiedTitleAndToolBarOnMac property is ON. This is to avoid reentry of |
|
1728 // setParent() triggered by the QToolBar::event(QEvent::ParentChange). |
|
1729 QMainWindow *mainWindow = qobject_cast<QMainWindow *>(q); |
|
1730 if (mainWindow && mainWindow->unifiedTitleAndToolBarOnMac()) { |
|
1731 data.window_flags |= Qt::MacWindowToolBarButtonHint; |
|
1732 } |
|
1733 #endif |
1724 #ifndef QT_MAC_USE_COCOA |
1734 #ifndef QT_MAC_USE_COCOA |
1725 // ### COCOA:Interleave these better! |
1735 // ### COCOA:Interleave these better! |
1726 |
1736 |
1727 const Qt::WindowType type = q->windowType(); |
1737 const Qt::WindowType type = q->windowType(); |
1728 Qt::WindowFlags &flags = data.window_flags; |
1738 Qt::WindowFlags &flags = data.window_flags; |
2741 if (qt_mac_is_macdrawer(q)) { |
2751 if (qt_mac_is_macdrawer(q)) { |
2742 oldDrawer = qt_mac_drawer_for(q); |
2752 oldDrawer = qt_mac_drawer_for(q); |
2743 } |
2753 } |
2744 if (wasWindow) { |
2754 if (wasWindow) { |
2745 oldToolbar = [oldWindow toolbar]; |
2755 oldToolbar = [oldWindow toolbar]; |
|
2756 [oldToolbar retain]; |
2746 oldToolbarVisible = [oldToolbar isVisible]; |
2757 oldToolbarVisible = [oldToolbar isVisible]; |
|
2758 [oldWindow setToolbar:nil]; |
2747 } |
2759 } |
2748 #endif |
2760 #endif |
2749 } |
2761 } |
2750 QWidget* oldtlw = q->window(); |
2762 QWidget* oldtlw = q->window(); |
2751 |
2763 |
2785 #else |
2797 #else |
2786 // Simply transfer our toolbar over. Everything should stay put, unlike in Carbon. |
2798 // Simply transfer our toolbar over. Everything should stay put, unlike in Carbon. |
2787 if (oldToolbar && !(f & Qt::FramelessWindowHint)) { |
2799 if (oldToolbar && !(f & Qt::FramelessWindowHint)) { |
2788 OSWindowRef newWindow = qt_mac_window_for(q); |
2800 OSWindowRef newWindow = qt_mac_window_for(q); |
2789 [newWindow setToolbar:oldToolbar]; |
2801 [newWindow setToolbar:oldToolbar]; |
|
2802 [oldToolbar release]; |
2790 [oldToolbar setVisible:oldToolbarVisible]; |
2803 [oldToolbar setVisible:oldToolbarVisible]; |
2791 } |
2804 } |
2792 #endif |
2805 #endif |
2793 } |
2806 } |
2794 } |
2807 } |
3669 Q_Q(QWidget); |
3682 Q_Q(QWidget); |
3670 if((q->windowType() == Qt::Desktop)) |
3683 if((q->windowType() == Qt::Desktop)) |
3671 return; |
3684 return; |
3672 |
3685 |
3673 #if QT_MAC_USE_COCOA |
3686 #if QT_MAC_USE_COCOA |
|
3687 QMacCocoaAutoReleasePool pool; |
3674 if (isRealWindow()) { |
3688 if (isRealWindow()) { |
3675 // Calling orderFront shows the window on Cocoa too. |
3689 // Calling orderFront shows the window on Cocoa too. |
3676 if (!q->testAttribute(Qt::WA_DontShowOnScreen) && q->isVisible()) { |
3690 if (!q->testAttribute(Qt::WA_DontShowOnScreen) && q->isVisible()) { |
3677 [qt_mac_window_for(q) orderFront:qt_mac_window_for(q)]; |
3691 [qt_mac_window_for(q) orderFront:qt_mac_window_for(q)]; |
3678 } |
3692 } |
4491 } |
4505 } |
4492 |
4506 |
4493 void QWidgetPrivate::deleteTLSysExtra() |
4507 void QWidgetPrivate::deleteTLSysExtra() |
4494 { |
4508 { |
4495 #ifndef QT_MAC_USE_COCOA |
4509 #ifndef QT_MAC_USE_COCOA |
4496 if(extra->topextra->group) { |
4510 if (extra->topextra->group) { |
4497 qt_mac_release_window_group(extra->topextra->group); |
4511 qt_mac_release_window_group(extra->topextra->group); |
4498 extra->topextra->group = 0; |
4512 extra->topextra->group = 0; |
|
4513 } |
|
4514 if (extra->topextra->windowIcon) { |
|
4515 ReleaseIconRef(extra->topextra->windowIcon); |
|
4516 extra->topextra->windowIcon = 0; |
4499 } |
4517 } |
4500 #endif |
4518 #endif |
4501 } |
4519 } |
4502 |
4520 |
4503 void QWidgetPrivate::updateFrameStrut() |
4521 void QWidgetPrivate::updateFrameStrut() |