From 21430066ed611aea47242c199fc3505d487da75f Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Fri, 30 Sep 2016 00:42:20 +0000 Subject: [PATCH] various cleanups, mostly win/mac leftovers and default reimplementations Signed-off-by: Ivailo Monev --- src/designer/shared/qdesigner_propertysheet.cpp | 5 - src/gui/dialogs/qfiledialog.cpp | 8 - src/gui/dialogs/qfiledialog_p.h | 41 ----- src/gui/dialogs/qprintpreviewdialog.cpp | 10 -- src/gui/dialogs/qprogressdialog.cpp | 3 - src/gui/kernel/qapplication.cpp | 19 --- src/gui/kernel/qapplication_p.h | 1 - src/gui/kernel/qapplication_x11.cpp | 37 ----- src/gui/kernel/qgesturemanager.cpp | 16 -- src/gui/kernel/qt_x11_p.h | 2 - src/gui/kernel/qtooltip.cpp | 47 +----- src/gui/kernel/qwidget.cpp | 176 +------------------- src/gui/kernel/qwidget_p.h | 2 +- src/gui/painting/qtextureglyphcache.cpp | 2 +- src/gui/painting/qwindowsurface_raster.cpp | 177 +-------------------- src/gui/painting/qwindowsurface_raster_p.h | 38 ----- src/gui/text/qtextengine.cpp | 8 +- src/gui/text/qtextlayout.cpp | 4 - src/gui/util/qcompleter.cpp | 4 - src/gui/util/qsystemtrayicon.cpp | 29 +--- src/gui/util/qsystemtrayicon_p.h | 1 - src/gui/widgets/qabstractbutton.cpp | 12 -- src/gui/widgets/qabstractbutton.h | 1 - src/gui/widgets/qbuttongroup.h | 3 +- src/gui/widgets/qdockarealayout.cpp | 4 - src/gui/widgets/qdockwidget.cpp | 6 - src/gui/widgets/qfocusframe.cpp | 5 - src/gui/widgets/qfocusframe.h | 2 - src/gui/widgets/qgroupbox.cpp | 7 - src/gui/widgets/qgroupbox.h | 1 - src/gui/widgets/qlcdnumber.h | 2 - src/gui/widgets/qmainwindow.cpp | 107 +------------ src/gui/widgets/qmainwindow.h | 6 - src/gui/widgets/qmainwindowlayout.cpp | 175 ++++---------------- src/gui/widgets/qmainwindowlayout_p.h | 1 - src/gui/widgets/qmenu.cpp | 4 - src/gui/widgets/qpushbutton.cpp | 32 ---- src/gui/widgets/qrubberband.cpp | 28 ---- src/gui/widgets/qrubberband.h | 6 - src/gui/widgets/qscrollbar.cpp | 6 - src/gui/widgets/qscrollbar.h | 1 - src/gui/widgets/qsizegrip.cpp | 96 +---------- src/gui/widgets/qsizegrip.h | 9 -- src/gui/widgets/qstatusbar.cpp | 50 +----- src/gui/widgets/qstatusbar.h | 1 - src/gui/widgets/qtabbar.cpp | 65 +------- src/gui/widgets/qtabbar.h | 1 - src/gui/widgets/qtabbar_p.h | 1 - src/gui/widgets/qtextbrowser.cpp | 30 ---- src/gui/widgets/qtextbrowser.h | 4 - src/gui/widgets/qtoolbararealayout.cpp | 8 +- src/gui/widgets/qtoolbarlayout.cpp | 26 --- src/gui/widgets/qtoolbox.cpp | 6 - src/gui/widgets/qtoolbox.h | 1 - .../debugging/qscriptenginedebugger.cpp | 1 - src/test/qtestcase.cpp | 72 ++------- src/test/qtestmouse.h | 4 - src/tools/designer/qdesigner_workbench.cpp | 5 - 58 files changed, 66 insertions(+), 1353 deletions(-) diff --git a/src/designer/shared/qdesigner_propertysheet.cpp b/src/designer/shared/qdesigner_propertysheet.cpp index 0aa8ab8e0..3e28ca037 100644 --- a/src/designer/shared/qdesigner_propertysheet.cpp +++ b/src/designer/shared/qdesigner_propertysheet.cpp @@ -632,11 +632,6 @@ QDesignerPropertySheet::QDesignerPropertySheet(QObject *object, QObject *parent) if (d->m_objectType == ObjectLabel) createFakeProperty(QLatin1String("buddy"), QVariant(QByteArray())); - /* We need to create a fake property since the property does not work - * for non-toplevel windows or on other systems than Mac and only if - * it is above a certain Mac OS version. */ - if (qobject_cast(d->m_object)) - createFakeProperty(QLatin1String("unifiedTitleAndToolBarOnMac"), false); } if (qobject_cast(object)) { diff --git a/src/gui/dialogs/qfiledialog.cpp b/src/gui/dialogs/qfiledialog.cpp index 1e9ef29be..624ca5d11 100644 --- a/src/gui/dialogs/qfiledialog.cpp +++ b/src/gui/dialogs/qfiledialog.cpp @@ -531,14 +531,6 @@ QFileDialogPrivate::QFileDialogPrivate() defaultFileTypes(true), fileNameLabelExplicitlySat(false), nativeDialogInUse(false), -#ifdef Q_WS_MAC - mDelegate(0), -#ifndef QT_MAC_USE_COCOA - mDialog(0), - mDialogStarted(false), - mDialogClosed(true), -#endif -#endif qFileDialogUi(0) { } diff --git a/src/gui/dialogs/qfiledialog_p.h b/src/gui/dialogs/qfiledialog_p.h index 96ac4a2f3..9dd4059e8 100644 --- a/src/gui/dialogs/qfiledialog_p.h +++ b/src/gui/dialogs/qfiledialog_p.h @@ -245,47 +245,6 @@ public: QString selectedNameFilter_sys() const; ////////////////////////////////////////////// -#if defined(Q_WS_MAC) - void *mDelegate; -#ifndef QT_MAC_USE_COCOA - NavDialogRef mDialog; - bool mDialogStarted; - bool mDialogClosed; - QString mCurrentLocation; - QString mCurrentSelection; - QStringList mCurrentSelectionList; - - struct QtMacFilterName { - QString description; - QString regexp; - QString filter; - }; - struct QtMacNavFilterInfo { - QtMacNavFilterInfo() : currentSelection(-1) {} - int currentSelection; - QList filters; - } filterInfo; - - static void qt_mac_filedialog_event_proc(const NavEventCallbackMessage msg, NavCBRecPtr p, - NavCallBackUserData data); - static Boolean qt_mac_filedialog_filter_proc(AEDesc *theItem, void *info, void *data, - NavFilterModes); - bool showCarbonNavServicesDialog(); - bool hideCarbonNavServicesDialog(); - void createNavServicesDialog(); -#else - bool showCocoaFilePanel(); - bool hideCocoaFilePanel(); -#endif - void createNSOpenSavePanelDelegate(); - void QNSOpenSavePanelDelegate_selectionChanged(const QString &newPath); - void QNSOpenSavePanelDelegate_panelClosed(bool accepted); - void QNSOpenSavePanelDelegate_directoryEntered(const QString &newDir); - void QNSOpenSavePanelDelegate_filterSelected(int menuIndex); - void _q_macRunNativeAppModalPanel(); - void mac_nativeDialogModalHelp(); -#endif - QScopedPointer qFileDialogUi; QString acceptLabel; diff --git a/src/gui/dialogs/qprintpreviewdialog.cpp b/src/gui/dialogs/qprintpreviewdialog.cpp index 8e50881cd..a236509a5 100644 --- a/src/gui/dialogs/qprintpreviewdialog.cpp +++ b/src/gui/dialogs/qprintpreviewdialog.cpp @@ -207,9 +207,6 @@ public: QActionGroup *printerGroup; QAction *printAction; QAction *pageSetupAction; -#if defined(Q_WS_MAC) && !defined(QT_MAC_USE_COCOA) - QAction *closeAction; -#endif QPointer receiverToDisconnectOnClose; QByteArray memberToDisconnectOnClose; @@ -303,9 +300,6 @@ void QPrintPreviewDialogPrivate::init(QPrinter *_printer) toolbar->addSeparator(); toolbar->addAction(pageSetupAction); toolbar->addAction(printAction); -#if defined(Q_WS_MAC) && !defined(QT_MAC_USE_COCOA) - toolbar->addAction(closeAction); -#endif // Cannot use the actions' triggered signal here, since it doesn't autorepeat QToolButton *zoomInButton = static_cast(toolbar->widgetForAction(zoomInAction)); @@ -425,10 +419,6 @@ void QPrintPreviewDialogPrivate::setupActions() qt_setupActionIcon(pageSetupAction, QLatin1String("page-setup")); QObject::connect(printAction, SIGNAL(triggered(bool)), q, SLOT(_q_print())); QObject::connect(pageSetupAction, SIGNAL(triggered(bool)), q, SLOT(_q_pageSetup())); -#if defined(Q_WS_MAC) && !defined(QT_MAC_USE_COCOA) - closeAction = printerGroup->addAction(QCoreApplication::translate("QPrintPreviewDialog", "Close")); - QObject::connect(closeAction, SIGNAL(triggered(bool)), q, SLOT(reject())); -#endif // Initial state: fitPageAction->setChecked(true); diff --git a/src/gui/dialogs/qprogressdialog.cpp b/src/gui/dialogs/qprogressdialog.cpp index 27058ba5d..8279faa9a 100644 --- a/src/gui/dialogs/qprogressdialog.cpp +++ b/src/gui/dialogs/qprogressdialog.cpp @@ -679,9 +679,6 @@ void QProgressDialog::setValue(int progress) d->shown_once = true; } } -#ifdef Q_WS_MAC - QApplication::flush(); -#endif } if (progress == d->bar->maximum() && d->autoReset) diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index f3c4058e1..73d41d48f 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -1336,7 +1336,6 @@ void QApplication::setStyle(QStyle *style) if (QApplicationPrivate::set_pal) { QApplication::setPalette(*QApplicationPrivate::set_pal); } else if (QApplicationPrivate::sys_pal) { - QApplicationPrivate::initializeWidgetPaletteHash(); QApplicationPrivate::setPalette_helper(*QApplicationPrivate::sys_pal, /*className=*/0, /*clearWidgetPaletteHash=*/false); } else if (!QApplicationPrivate::sys_pal) { // Initialize the sys_pal if it hasn't happened yet... @@ -4044,24 +4043,6 @@ bool QApplication::notify(QObject *receiver, QEvent *e) break; } #endif // QT_NO_GESTURES -#ifdef QT_MAC_USE_COCOA - case QEvent::Enter: - if (receiver->isWidgetType()) { - QWidget *w = static_cast(receiver); - if (w->testAttribute(Qt::WA_AcceptTouchEvents)) - qt_widget_private(w)->registerTouchWindow(true); - } - res = d->notify_helper(receiver, e); - break; - case QEvent::Leave: - if (receiver->isWidgetType()) { - QWidget *w = static_cast(receiver); - if (w->testAttribute(Qt::WA_AcceptTouchEvents)) - qt_widget_private(w)->registerTouchWindow(false); - } - res = d->notify_helper(receiver, e); - break; -#endif default: res = d->notify_helper(receiver, e); break; diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h index 865d95b88..97c2ade8c 100644 --- a/src/gui/kernel/qapplication_p.h +++ b/src/gui/kernel/qapplication_p.h @@ -284,7 +284,6 @@ public: static void setSystemPalette(const QPalette &pal); static void setPalette_helper(const QPalette &palette, const char* className, bool clearWidgetPaletteHash); - static void initializeWidgetPaletteHash(); static void setSystemFont(const QFont &font); #if defined(Q_WS_X11) diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp index fcf6ec2e5..c5af5fa5e 100644 --- a/src/gui/kernel/qapplication_x11.cpp +++ b/src/gui/kernel/qapplication_x11.cpp @@ -206,7 +206,6 @@ static const char * x11_atomnames = { "DTWM_IS_RUNNING\0" "ENLIGHTENMENT_DESKTOP\0" "_DT_SAVE_MODE\0" - "_SGI_DESKS_MANAGER\0" // EWMH (aka NETWM) "_NET_SUPPORTED\0" @@ -2343,38 +2342,6 @@ void qt_init(QApplicationPrivate *priv, int, X11->desktopEnvironment = DE_CDE; break; } - - rc = XGetWindowProperty(X11->display, QX11Info::appRootWindow(), - ATOM(_SGI_DESKS_MANAGER), 0, 1, False, XA_WINDOW, - &type, &format, &length, &after, &data); - if (rc == Success && length) { - X11->desktopEnvironment = DE_4DWM; - break; - } - - if (XGetWindowProperty(X11->display, QX11Info::appRootWindow(), - ATOM(_NET_SUPPORTING_WM_CHECK), - 0, 1024, False, XA_WINDOW, &type, - &format, &length, &after, &data) == Success) { - if (type == XA_WINDOW && format == 32) { - Window windowManagerWindow = *((Window*) data); - XFree(data); - data = 0; - - if (windowManagerWindow != XNone) { - Atom utf8atom = ATOM(UTF8_STRING); - if (XGetWindowProperty(QX11Info::display(), windowManagerWindow, ATOM(_NET_WM_NAME), - 0, 1024, False, utf8atom, &type, - &format, &length, &after, &data) == Success) { - if (type == utf8atom && format == 8) { - if (qstrcmp((const char *)data, "MCompositor") == 0) - X11->desktopEnvironment = DE_MEEGO_COMPOSITOR; - } - } - } - } - } - } while(0); if (data) @@ -2645,10 +2612,6 @@ void qt_init(QApplicationPrivate *priv, int, #endif } -void QApplicationPrivate::initializeWidgetPaletteHash() -{ -} - /***************************************************************************** qt_cleanup() - cleans up when the application is finished *****************************************************************************/ diff --git a/src/gui/kernel/qgesturemanager.cpp b/src/gui/kernel/qgesturemanager.cpp index acd3a3325..0ea57cc93 100644 --- a/src/gui/kernel/qgesturemanager.cpp +++ b/src/gui/kernel/qgesturemanager.cpp @@ -74,27 +74,11 @@ QGestureManager::QGestureManager(QObject *parent) : QObject(parent), state(NotGesture), m_lastCustomGestureId(Qt::CustomGesture) { qRegisterMetaType(); - -#if defined(Q_WS_MAC) - registerGestureRecognizer(new QMacSwipeGestureRecognizer); - registerGestureRecognizer(new QMacPinchGestureRecognizer); - #if defined(QT_MAC_USE_COCOA) - registerGestureRecognizer(new QMacPanGestureRecognizer); - #endif -#else registerGestureRecognizer(new QPanGestureRecognizer); registerGestureRecognizer(new QPinchGestureRecognizer); registerGestureRecognizer(new QSwipeGestureRecognizer); registerGestureRecognizer(new QTapGestureRecognizer); -#endif -#if defined(Q_OS_WIN) - #if !defined(QT_NO_NATIVE_GESTURES) - if (QApplicationPrivate::HasTouchSupport) - registerGestureRecognizer(new QWinNativePanGestureRecognizer); - #endif -#else registerGestureRecognizer(new QTapAndHoldGestureRecognizer); -#endif } QGestureManager::~QGestureManager() diff --git a/src/gui/kernel/qt_x11_p.h b/src/gui/kernel/qt_x11_p.h index 30e4e194c..c7d7ab072 100644 --- a/src/gui/kernel/qt_x11_p.h +++ b/src/gui/kernel/qt_x11_p.h @@ -340,7 +340,6 @@ enum DesktopEnvironment { DE_KDE, DE_GNOME, DE_CDE, - DE_MEEGO_COMPOSITOR, DE_4DWM }; @@ -577,7 +576,6 @@ struct QX11Data DTWM_IS_RUNNING, ENLIGHTENMENT_DESKTOP, _DT_SAVE_MODE, - _SGI_DESKS_MANAGER, // EWMH (aka NETWM) _NET_SUPPORTED, diff --git a/src/gui/kernel/qtooltip.cpp b/src/gui/kernel/qtooltip.cpp index d45856544..3e33d0826 100644 --- a/src/gui/kernel/qtooltip.cpp +++ b/src/gui/kernel/qtooltip.cpp @@ -286,38 +286,13 @@ void QTipLabel::timerEvent(QTimerEvent *e) || e->timerId() == expireTimer.timerId()){ hideTimer.stop(); expireTimer.stop(); -#if defined(Q_WS_MAC) && !defined(QT_NO_EFFECTS) - if (QApplication::isEffectEnabled(Qt::UI_FadeTooltip)){ - // Fade out tip on mac (makes it invisible). - // The tip will not be deleted until a new tip is shown. - - // DRSWAT - Cocoa - macWindowFade(qt_mac_window_for(this)); - QTipLabel::instance->fadingOut = true; // will never be false again. - } - else - hideTipImmediately(); -#else hideTipImmediately(); -#endif } } bool QTipLabel::eventFilter(QObject *o, QEvent *e) { switch (e->type()) { -#ifdef Q_WS_MAC - case QEvent::KeyPress: - case QEvent::KeyRelease: { - int key = static_cast(e)->key(); - Qt::KeyboardModifiers mody = static_cast(e)->modifiers(); - if (!(mody & Qt::KeyboardModifierMask) - && key != Qt::Key_Shift && key != Qt::Key_Control - && key != Qt::Key_Alt && key != Qt::Key_Meta) - hideTip(); - break; - } -#endif case QEvent::Leave: hideTip(); break; @@ -367,21 +342,7 @@ void QTipLabel::placeTip(const QPoint &pos, QWidget *w) } #endif //QT_NO_STYLE_STYLESHEET - -#ifdef Q_WS_MAC - // When in full screen mode, there is no Dock nor Menu so we can use - // the whole screen for displaying the tooltip. However when not in - // full screen mode we need to save space for the dock, so we use - // availableGeometry instead. - extern bool qt_mac_app_fullscreen; //qapplication_mac.mm - QRect screen; - if(qt_mac_app_fullscreen) - screen = QApplication::desktop()->screenGeometry(getTipScreen(pos, w)); - else - screen = QApplication::desktop()->availableGeometry(getTipScreen(pos, w)); -#else - QRect screen = QApplication::desktop()->screenGeometry(getTipScreen(pos, w)); -#endif + const QRect screen = QApplication::desktop()->screenGeometry(getTipScreen(pos, w)); QPoint p = pos; p += QPoint(2, @@ -462,13 +423,7 @@ void QToolTip::showText(const QPoint &pos, const QString &text, QWidget *w, cons } if (!text.isEmpty()){ // no tip can be reused, create new tip: -#ifndef Q_WS_WIN new QTipLabel(text, w); // sets QTipLabel::instance to itself -#else - // On windows, we can't use the widget as parent otherwise the window will be - // raised when the tooltip will be shown - new QTipLabel(text, QApplication::desktop()->screen(QTipLabel::getTipScreen(pos, w))); -#endif QTipLabel::instance->setTipRect(w, rect); QTipLabel::instance->placeTip(pos, w); QTipLabel::instance->setObjectName(QLatin1String("qtooltip_label")); diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 2bd27e881..64e2f9a5f 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -251,16 +251,6 @@ QWidgetPrivate::QWidgetPrivate(int version) isWidget = true; memset(high_attributes, 0, sizeof(high_attributes)); -#ifdef QT_MAC_USE_COCOA - drawRectOriginalAdded = false; - originalDrawMethod = true; - changeMethods = false; - isInUnifiedToolbar = false; - unifiedSurface = 0; - toolbar_ancestor = 0; - flushRequested = false; - touchEventsEnabled = false; -#endif // QT_MAC_USE_COCOA #ifdef QWIDGET_EXTRA_DEBUG static int count = 0; qDebug() << "widgets" << ++count; @@ -1473,15 +1463,6 @@ QWidget::~QWidget() d->blockSig = blocked; -#ifdef QT_MAC_USE_COCOA - // QCocoaView holds a pointer back to this widget. Clear it now - // to make sure it's not followed later on. The lifetime of the - // QCocoaView might exceed the lifetime of this widget in cases - // where Cocoa itself holds references to it. - extern void qt_mac_clearCocoaViewQWidgetPointers(QWidget *); - qt_mac_clearCocoaViewQWidgetPointers(this); -#endif - if (!d->children.isEmpty()) d->deleteChildren(); @@ -1562,9 +1543,7 @@ void QWidgetPrivate::createTLExtra() x->inTopLevelResize = false; x->inRepaint = false; x->embedded = 0; -#if defined(Q_WS_MAC) && defined(QT_MAC_USE_COCOA) - x->wasMaximized = false; -#endif // Q_WS_MAC && QT_MAC_USE_COCOA + createTLSysExtra(); #ifdef QWIDGET_EXTRA_DEBUG static int count = 0; @@ -1911,11 +1890,6 @@ void QWidgetPrivate::subtractOpaqueSiblings(QRegion &sourceRegion, bool *hasDirt if (disableSubtractOpaqueSiblings || q->isWindow()) return; -#ifdef QT_MAC_USE_COCOA - if (q->d_func()->isInUnifiedToolbar) - return; -#endif // QT_MAC_USE_COCOA - QRect clipBoundingRect; bool dirtyClipBoundingRect = true; @@ -2829,15 +2803,6 @@ bool QWidget::isFullScreen() const */ void QWidget::showFullScreen() { -#ifdef Q_WS_MAC - // If the unified toolbar is enabled, we have to disable it before going fullscreen. - QMainWindow *mainWindow = qobject_cast(this); - if (mainWindow && mainWindow->unifiedTitleAndToolBarOnMac()) { - mainWindow->setUnifiedTitleAndToolBarOnMac(false); - QMainWindowLayout *mainLayout = qobject_cast(mainWindow->layout()); - mainLayout->activateUnifiedToolbarAfterFullScreen = true; - } -#endif // Q_WS_MAC ensurePolished(); setWindowState((windowState() & ~(Qt::WindowMinimized | Qt::WindowMaximized)) @@ -2862,18 +2827,6 @@ void QWidget::showMaximized() setWindowState((windowState() & ~(Qt::WindowMinimized | Qt::WindowFullScreen)) | Qt::WindowMaximized); -#ifdef Q_WS_MAC - // If the unified toolbar was enabled before going fullscreen, we have to enable it back. - QMainWindow *mainWindow = qobject_cast(this); - if (mainWindow) - { - QMainWindowLayout *mainLayout = qobject_cast(mainWindow->layout()); - if (mainLayout->activateUnifiedToolbarAfterFullScreen) { - mainWindow->setUnifiedTitleAndToolBarOnMac(true); - mainLayout->activateUnifiedToolbarAfterFullScreen = false; - } - } -#endif // Q_WS_MAC show(); } @@ -2891,18 +2844,6 @@ void QWidget::showNormal() setWindowState(windowState() & ~(Qt::WindowMinimized | Qt::WindowMaximized | Qt::WindowFullScreen)); -#ifdef Q_WS_MAC - // If the unified toolbar was enabled before going fullscreen, we have to enable it back. - QMainWindow *mainWindow = qobject_cast(this); - if (mainWindow) - { - QMainWindowLayout *mainLayout = qobject_cast(mainWindow->layout()); - if (mainLayout->activateUnifiedToolbarAfterFullScreen) { - mainWindow->setUnifiedTitleAndToolBarOnMac(true); - mainLayout->activateUnifiedToolbarAfterFullScreen = false; - } - } -#endif // Q_WS_MAC show(); } @@ -5002,19 +4943,8 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP if (rgn.isEmpty()) return; -#if defined(Q_WS_MAC) && defined(QT_MAC_USE_COCOA) - if (qt_mac_clearDirtyOnWidgetInsideDrawWidget) - dirtyOnWidget = QRegion(); - - // We disable the rendering of QToolBar in the backingStore if - // it's supposed to be in the unified toolbar on Mac OS X. - if (backingStore && isInUnifiedToolbar) - return; -#endif // Q_WS_MAC && QT_MAC_USE_COCOA - - Q_Q(QWidget); -#if !defined(QT_NO_GRAPHICSEFFECT) && !defined(Q_WS_MAC) +#if !defined(QT_NO_GRAPHICSEFFECT) if (graphicsEffect && graphicsEffect->isEnabled()) { QGraphicsEffectSource *source = graphicsEffect->d_func()->source; QWidgetEffectSourcePrivate *sourced = static_cast @@ -6502,18 +6432,6 @@ void QWidget::setGeometry(const QRect &r) */ QByteArray QWidget::saveGeometry() const { -#ifdef QT_MAC_USE_COCOA - // We check if the window was maximized during this invocation. If so, we need to record the - // starting position as 0,0. - Q_D(const QWidget); - QRect newFramePosition = frameGeometry(); - QRect newNormalPosition = normalGeometry(); - if(d->topData()->wasMaximized && !(windowState() & Qt::WindowMaximized)) { - // Change the starting position - newFramePosition.moveTo(0, 0); - newNormalPosition.moveTo(0, 0); - } -#endif // QT_MAC_USE_COCOA QByteArray array; QDataStream stream(&array, QIODevice::WriteOnly); stream.setVersion(QDataStream::Qt_4_0); @@ -6523,13 +6441,8 @@ QByteArray QWidget::saveGeometry() const stream << magicNumber << majorVersion << minorVersion -#ifdef QT_MAC_USE_COCOA - << newFramePosition - << newNormalPosition -#else << frameGeometry() << normalGeometry() -#endif // QT_MAC_USE_COCOA << qint32(QApplication::desktop()->screenNumber(this)) << quint8(windowState() & Qt::WindowMaximized) << quint8(windowState() & Qt::WindowFullScreen); @@ -7369,23 +7282,6 @@ void QWidgetPrivate::hideChildren(bool spontaneous) QWidget *widget = qobject_cast(childList.at(i)); if (!widget || widget->isWindow() || widget->testAttribute(Qt::WA_WState_Hidden)) continue; -#ifdef QT_MAC_USE_COCOA - // Before doing anything we need to make sure that we don't leave anything in a non-consistent state. - // When hiding a widget we need to make sure that no mouse_down events are active, because - // the mouse_up event will never be received by a hidden widget or one of its descendants. - // The solution is simple, before going through with this we check if there are any mouse_down events in - // progress, if so we check if it is related to this widget or not. If so, we just reset the mouse_down and - // then we continue. - // In X11 and Windows we send a mouse_release event, however we don't do that here because we were already - // ignoring that from before. I.e. Carbon did not send the mouse release event, so we will not send the - // mouse release event. There are two ways to interpret this: - // 1. If we don't send the mouse release event, the widget might get into an inconsistent state, i.e. it - // might be waiting for a release event that will never arrive. - // 2. If we send the mouse release event, then the widget might decide to trigger an action that is not - // supposed to trigger because it is not visible. - if(widget == qt_button_down) - qt_button_down = 0; -#endif // QT_MAC_USE_COCOA if (spontaneous) widget->setAttribute(Qt::WA_Mapped, false); else @@ -7403,7 +7299,7 @@ void QWidgetPrivate::hideChildren(bool spontaneous) widget->d_func()->hide_sys(); } } -#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined(Q_WS_MAC) +#if defined(Q_WS_X11) qApp->d_func()->sendSyntheticEnterLeave(widget); #endif #ifndef QT_NO_ACCESSIBILITY @@ -9376,26 +9272,13 @@ QWidget *QWidgetPrivate::childAt_helper(const QPoint &p, bool ignoreChildrenInDe if (children.isEmpty()) return 0; -#ifdef Q_WS_MAC - Q_Q(const QWidget); - // Unified tool bars on the Mac require special handling since they live outside - // QMainWindow's geometry(). See commit: 35667fd45ada49269a5987c235fdedfc43e92bb8 - bool includeFrame = q->isWindow() && qobject_cast(q) - && static_cast(q)->unifiedTitleAndToolBarOnMac(); - if (includeFrame) - return childAtRecursiveHelper(p, ignoreChildrenInDestructor, includeFrame); -#endif - if (!pointInsideRectAndMask(p)) return 0; return childAtRecursiveHelper(p, ignoreChildrenInDestructor); } -QWidget *QWidgetPrivate::childAtRecursiveHelper(const QPoint &p, bool ignoreChildrenInDestructor, bool includeFrame) const +QWidget *QWidgetPrivate::childAtRecursiveHelper(const QPoint &p, bool ignoreChildrenInDestructor) const { -#ifndef Q_WS_MAC - Q_UNUSED(includeFrame); -#endif for (int i = children.size() - 1; i >= 0; --i) { QWidget *child = qobject_cast(children.at(i)); if (!child || child->isWindow() || child->isHidden() || child->testAttribute(Qt::WA_TransparentForMouseEvents) @@ -9405,14 +9288,6 @@ QWidget *QWidgetPrivate::childAtRecursiveHelper(const QPoint &p, bool ignoreChil // Map the point 'p' from parent coordinates to child coordinates. QPoint childPoint = p; -#if defined(Q_WS_MAC) && defined(QT_MAC_USE_COCOA) - // 'includeFrame' is true if the child's parent is a top-level QMainWindow with an unified tool bar. - // An unified tool bar on the Mac lives outside QMainWindow's geometry(), so a normal - // QWidget::mapFromParent won't do the trick. - if (includeFrame && qobject_cast(child) && qt_widget_private(child)->isInUnifiedToolbar) - childPoint = qt_mac_nativeMapFromParent(child, p); - else -#endif childPoint -= child->data->crect.topLeft(); // Check if the point hits the child. @@ -9582,15 +9457,9 @@ void QWidget::setParent(QWidget *parent, Qt::WindowFlags f) desktopWidget = parent; bool newParent = (parent != parentWidget()) || !wasCreated || desktopWidget; -#if defined(Q_WS_X11) || defined(Q_WS_WIN) || defined(Q_WS_MAC) +#if defined(Q_WS_X11) if (newParent && parent && !desktopWidget) { - if (testAttribute(Qt::WA_NativeWindow) && !qApp->testAttribute(Qt::AA_DontCreateNativeWidgetSiblings) -#if defined(Q_WS_MAC) && defined(QT_MAC_USE_COCOA) - // On Mac, toolbars inside the unified title bar will never overlap with - // siblings in the content view. So we skip enforce native siblings in that case - && !d->isInUnifiedToolbar && parentWidget() && parentWidget()->isWindow() -#endif // Q_WS_MAC && QT_MAC_USE_COCOA - ) + if (testAttribute(Qt::WA_NativeWindow) && !qApp->testAttribute(Qt::AA_DontCreateNativeWidgetSiblings)) parent->d_func()->enforceNativeChildren(); else if (parent->d_func()->nativeChildrenForced() || parent->testAttribute(Qt::WA_PaintOnScreen)) setAttribute(Qt::WA_NativeWindow); @@ -10145,13 +10014,7 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on) ic->setFocusWidget(0); } } - if (!qApp->testAttribute(Qt::AA_DontCreateNativeWidgetSiblings) && parentWidget() -#if defined(Q_WS_MAC) && defined(QT_MAC_USE_COCOA) - // On Mac, toolbars inside the unified title bar will never overlap with - // siblings in the content view. So we skip enforce native siblings in that case - && !d->isInUnifiedToolbar && parentWidget()->isWindow() -#endif // Q_WS_MAC && QT_MAC_USE_COCOA - ) + if (!qApp->testAttribute(Qt::AA_DontCreateNativeWidgetSiblings) && parentWidget()) parentWidget()->d_func()->enforceNativeChildren(); if (on && !internalWinId() && testAttribute(Qt::WA_WState_Created)) d->createWinId(); @@ -11861,10 +11724,8 @@ void QWidget::setMask(const QRegion &newMask) d->extra->mask = newMask; d->extra->hasMask = !newMask.isEmpty(); -#ifndef QT_MAC_USE_COCOA if (!testAttribute(Qt::WA_WState_Created)) return; -#endif d->setMask_sys(newMask); @@ -11957,29 +11818,6 @@ void QWidget::clearMask() handle could not be created. */ - -#ifdef QT_MAC_USE_COCOA -void QWidgetPrivate::syncUnifiedMode() { - // The whole purpose of this method is to keep the unifiedToolbar in sync. - // That means making sure we either exchange the drawing methods or we let - // the toolbar know that it does not require to draw the baseline. - Q_Q(QWidget); - // This function makes sense only if this is a top level - if(!q->isWindow()) - return; - OSWindowRef window = qt_mac_window_for(q); - if(changeMethods) { - // Ok, we are in documentMode. - if(originalDrawMethod) - qt_mac_replaceDrawRect(window, this); - } else { - if(!originalDrawMethod) - qt_mac_replaceDrawRectOriginal(window, this); - } -} - -#endif // QT_MAC_USE_COCOA - QT_END_NAMESPACE #include "moc_qwidget.h" diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h index e22e4bfbf..30351e8e3 100644 --- a/src/gui/kernel/qwidget_p.h +++ b/src/gui/kernel/qwidget_p.h @@ -443,7 +443,7 @@ public: void setConstraints_sys(); bool pointInsideRectAndMask(const QPoint &) const; QWidget *childAt_helper(const QPoint &, bool) const; - QWidget *childAtRecursiveHelper(const QPoint &p, bool, bool includeFrame = false) const; + QWidget *childAtRecursiveHelper(const QPoint &p, bool) const; void updateGeometry_helper(bool forceUpdate); void getLayoutItemMargins(int *left, int *top, int *right, int *bottom) const; diff --git a/src/gui/painting/qtextureglyphcache.cpp b/src/gui/painting/qtextureglyphcache.cpp index 814fe5e47..b4b77c7c8 100644 --- a/src/gui/painting/qtextureglyphcache.cpp +++ b/src/gui/painting/qtextureglyphcache.cpp @@ -364,7 +364,7 @@ void QImageTextureGlyphCache::createTextureData(int width, int height) int QImageTextureGlyphCache::glyphMargin() const { -#if (defined(Q_WS_MAC) && defined(QT_MAC_USE_COCOA)) || defined(Q_WS_X11) +#if defined(Q_WS_X11) return 0; #else return m_type == QFontEngineGlyphCache::Raster_RGBMask ? 2 : 0; diff --git a/src/gui/painting/qwindowsurface_raster.cpp b/src/gui/painting/qwindowsurface_raster.cpp index 8df183e2f..b8f9b4e7f 100644 --- a/src/gui/painting/qwindowsurface_raster.cpp +++ b/src/gui/painting/qwindowsurface_raster.cpp @@ -40,15 +40,8 @@ ****************************************************************************/ #include - -#include // for Q_WS_WIN define (non-PCH) -#ifdef Q_WS_WIN -#include -#include -#endif - -#include -#include +#include +#include #include "qwindowsurface_raster_p.h" #include "qimage.h" @@ -62,13 +55,6 @@ #endif #include "qdrawhelper_p.h" -#ifdef Q_WS_MAC -#include -#include -#include -#include -#endif - QT_BEGIN_NAMESPACE class QRasterWindowSurfacePrivate @@ -103,11 +89,6 @@ QRasterWindowSurface::QRasterWindowSurface(QWidget *window, bool setDefaultSurfa #endif d_ptr->image = 0; d_ptr->inSetGeometry = false; - -#ifdef QT_MAC_USE_COCOA - needsFlush = false; - regionToFlush = QRegion(); -#endif // QT_MAC_USE_COCOA } @@ -142,12 +123,8 @@ void QRasterWindowSurface::beginPaint(const QRegion &rgn) syncX(); #endif -#if (defined(Q_WS_X11) && !defined(QT_NO_XRENDER)) || (defined(Q_WS_WIN) && !defined(Q_WS_WINCE)) +#if defined(Q_WS_X11) && !defined(QT_NO_XRENDER) if (!qt_widget_private(window())->isOpaque && window()->testAttribute(Qt::WA_TranslucentBackground)) { -#if defined(Q_WS_WIN) && !defined(Q_WS_WINCE) - if (d_ptr->image->format() != QImage::Format_ARGB32_Premultiplied) - prepareBuffer(QImage::Format_ARGB32_Premultiplied, window()); -#endif QPainter p(d_ptr->image); p.setCompositionMode(QPainter::CompositionMode_Source); const QVector rects = rgn.rects(); @@ -170,51 +147,6 @@ void QRasterWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoi if (!d->image || rgn.rectCount() == 0) return; -#ifdef Q_WS_WIN - QRect br = rgn.boundingRect(); - -#ifndef Q_WS_WINCE - if (!qt_widget_private(window())->isOpaque - && window()->testAttribute(Qt::WA_TranslucentBackground) - && (qt_widget_private(window())->data.window_flags & Qt::FramelessWindowHint)) - { - QRect r = window()->frameGeometry(); - QPoint frameOffset = qt_widget_private(window())->frameStrut().topLeft(); - QRect dirtyRect = br.translated(offset + frameOffset); - - SIZE size = {r.width(), r.height()}; - POINT ptDst = {r.x(), r.y()}; - POINT ptSrc = {0, 0}; - BLENDFUNCTION blend = {AC_SRC_OVER, 0, (BYTE)(255.0 * window()->windowOpacity()), Q_AC_SRC_ALPHA}; - RECT dirty = {dirtyRect.x(), dirtyRect.y(), - dirtyRect.x() + dirtyRect.width(), dirtyRect.y() + dirtyRect.height()}; - Q_UPDATELAYEREDWINDOWINFO info = {sizeof(info), NULL, &ptDst, &size, d->image->hdc, &ptSrc, 0, &blend, Q_ULW_ALPHA, &dirty}; - ptrUpdateLayeredWindowIndirect(window()->internalWinId(), &info); - } else -#endif - { - QPoint wOffset = qt_qwidget_data(widget)->wrect.topLeft(); - - HDC widget_dc = widget->getDC(); - - QRect wbr = br.translated(-wOffset); - BitBlt(widget_dc, wbr.x(), wbr.y(), wbr.width(), wbr.height(), - d->image->hdc, br.x() + offset.x(), br.y() + offset.y(), SRCCOPY); - widget->releaseDC(widget_dc); - } - -#ifndef QT_NO_DEBUG - static bool flush = !qgetenv("QT_FLUSH_WINDOWSURFACE").isEmpty(); - if (flush) { - SelectObject(qt_win_display_dc(), GetStockObject(BLACK_BRUSH)); - Rectangle(qt_win_display_dc(), 0, 0, d->image->width() + 2, d->image->height() + 2); - BitBlt(qt_win_display_dc(), 1, 1, d->image->width(), d->image->height(), - d->image->hdc, 0, 0, SRCCOPY); - } -#endif - -#endif - #ifdef Q_WS_X11 extern void *qt_getClipRects(const QRegion &r, int &num); // in qpaintengine_x11.cpp QPoint wOffset = qt_qwidget_data(widget)->wrect.topLeft(); @@ -260,63 +192,6 @@ void QRasterWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoi if (wrgn.rectCount() != 1) XSetClipMask(X11->display, d_ptr->gc, XNone); #endif // Q_WS_X11 - -#ifdef Q_WS_MAC - - Q_UNUSED(offset); - - // This is mainly done for native components like native "open file" dialog. - if (widget->testAttribute(Qt::WA_DontShowOnScreen)) { - return; - } - -#ifdef QT_MAC_USE_COCOA - - this->needsFlush = true; - this->regionToFlush += rgn; - - // The actual flushing will be processed in [view drawRect:rect] - qt_mac_setNeedsDisplay(widget); - -#else - // Get a context for the widget. - CGContextRef context; - CGrafPtr port = GetWindowPort(qt_mac_window_for(widget)); - QDBeginCGContext(port, &context); - CGContextRetain(context); - CGContextSaveGState(context); - - // Flip context. - CGContextTranslateCTM(context, 0, widget->height()); - CGContextScaleCTM(context, 1, -1); - - // Clip to region. - const QVector &rects = rgn.rects(); - for (int i = 0; i < rects.size(); ++i) { - const QRect &rect = rects.at(i); - CGContextAddRect(context, CGRectMake(rect.x(), rect.y(), rect.width(), rect.height())); - } - CGContextClip(context); - - QRect r = rgn.boundingRect().intersected(d->image->rect()); - const CGRect area = CGRectMake(r.x(), r.y(), r.width(), r.height()); - CGImageRef image = CGBitmapContextCreateImage(d->image->cg); - CGImageRef subImage = CGImageCreateWithImageInRect(image, area); - - qt_mac_drawCGImage(context, &area, subImage); - - CGImageRelease(subImage); - CGImageRelease(image); - - QDEndCGContext(port, &context); - - // Restore context. - CGContextRestoreGState(context); - CGContextRelease(context); -#endif // QT_MAC_USE_COCOA - -#endif // Q_WS_MAC - } void QRasterWindowSurface::setGeometry(const QRect &rect) @@ -325,37 +200,14 @@ void QRasterWindowSurface::setGeometry(const QRect &rect) Q_D(QRasterWindowSurface); d->inSetGeometry = true; if (d->image == 0 || d->image->width() < rect.width() || d->image->height() < rect.height()) { -#if (defined(Q_WS_X11) && !defined(QT_NO_XRENDER)) || (defined(Q_WS_WIN) && !defined(Q_WS_WINCE)) -#ifndef Q_WS_WIN +#if defined(Q_WS_X11) && !defined(QT_NO_XRENDER) if (d_ptr->translucentBackground) -#else - if (!qt_widget_private(window())->isOpaque) -#endif prepareBuffer(QImage::Format_ARGB32_Premultiplied, window()); else #endif prepareBuffer(QImage::systemFormat(), window()); } d->inSetGeometry = false; - -#if defined(Q_WS_MAC) && defined(QT_MAC_USE_COCOA) - QMainWindow* mWindow = qobject_cast(window()); - if (mWindow) { - QMainWindowLayout *mLayout = qobject_cast(mWindow->layout()); - QList toolbarList = mLayout->qtoolbarsInUnifiedToolbarList; - - for (int i = 0; i < toolbarList.size(); ++i) { - QToolBar* toolbar = toolbarList.at(i); - if (mLayout->toolBarArea(toolbar) == Qt::TopToolBarArea) { - QWidget* tbWidget = (QWidget*) toolbar; - if (tbWidget->d_func()->unifiedSurface) { - tbWidget->d_func()->unifiedSurface->setGeometry(rect); - } - } - } - } -#endif // Q_WS_MAC && QT_MAC_USE_COCOA - } // from qwindowsurface.cpp @@ -363,18 +215,6 @@ extern void qt_scrollRectInImage(const QImage *img, const QRect &rect, const QPo bool QRasterWindowSurface::scroll(const QRegion &area, int dx, int dy) { -#ifdef Q_WS_WIN - Q_D(QRasterWindowSurface); - - if (!d->image || !d->image->hdc) - return false; - - QRect rect = area.boundingRect(); - BitBlt(d->image->hdc, rect.x()+dx, rect.y()+dy, rect.width(), rect.height(), - d->image->hdc, rect.x(), rect.y(), SRCCOPY); - - return true; -#else Q_D(QRasterWindowSurface); if (!d->image || d->image->isNull()) @@ -389,7 +229,6 @@ bool QRasterWindowSurface::scroll(const QRegion &area, int dx, int dy) qt_scrollRectInImage(d->image, rects.at(i), QPoint(dx, dy)); return true; -#endif } QWindowSurface::WindowSurfaceFeatures QRasterWindowSurface::features() const @@ -457,14 +296,6 @@ void QRasterWindowSurface::prepareBuffer(QImage::Format format, QWidget *widget) delete oldImage; } -#ifdef QT_MAC_USE_COCOA -CGContextRef QRasterWindowSurface::imageContext() -{ - Q_D(QRasterWindowSurface); - return d->image->cg; -} -#endif // QT_MAC_USE_COCOA - QT_END_NAMESPACE diff --git a/src/gui/painting/qwindowsurface_raster_p.h b/src/gui/painting/qwindowsurface_raster_p.h index 7f32c8684..a3019a381 100644 --- a/src/gui/painting/qwindowsurface_raster_p.h +++ b/src/gui/painting/qwindowsurface_raster_p.h @@ -56,39 +56,8 @@ #include #include "qwindowsurface_p.h" -#ifdef QT_MAC_USE_COCOA -# include -#endif // QT_MAC_USE_COCOA - QT_BEGIN_NAMESPACE -#ifdef Q_WS_WIN -#define Q_WS_EX_LAYERED 0x00080000 // copied from WS_EX_LAYERED in winuser.h -#define Q_LWA_ALPHA 0x00000002 // copied from LWA_ALPHA in winuser.h -#define Q_ULW_ALPHA 0x00000002 // copied from ULW_ALPHA in winuser.h -#define Q_AC_SRC_ALPHA 0x00000001 // copied from AC_SRC_ALPHA in winuser.h - -struct Q_UPDATELAYEREDWINDOWINFO { - DWORD cbSize; - HDC hdcDst; - const POINT *pptDst; - const SIZE *psize; - HDC hdcSrc; - const POINT *pptSrc; - COLORREF crKey; - const BLENDFUNCTION *pblend; - DWORD dwFlags; - const RECT *prcDirty; -}; - -typedef BOOL (WINAPI *PtrUpdateLayeredWindow)(HWND hwnd, HDC hdcDst, const POINT *pptDst, - const SIZE *psize, HDC hdcSrc, const POINT *pptSrc, COLORREF crKey, - const BLENDFUNCTION *pblend, DWORD dwflags); -typedef BOOL (WINAPI *PtrUpdateLayeredWindowIndirect)(HWND hwnd, const Q_UPDATELAYEREDWINDOWINFO *pULWInfo); -extern PtrUpdateLayeredWindow ptrUpdateLayeredWindow; -extern PtrUpdateLayeredWindowIndirect ptrUpdateLayeredWindowIndirect; -#endif - class QPaintDevice; class QPoint; class QRegion; @@ -110,13 +79,6 @@ public: bool scroll(const QRegion &area, int dx, int dy); WindowSurfaceFeatures features() const; -#ifdef QT_MAC_USE_COCOA - CGContextRef imageContext(); - - bool needsFlush; - QRegion regionToFlush; -#endif // QT_MAC_USE_COCOA - private: #if defined(Q_WS_X11) && !defined(QT_NO_XSHM) void syncX(); diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index 9a4bc331d..395d7eb18 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -1466,15 +1466,9 @@ void QTextEngine::itemize() const int length = layoutData->string.length(); if (!length) return; -#if defined(Q_WS_MAC) && !defined(QT_MAC_USE_COCOA) - // ATSUI requires RTL flags to correctly identify the character stops. - bool ignore = false; -#else - bool ignore = ignoreBidi; -#endif + bool ignore = ignoreBidi; bool rtl = isRightToLeft(); - if (!ignore && !rtl) { ignore = true; const QChar *start = layoutData->string.unicode(); diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index ec2190cbb..37268da2e 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -1266,10 +1266,6 @@ void QTextLayout::drawCursor(QPainter *p, const QPointF &pos, int cursorPosition && (p->transform().type() > QTransform::TxTranslate); if (toggleAntialiasing) p->setRenderHint(QPainter::Antialiasing); -#if defined(QT_MAC_USE_COCOA) - // Always draw the cursor aligned to pixel boundary. - x = qRound(x); -#endif p->fillRect(QRectF(x, y, qreal(width), (base + descent + 1).toReal()), p->pen().brush()); if (toggleAntialiasing) p->setRenderHint(QPainter::Antialiasing, false); diff --git a/src/gui/util/qcompleter.cpp b/src/gui/util/qcompleter.cpp index 942184ca2..e79e8299d 100644 --- a/src/gui/util/qcompleter.cpp +++ b/src/gui/util/qcompleter.cpp @@ -1133,11 +1133,7 @@ void QCompleter::setPopup(QAbstractItemView *popup) delete d->popup; if (popup->model() != d->proxy) popup->setModel(d->proxy); -#if defined(Q_OS_MAC) && !defined(QT_MAC_USE_COCOA) - popup->show(); -#else popup->hide(); -#endif Qt::FocusPolicy origPolicy = Qt::NoFocus; if (d->widget) diff --git a/src/gui/util/qsystemtrayicon.cpp b/src/gui/util/qsystemtrayicon.cpp index f0da06f69..5299246ad 100644 --- a/src/gui/util/qsystemtrayicon.cpp +++ b/src/gui/util/qsystemtrayicon.cpp @@ -433,19 +433,11 @@ QBalloonTip::QBalloonTip(QSystemTrayIcon::MessageIcon icon, const QString& title titleLabel->setText(title); QFont f = titleLabel->font(); f.setBold(true); -#ifdef Q_WS_WINCE - f.setPointSize(f.pointSize() - 2); -#endif titleLabel->setFont(f); titleLabel->setTextFormat(Qt::PlainText); // to maintain compat with windows -#ifdef Q_WS_WINCE - const int iconSize = style()->pixelMetric(QStyle::PM_SmallIconSize); - const int closeButtonSize = style()->pixelMetric(QStyle::PM_SmallIconSize) - 2; -#else const int iconSize = 18; const int closeButtonSize = 15; -#endif QPushButton *closeButton = new QPushButton; closeButton->setIcon(style()->standardIcon(QStyle::SP_TitleBarCloseButton)); @@ -455,21 +447,13 @@ QBalloonTip::QBalloonTip(QSystemTrayIcon::MessageIcon icon, const QString& title QObject::connect(closeButton, SIGNAL(clicked()), this, SLOT(close())); QLabel *msgLabel = new QLabel; -#ifdef Q_WS_WINCE - f.setBold(false); - msgLabel->setFont(f); -#endif msgLabel->installEventFilter(this); msgLabel->setText(message); msgLabel->setTextFormat(Qt::PlainText); msgLabel->setAlignment(Qt::AlignTop | Qt::AlignLeft); // smart size for the message label -#ifdef Q_WS_WINCE - int limit = QApplication::desktop()->availableGeometry(msgLabel).size().width() / 2; -#else - int limit = QApplication::desktop()->availableGeometry(msgLabel).size().width() / 3; -#endif + const int limit = QApplication::desktop()->availableGeometry(msgLabel).size().width() / 3; if (msgLabel->sizeHint().width() > limit) { msgLabel->setWordWrap(true); if (msgLabel->sizeHint().width() > limit) { @@ -480,15 +464,9 @@ QBalloonTip::QBalloonTip(QSystemTrayIcon::MessageIcon icon, const QString& title control->document()->setDefaultTextOption(opt); } } -#ifdef Q_WS_WINCE - // Make sure that the text isn't wrapped "somewhere" in the balloon widget - // in the case that we have a long title label. - setMaximumWidth(limit); -#else // Here we allow the text being much smaller than the balloon widget // to emulate the weird standard windows behavior. msgLabel->setFixedSize(limit, msgLabel->heightForWidth(limit)); -#endif } QIcon si; @@ -542,11 +520,6 @@ void QBalloonTip::paintEvent(QPaintEvent *) painter.drawPixmap(rect(), pixmap); } -void QBalloonTip::resizeEvent(QResizeEvent *ev) -{ - QWidget::resizeEvent(ev); -} - void QBalloonTip::balloon(const QPoint& pos, int msecs, bool showArrow) { QRect scr = QApplication::desktop()->screenGeometry(pos); diff --git a/src/gui/util/qsystemtrayicon_p.h b/src/gui/util/qsystemtrayicon_p.h index bec071d58..b0dd227d9 100644 --- a/src/gui/util/qsystemtrayicon_p.h +++ b/src/gui/util/qsystemtrayicon_p.h @@ -110,7 +110,6 @@ private: protected: void paintEvent(QPaintEvent *); - void resizeEvent(QResizeEvent *); void mousePressEvent(QMouseEvent *e); void timerEvent(QTimerEvent *e); diff --git a/src/gui/widgets/qabstractbutton.cpp b/src/gui/widgets/qabstractbutton.cpp index e5f6e177c..e196f6184 100644 --- a/src/gui/widgets/qabstractbutton.cpp +++ b/src/gui/widgets/qabstractbutton.cpp @@ -217,13 +217,6 @@ void QButtonGroup::setExclusive(bool exclusive) d->exclusive = exclusive; } - -// TODO: Qt 5: Merge with addButton(QAbstractButton *button, int id) -void QButtonGroup::addButton(QAbstractButton *button) -{ - addButton(button, -1); -} - void QButtonGroup::addButton(QAbstractButton *button, int id) { Q_D(QButtonGroup); @@ -1298,11 +1291,6 @@ void QAbstractButton::changeEvent(QEvent *e) } /*! - \fn void QAbstractButton::paintEvent(QPaintEvent *e) - \reimp -*/ - -/*! \fn void QAbstractButton::pressed() This signal is emitted when the button is pressed down. diff --git a/src/gui/widgets/qabstractbutton.h b/src/gui/widgets/qabstractbutton.h index b1745e561..bd7ef7c77 100644 --- a/src/gui/widgets/qabstractbutton.h +++ b/src/gui/widgets/qabstractbutton.h @@ -127,7 +127,6 @@ Q_SIGNALS: void toggled(bool checked); protected: - virtual void paintEvent(QPaintEvent *e) = 0; virtual bool hitButton(const QPoint &pos) const; virtual void checkStateSet(); virtual void nextCheckState(); diff --git a/src/gui/widgets/qbuttongroup.h b/src/gui/widgets/qbuttongroup.h index e56c1d722..da89358c2 100644 --- a/src/gui/widgets/qbuttongroup.h +++ b/src/gui/widgets/qbuttongroup.h @@ -67,8 +67,7 @@ public: void setExclusive(bool); bool exclusive() const; - void addButton(QAbstractButton *); - void addButton(QAbstractButton *, int id); + void addButton(QAbstractButton *, int id = -1); void removeButton(QAbstractButton *); QList buttons() const; diff --git a/src/gui/widgets/qdockarealayout.cpp b/src/gui/widgets/qdockarealayout.cpp index 1a815d7a9..9e2d77147 100644 --- a/src/gui/widgets/qdockarealayout.cpp +++ b/src/gui/widgets/qdockarealayout.cpp @@ -2064,9 +2064,7 @@ void QDockAreaLayoutInfo::updateSeparatorWidgets() const } j++; -#ifndef QT_MAC_USE_COCOA sepWidget->raise(); -#endif QRect sepRect = separatorRect(i).adjusted(-2, -2, 2, 2); sepWidget->setGeometry(sepRect); sepWidget->setMask( QRegion(separatorRect(i).translated( - sepRect.topLeft()))); @@ -3177,9 +3175,7 @@ void QDockAreaLayout::updateSeparatorWidgets() const } j++; -#ifndef QT_MAC_USE_COCOA sepWidget->raise(); -#endif QRect sepRect = separatorRect(i).adjusted(-2, -2, 2, 2); sepWidget->setGeometry(sepRect); sepWidget->setMask( QRegion(separatorRect(i).translated( - sepRect.topLeft()))); diff --git a/src/gui/widgets/qdockwidget.cpp b/src/gui/widgets/qdockwidget.cpp index 8efd92caf..506bef821 100644 --- a/src/gui/widgets/qdockwidget.cpp +++ b/src/gui/widgets/qdockwidget.cpp @@ -1051,12 +1051,6 @@ void QDockWidgetPrivate::setWindowState(bool floating, bool unplug, const QRect q->setWindowFlags(flags); -#if defined(Q_WS_MAC) && !defined(QT_MAC_USE_COCOA) - if (floating && nativeDeco && (q->features() & QDockWidget::DockWidgetVerticalTitleBar)) { - ChangeWindowAttributes(HIViewGetWindow(HIViewRef(q->winId())), kWindowSideTitlebarAttribute, 0); - } -#endif - if (!rect.isNull()) q->setGeometry(rect); diff --git a/src/gui/widgets/qfocusframe.cpp b/src/gui/widgets/qfocusframe.cpp index 4e5ffff12..5ebd0c441 100644 --- a/src/gui/widgets/qfocusframe.cpp +++ b/src/gui/widgets/qfocusframe.cpp @@ -330,11 +330,6 @@ QFocusFrame::eventFilter(QObject *o, QEvent *e) return false; } -/*! \reimp */ -bool QFocusFrame::event(QEvent *e) -{ - return QWidget::event(e); -} QT_END_NAMESPACE diff --git a/src/gui/widgets/qfocusframe.h b/src/gui/widgets/qfocusframe.h index f39345dfd..b2bde9d10 100644 --- a/src/gui/widgets/qfocusframe.h +++ b/src/gui/widgets/qfocusframe.h @@ -63,8 +63,6 @@ public: QWidget *widget() const; protected: - bool event(QEvent *e); - bool eventFilter(QObject *, QEvent *); void paintEvent(QPaintEvent *); void initStyleOption(QStyleOption *option) const; diff --git a/src/gui/widgets/qgroupbox.cpp b/src/gui/widgets/qgroupbox.cpp index f049d1555..097318d73 100644 --- a/src/gui/widgets/qgroupbox.cpp +++ b/src/gui/widgets/qgroupbox.cpp @@ -310,13 +310,6 @@ void QGroupBox::setAlignment(int alignment) /*! \reimp */ -void QGroupBox::resizeEvent(QResizeEvent *e) -{ - QWidget::resizeEvent(e); -} - -/*! \reimp -*/ void QGroupBox::paintEvent(QPaintEvent *) { diff --git a/src/gui/widgets/qgroupbox.h b/src/gui/widgets/qgroupbox.h index a2e331d0d..d810749a2 100644 --- a/src/gui/widgets/qgroupbox.h +++ b/src/gui/widgets/qgroupbox.h @@ -91,7 +91,6 @@ Q_SIGNALS: protected: bool event(QEvent *event); void childEvent(QChildEvent *event); - void resizeEvent(QResizeEvent *event); void paintEvent(QPaintEvent *event); void focusInEvent(QFocusEvent *event); void changeEvent(QEvent *event); diff --git a/src/gui/widgets/qlcdnumber.h b/src/gui/widgets/qlcdnumber.h index 3d22f90bc..933045cfd 100644 --- a/src/gui/widgets/qlcdnumber.h +++ b/src/gui/widgets/qlcdnumber.h @@ -111,8 +111,6 @@ protected: bool event(QEvent *e); void paintEvent(QPaintEvent *); -public: - private: Q_DISABLE_COPY(QLCDNumber) Q_DECLARE_PRIVATE(QLCDNumber) diff --git a/src/gui/widgets/qmainwindow.cpp b/src/gui/widgets/qmainwindow.cpp index 310b6ed78..4a4b4f352 100644 --- a/src/gui/widgets/qmainwindow.cpp +++ b/src/gui/widgets/qmainwindow.cpp @@ -742,11 +742,7 @@ void QMainWindow::addToolBar(Qt::ToolBarArea area, QToolBar *toolbar) #endif } - if (!d->layout->usesHIToolBar(toolbar)) { - d->layout->removeWidget(toolbar); - } else { - d->layout->removeToolBar(toolbar); - } + d->layout->removeWidget(toolbar); toolbar->d_func()->_q_updateIconSize(d->iconSize); toolbar->d_func()->_q_updateToolButtonStyle(d->toolButtonStyle); @@ -1428,28 +1424,6 @@ bool QMainWindow::event(QEvent *event) if (!d->explicitIconSize) setIconSize(QSize()); break; -#ifdef Q_WS_MAC - case QEvent::Show: - d->layout->blockVisiblityCheck = false; - if (unifiedTitleAndToolBarOnMac()) - d->layout->syncUnifiedToolbarVisibility(); - break; - case QEvent::WindowStateChange: - { - if (isHidden()) { - // We are coming out of a minimize, leave things as is. - d->layout->blockVisiblityCheck = true; - } -# ifdef QT_MAC_USE_COCOA - // We need to update the HIToolbar status when we go out of or into fullscreen. - QWindowStateChangeEvent *wce = static_cast(event); - if ((windowState() & Qt::WindowFullScreen) || (wce->oldState() & Qt::WindowFullScreen)) { - d->layout->updateHIToolBarStatus(); - } -# endif // Cocoa - } - break; -#endif // Q_WS_MAC #if !defined(QT_NO_DOCKWIDGET) && !defined(QT_NO_CURSOR) case QEvent::CursorChange: if (d->cursorAdjusted) { @@ -1465,81 +1439,6 @@ bool QMainWindow::event(QEvent *event) return QWidget::event(event); } -#ifndef QT_NO_TOOLBAR - -/*! - \property QMainWindow::unifiedTitleAndToolBarOnMac - \brief whether the window uses the unified title and toolbar look on Mac OS X - \since 4.3 - - This property is false by default and only has any effect on Mac OS X 10.4 or higher. - - If set to true, then the top toolbar area is replaced with a Carbon HIToolbar - or a Cocoa NSToolbar (depending on whether Qt was built with Carbon or Cocoa). - All toolbars in the top toolbar area and any toolbars added afterwards are - moved to that. This means a couple of things. - - \list - \i QToolBars in this toolbar area are not movable and you cannot drag other - toolbars to it - \i Toolbar breaks are not respected or preserved - \i Any custom widgets in the toolbar will not be shown if the toolbar - becomes too small (only actions will be shown) - \i Before Qt 4.5, if you called showFullScreen() on the main window, the QToolbar would - disappear since it is considered to be part of the title bar. Qt 4.5 and up will now work around this by pulling - the toolbars out and back into the regular toolbar and vice versa when you swap out. - \endlist - - Setting this back to false will remove these restrictions. - - The Qt::WA_MacBrushedMetal attribute takes precedence over this property. -*/ -void QMainWindow::setUnifiedTitleAndToolBarOnMac(bool set) -{ -#ifdef Q_WS_MAC - Q_D(QMainWindow); - if (!isWindow() || d->useHIToolBar == set || QSysInfo::MacintoshVersion < QSysInfo::MV_10_3) - return; - - d->useHIToolBar = set; - createWinId(); // We need the hiview for down below. - -#ifdef QT_MAC_USE_COCOA - // Activate the unified toolbar with the raster engine. - if (windowSurface() && set) { - d->layout->unifiedSurface = new QUnifiedToolbarSurface(this); - } -#endif // QT_MAC_USE_COCOA - - d->layout->updateHIToolBarStatus(); - -#ifdef QT_MAC_USE_COCOA - // Deactivate the unified toolbar with the raster engine. - if (windowSurface() && !set) { - if (d->layout->unifiedSurface) { - delete d->layout->unifiedSurface; - d->layout->unifiedSurface = 0; - } - } -#endif // QT_MAC_USE_COCOA - - // Enabling the unified toolbar clears the opaque size grip setting, update it. - d->macUpdateOpaqueSizeGrip(); -#else - Q_UNUSED(set) -#endif -} - -bool QMainWindow::unifiedTitleAndToolBarOnMac() const -{ -#ifdef Q_WS_MAC - return d_func()->useHIToolBar && !testAttribute(Qt::WA_MacBrushedMetal) && !(windowFlags() & Qt::FramelessWindowHint); -#endif - return false; -} - -#endif // QT_NO_TOOLBAR - /*! \internal */ @@ -1653,9 +1552,7 @@ QMenu *QMainWindow::createPopupMenu() for (int i = 0; i < toolbars.size(); ++i) { QToolBar *toolBar = toolbars.at(i); if (toolBar->parentWidget() == this - && (!d->layout->layoutState.toolBarAreaLayout.indexOf(toolBar).isEmpty() - || (unifiedTitleAndToolBarOnMac() - && toolBarArea(toolBar) == Qt::TopToolBarArea))) { + && !d->layout->layoutState.toolBarAreaLayout.indexOf(toolBar).isEmpty()) { menu->addAction(toolbars.at(i)->toggleViewAction()); } } diff --git a/src/gui/widgets/qmainwindow.h b/src/gui/widgets/qmainwindow.h index ac4c6fcdd..f18aca346 100644 --- a/src/gui/widgets/qmainwindow.h +++ b/src/gui/widgets/qmainwindow.h @@ -78,9 +78,6 @@ class Q_GUI_EXPORT QMainWindow : public QWidget Q_PROPERTY(bool dockNestingEnabled READ isDockNestingEnabled WRITE setDockNestingEnabled) #endif // QT_NO_DOCKWIDGET Q_PROPERTY(DockOptions dockOptions READ dockOptions WRITE setDockOptions) -#ifndef QT_NO_TOOLBAR - Q_PROPERTY(bool unifiedTitleAndToolBarOnMac READ unifiedTitleAndToolBarOnMac WRITE setUnifiedTitleAndToolBarOnMac) -#endif public: enum DockOption { @@ -155,9 +152,6 @@ public: void removeToolBar(QToolBar *toolbar); void removeToolBarBreak(QToolBar *before); - void setUnifiedTitleAndToolBarOnMac(bool set); - bool unifiedTitleAndToolBarOnMac() const; - Qt::ToolBarArea toolBarArea(QToolBar *toolbar) const; bool toolBarBreak(QToolBar *toolbar) const; #endif diff --git a/src/gui/widgets/qmainwindowlayout.cpp b/src/gui/widgets/qmainwindowlayout.cpp index 9fe333ada..6a36965d0 100644 --- a/src/gui/widgets/qmainwindowlayout.cpp +++ b/src/gui/widgets/qmainwindowlayout.cpp @@ -845,14 +845,7 @@ void QMainWindowLayout::removeToolBar(QToolBar *toolbar) QObject::disconnect(parentWidget(), SIGNAL(toolButtonStyleChanged(Qt::ToolButtonStyle)), toolbar, SLOT(_q_updateToolButtonStyle(Qt::ToolButtonStyle))); -#ifdef Q_WS_MAC - if (usesHIToolBar(toolbar)) { - removeFromMacToolbar(toolbar); - } else -#endif // Q_WS_MAC - { - removeWidget(toolbar); - } + removeWidget(toolbar); } } @@ -864,25 +857,17 @@ void QMainWindowLayout::addToolBar(Qt::ToolBarArea area, bool) { validateToolBarArea(area); -#ifdef Q_WS_MAC - if ((area == Qt::TopToolBarArea) - && layoutState.mainWindow->unifiedTitleAndToolBarOnMac()) { - insertIntoMacToolbar(0, toolbar); - } else -#endif - { - //let's add the toolbar to the layout - addChildWidget(toolbar); - QLayoutItem * item = layoutState.toolBarAreaLayout.addToolBar(toDockPos(area), toolbar); - if (savedState.isValid() && item) { - // copy the toolbar also in the saved state - savedState.toolBarAreaLayout.insertItem(toDockPos(area), item); - } - invalidate(); - - //this ensures that the toolbar has the right window flags (not floating any more) - toolbar->d_func()->updateWindowFlags(false /*floating*/); + //let's add the toolbar to the layout + addChildWidget(toolbar); + QLayoutItem * item = layoutState.toolBarAreaLayout.addToolBar(toDockPos(area), toolbar); + if (savedState.isValid() && item) { + // copy the toolbar also in the saved state + savedState.toolBarAreaLayout.insertItem(toDockPos(area), item); } + invalidate(); + + //this ensures that the toolbar has the right window flags (not floating any more) + toolbar->d_func()->updateWindowFlags(false /*floating*/); } /*! @@ -890,27 +875,20 @@ void QMainWindowLayout::addToolBar(Qt::ToolBarArea area, */ void QMainWindowLayout::insertToolBar(QToolBar *before, QToolBar *toolbar) { -#ifdef Q_WS_MAC - if (usesHIToolBar(before)) { - insertIntoMacToolbar(before, toolbar); - } else -#endif // Q_WS_MAC - { - addChildWidget(toolbar); - QLayoutItem * item = layoutState.toolBarAreaLayout.insertToolBar(before, toolbar); - if (savedState.isValid() && item) { - // copy the toolbar also in the saved state - savedState.toolBarAreaLayout.insertItem(before, item); - } - if (!currentGapPos.isEmpty() && currentGapPos.first() == 0) { - currentGapPos = layoutState.toolBarAreaLayout.currentGapIndex(); - if (!currentGapPos.isEmpty()) { - currentGapPos.prepend(0); - currentGapRect = layoutState.itemRect(currentGapPos); - } + addChildWidget(toolbar); + QLayoutItem * item = layoutState.toolBarAreaLayout.insertToolBar(before, toolbar); + if (savedState.isValid() && item) { + // copy the toolbar also in the saved state + savedState.toolBarAreaLayout.insertItem(before, item); + } + if (!currentGapPos.isEmpty() && currentGapPos.first() == 0) { + currentGapPos = layoutState.toolBarAreaLayout.currentGapIndex(); + if (!currentGapPos.isEmpty()) { + currentGapPos.prepend(0); + currentGapRect = layoutState.itemRect(currentGapPos); } - invalidate(); } + invalidate(); } Qt::ToolBarArea QMainWindowLayout::toolBarArea(QToolBar *toolbar) const @@ -923,12 +901,6 @@ Qt::ToolBarArea QMainWindowLayout::toolBarArea(QToolBar *toolbar) const case QInternal::BottomDock: return Qt::BottomToolBarArea; default: break; } -#ifdef Q_WS_MAC - if (pos == QInternal::DockCount) { - if (qtoolbarsInUnifiedToolbarList.contains(toolbar)) - return Qt::TopToolBarArea; - } -#endif return Qt::NoToolBarArea; } @@ -945,70 +917,15 @@ void QMainWindowLayout::getStyleOptionInfo(QStyleOptionToolBar *option, QToolBar void QMainWindowLayout::toggleToolBarsVisible() { - bool updateNonUnifiedParts = true; -#ifdef Q_WS_MAC - if (layoutState.mainWindow->unifiedTitleAndToolBarOnMac()) { - // If we hit this case, someone has pressed the "toolbar button" which will - // toggle the unified toolbar visibility, because that's what the user wants. - // We might be in a situation where someone has hidden all the toolbars - // beforehand (maybe in construction), but now they've hit this button and - // and are expecting the items to show. What do we do? - // 1) Check the visibility of all the toolbars, if one is visible, do nothing, this - // preserves what people would expect (these toolbars were visible when I clicked last time). - // 2) If NONE are visible, then show them all. Again, this preserves the user expectation - // of, "I want to see the toolbars." The user may get more toolbars than expected, but this - // is better seeing nothing. - // Don't worry about any of this if we are going invisible. This does mean we may get - // into issues when switching into and out of fullscreen mode, but this is probably minor. - // If we ever need to do hiding, that would have to be taken care of after the unified toolbar - // has finished hiding. - // People can of course handle the QEvent::ToolBarChange event themselves and do - // WHATEVER they want if they don't like what we are doing (though the unified toolbar - // will fire regardless). - - // Check if we REALLY need to update the geometry below. If we only have items in the - // unified toolbar, all the docks will be empty, so there's very little point - // in doing the geometry as Apple will do it (we also avoid flicker in Cocoa as well). - // FWIW, layoutState.toolBarAreaLayout.visible and the state of the unified toolbar - // visibility can get out of sync. I really don't think it's a big issue. It is kept - // to a minimum because we only change the visibility if we absolutely must. - // update the "non unified parts." - updateNonUnifiedParts = !layoutState.toolBarAreaLayout.isEmpty(); - - // We get this function before the unified toolbar does its thing. - // So, the value will be opposite of what we expect. - bool goingVisible = !macWindowToolbarIsVisible(qt_mac_window_for(layoutState.mainWindow)); - if (goingVisible) { - const int ToolBarCount = qtoolbarsInUnifiedToolbarList.size(); - bool needAllVisible = true; - for (int i = 0; i < ToolBarCount; ++i) { - if (!qtoolbarsInUnifiedToolbarList.at(i)->isHidden()) { - needAllVisible = false; - break; - } - } - if (needAllVisible) { - QBoolBlocker blocker(blockVisiblityCheck); // Disable the visibilty check because - // the toggle has already happened. - for (int i = 0; i < ToolBarCount; ++i) - qtoolbarsInUnifiedToolbarList.at(i)->setVisible(true); - } - } - if (!updateNonUnifiedParts) - layoutState.toolBarAreaLayout.visible = goingVisible; - } -#endif - if (updateNonUnifiedParts) { - layoutState.toolBarAreaLayout.visible = !layoutState.toolBarAreaLayout.visible; - if (!layoutState.mainWindow->isMaximized()) { - QPoint topLeft = parentWidget()->geometry().topLeft(); - QRect r = parentWidget()->geometry(); - r = layoutState.toolBarAreaLayout.rectHint(r); - r.moveTo(topLeft); - parentWidget()->setGeometry(r); - } else { - update(); - } + layoutState.toolBarAreaLayout.visible = !layoutState.toolBarAreaLayout.visible; + if (!layoutState.mainWindow->isMaximized()) { + QPoint topLeft = parentWidget()->geometry().topLeft(); + QRect r = parentWidget()->geometry(); + r = layoutState.toolBarAreaLayout.rectHint(r); + r.moveTo(topLeft); + parentWidget()->setGeometry(r); + } else { + update(); } } @@ -1487,14 +1404,6 @@ QSize QMainWindowLayout::minimumSize() const const QSize sbMin = statusbar ? statusbar->minimumSize() : QSize(0, 0); minSize = QSize(qMax(sbMin.width(), minSize.width()), sbMin.height() + minSize.height()); -#ifdef Q_WS_MAC - const QSize storedSize = minSize; - int minWidth = 0; - foreach (QToolBar *toolbar, qtoolbarsInUnifiedToolbarList) { - minWidth += toolbar->sizeHint().width() + 20; - } - minSize = QSize(qMax(minWidth, storedSize.width()), storedSize.height()); -#endif } return minSize; } @@ -1688,10 +1597,6 @@ QMainWindowLayout::QMainWindowLayout(QMainWindow *mainwindow, QLayout *parentLay #ifndef QT_NO_RUBBERBAND , gapIndicator(new QRubberBand(QRubberBand::Rectangle, mainwindow)) #endif //QT_NO_RUBBERBAND -#ifdef Q_WS_MAC - , activateUnifiedToolbarAfterFullScreen(false) - , blockVisiblityCheck(false) -#endif { if (parentLayout) setParent(parentLayout); @@ -1963,22 +1868,6 @@ bool QMainWindowLayout::restoreState(QDataStream &stream) return true; } - -// Returns if this toolbar *should* be using HIToolbar. Won't work for all in between cases -// for example, you have a toolbar in the top area and then you suddenly turn on -// HIToolbar. -bool QMainWindowLayout::usesHIToolBar(QToolBar *toolbar) const -{ -#ifndef Q_WS_MAC - Q_UNUSED(toolbar); - return false; -#else - return qtoolbarsInUnifiedToolbarList.contains(toolbar) - || ((toolBarArea(toolbar) == Qt::TopToolBarArea) - && layoutState.mainWindow->unifiedTitleAndToolBarOnMac()); -#endif -} - void QMainWindowLayout::timerEvent(QTimerEvent *e) { #ifndef QT_NO_DOCKWIDGET diff --git a/src/gui/widgets/qmainwindowlayout_p.h b/src/gui/widgets/qmainwindowlayout_p.h index c1a6fb1e9..cdb24cc2c 100644 --- a/src/gui/widgets/qmainwindowlayout_p.h +++ b/src/gui/widgets/qmainwindowlayout_p.h @@ -154,7 +154,6 @@ public: QMainWindow::DockOptions dockOptions; void setDockOptions(QMainWindow::DockOptions opts); - bool usesHIToolBar(QToolBar *toolbar) const; void timerEvent(QTimerEvent *e); diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp index cad13e956..5d585b65e 100644 --- a/src/gui/widgets/qmenu.cpp +++ b/src/gui/widgets/qmenu.cpp @@ -2303,10 +2303,6 @@ void QMenu::changeEvent(QEvent *e) if (d->tornPopup) // torn-off menu d->tornPopup->setEnabled(isEnabled()); d->menuAction->setEnabled(isEnabled()); -#if defined(Q_WS_MAC) && !defined(QT_MAC_USE_COCOA) - if (d->mac_menu) - d->setMacMenuEnabled(isEnabled()); -#endif } QWidget::changeEvent(e); } diff --git a/src/gui/widgets/qpushbutton.cpp b/src/gui/widgets/qpushbutton.cpp index 0de8f3f3d..ffba3a580 100644 --- a/src/gui/widgets/qpushbutton.cpp +++ b/src/gui/widgets/qpushbutton.cpp @@ -678,38 +678,6 @@ bool QPushButton::event(QEvent *e) return QAbstractButton::event(e); } -#ifdef Q_WS_MAC -/*! \reimp */ -bool QPushButton::hitButton(const QPoint &pos) const -{ - QStyleOptionButton opt; - initStyleOption(&opt); - if (qt_mac_buttonIsRenderedFlat(this, &opt)) - return QAbstractButton::hitButton(pos); - - // Now that we know we are using the native style, let's proceed. - Q_D(const QPushButton); - QPushButtonPrivate *nonConst = const_cast(d); - // In OSX buttons are round, which causes the hit method to be special. - // We cannot simply relay on detecting if something is inside the rect or not, - // we need to check if it is inside the "rounded area" or not. A point might - // be inside the rect but not inside the rounded area. - // Notice this method is only reimplemented for OSX. - return nonConst->hitButton(pos); -} - -bool QPushButtonPrivate::hitButton(const QPoint &pos) -{ - Q_Q(QPushButton); - QRect roundedRect(q->rect().left() + QMacStylePrivate::PushButtonLeftOffset, - q->rect().top() + QMacStylePrivate::PushButtonContentPadding, - q->rect().width() - QMacStylePrivate::PushButtonRightOffset, - q->rect().height() - QMacStylePrivate::PushButtonBottomOffset); - return roundedRect.contains(pos); -} -#endif // Q_WS_MAC - - /*! \fn void QPushButton::openPopup() diff --git a/src/gui/widgets/qrubberband.cpp b/src/gui/widgets/qrubberband.cpp index b04b3d11e..62cca8c52 100644 --- a/src/gui/widgets/qrubberband.cpp +++ b/src/gui/widgets/qrubberband.cpp @@ -284,34 +284,6 @@ void QRubberBand::moveEvent(QMoveEvent *) \sa move() */ -/*! - \fn void QRubberBand::setGeometry(const QRect &rect) - - Sets the geometry of the rubber band to \a rect, specified in the coordinate system - of its parent widget. - - \sa QWidget::geometry -*/ -void QRubberBand::setGeometry(const QRect &geom) -{ - QWidget::setGeometry(geom); -} - -/*! - \fn void QRubberBand::setGeometry(int x, int y, int width, int height) - \overload - - Sets the geometry of the rubberband to the rectangle whose top-left corner lies at - the point (\a x, \a y), and with dimensions specified by \a width and \a height. - The geometry is specified in the parent widget's coordinate system. -*/ - -/*! \reimp */ -bool QRubberBand::event(QEvent *e) -{ - return QWidget::event(e); -} - QT_END_NAMESPACE #include "moc_qrubberband.h" diff --git a/src/gui/widgets/qrubberband.h b/src/gui/widgets/qrubberband.h index 75871ffee..575bf7bae 100644 --- a/src/gui/widgets/qrubberband.h +++ b/src/gui/widgets/qrubberband.h @@ -65,9 +65,6 @@ public: Shape shape() const; - void setGeometry(const QRect &r); - - inline void setGeometry(int x, int y, int w, int h); inline void move(int x, int y); inline void move(const QPoint &p) { move(p.x(), p.y()); } @@ -77,7 +74,6 @@ public: { resize(s.width(), s.height()); } protected: - bool event(QEvent *e); void paintEvent(QPaintEvent *); void changeEvent(QEvent *); void showEvent(QShowEvent *); @@ -89,8 +85,6 @@ private: Q_DECLARE_PRIVATE(QRubberBand) }; -inline void QRubberBand::setGeometry(int ax, int ay, int aw, int ah) -{ setGeometry(QRect(ax, ay, aw, ah)); } inline void QRubberBand::move(int ax, int ay) { setGeometry(ax, ay, width(), height()); } diff --git a/src/gui/widgets/qscrollbar.cpp b/src/gui/widgets/qscrollbar.cpp index 171f44603..e77336b61 100644 --- a/src/gui/widgets/qscrollbar.cpp +++ b/src/gui/widgets/qscrollbar.cpp @@ -455,12 +455,6 @@ QSize QScrollBar::sizeHint() const return style()->sizeFromContents(QStyle::CT_ScrollBar, &opt, size, this) .expandedTo(QApplication::globalStrut()); - } - -/*!\reimp */ -void QScrollBar::sliderChange(SliderChange change) -{ - QAbstractSlider::sliderChange(change); } /*! diff --git a/src/gui/widgets/qscrollbar.h b/src/gui/widgets/qscrollbar.h index 8834d5965..cb332cd8a 100644 --- a/src/gui/widgets/qscrollbar.h +++ b/src/gui/widgets/qscrollbar.h @@ -72,7 +72,6 @@ protected: void mouseReleaseEvent(QMouseEvent *); void mouseMoveEvent(QMouseEvent *); void hideEvent(QHideEvent*); - void sliderChange(SliderChange change); #ifndef QT_NO_CONTEXTMENU void contextMenuEvent(QContextMenuEvent *); #endif diff --git a/src/gui/widgets/qsizegrip.cpp b/src/gui/widgets/qsizegrip.cpp index cac718a66..b81ba5bda 100644 --- a/src/gui/widgets/qsizegrip.cpp +++ b/src/gui/widgets/qsizegrip.cpp @@ -54,11 +54,6 @@ #if defined(Q_WS_X11) #include -#elif defined (Q_WS_WIN) -#include "qt_windows.h" -#endif -#ifdef Q_WS_MAC -#include #endif #include @@ -91,9 +86,6 @@ public: Qt::Corner m_corner; bool gotMousePress; QWidget *tlw; -#ifdef Q_WS_MAC - void updateMacSizer(bool hide) const; -#endif Qt::Corner corner() const; inline bool atBottom() const { @@ -128,10 +120,7 @@ public: bool showSizeGrip = !(q->isHidden() && q->testAttribute(Qt::WA_WState_ExplicitShowHide)); updateTopLevelWidget(); if (tlw && showSizeGrip) { - Qt::WindowStates sizeGripNotVisibleState = Qt::WindowFullScreen; -#ifndef Q_WS_MAC - sizeGripNotVisibleState |= Qt::WindowMaximized; -#endif + const Qt::WindowStates sizeGripNotVisibleState = Qt::WindowFullScreen | Qt::WindowMaximized; // Don't show the size grip if the tlw is maximized or in full screen mode. showSizeGrip = !(tlw->windowState() & sizeGripNotVisibleState); } @@ -140,18 +129,6 @@ public: } }; -#ifdef Q_WS_MAC -void QSizeGripPrivate::updateMacSizer(bool hide) const -{ - Q_Q(const QSizeGrip); - if (QApplication::closingDown() || !parent) - return; - QWidget *topLevelWindow = qt_sizegrip_topLevelWidget(const_cast(q)); - if(topLevelWindow && topLevelWindow->isWindow()) - QWidgetPrivate::qt_mac_update_sizer(topLevelWindow, hide ? -1 : 1); -} -#endif - Qt::Corner QSizeGripPrivate::corner() const { Q_Q(const QSizeGrip); @@ -316,19 +293,6 @@ void QSizeGrip::mousePressEvent(QMouseEvent * e) return; } #endif // Q_WS_X11 -#ifdef Q_WS_WIN - if (tlw->isWindow() && !tlw->testAttribute(Qt::WA_DontShowOnScreen) && !qt_widget_private(tlw)->hasHeightForWidth()) { - uint orientation = 0; - if (d->atBottom()) - orientation = d->atLeft() ? SZ_SIZEBOTTOMLEFT : SZ_SIZEBOTTOMRIGHT; - else - orientation = d->atLeft() ? SZ_SIZETOPLEFT : SZ_SIZETOPRIGHT; - - ReleaseCapture(); - PostMessage(tlw->winId(), WM_SYSCOMMAND, orientation, 0); - return; - } -#endif // Q_WS_WIN // Find available desktop/workspace geometry. QRect availableGeometry; @@ -410,14 +374,6 @@ void QSizeGrip::mouseMoveEvent(QMouseEvent * e) && !tlw->testAttribute(Qt::WA_DontShowOnScreen) && !qt_widget_private(tlw)->hasHeightForWidth()) return; #endif -#ifdef Q_WS_WIN - if (tlw->isWindow() && GetSystemMenu(tlw->winId(), FALSE) != 0 && internalWinId() - && !tlw->testAttribute(Qt::WA_DontShowOnScreen) && !qt_widget_private(tlw)->hasHeightForWidth()) { - MSG msg; - while(PeekMessage(&msg, winId(), WM_MOUSEMOVE, WM_MOUSEMOVE, PM_REMOVE)); - return; - } -#endif QPoint np(e->globalPos()); @@ -483,36 +439,6 @@ void QSizeGrip::moveEvent(QMoveEvent * /*moveEvent*/) #endif } -/*! - \reimp -*/ -void QSizeGrip::showEvent(QShowEvent *showEvent) -{ -#ifdef Q_WS_MAC - d_func()->updateMacSizer(false); -#endif - QWidget::showEvent(showEvent); -} - -/*! - \reimp -*/ -void QSizeGrip::hideEvent(QHideEvent *hideEvent) -{ -#ifdef Q_WS_MAC - d_func()->updateMacSizer(true); -#endif - QWidget::hideEvent(hideEvent); -} - -/*! - \reimp -*/ -void QSizeGrip::setVisible(bool visible) -{ - QWidget::setVisible(visible); -} - /*! \reimp */ bool QSizeGrip::eventFilter(QObject *o, QEvent *e) { @@ -522,31 +448,13 @@ bool QSizeGrip::eventFilter(QObject *o, QEvent *e) || o != d->tlw) { return QWidget::eventFilter(o, e); } - Qt::WindowStates sizeGripNotVisibleState = Qt::WindowFullScreen; -#ifndef Q_WS_MAC - sizeGripNotVisibleState |= Qt::WindowMaximized; -#endif + const Qt::WindowStates sizeGripNotVisibleState = Qt::WindowFullScreen | Qt::WindowMaximized; // Don't show the size grip if the tlw is maximized or in full screen mode. setVisible(!(d->tlw->windowState() & sizeGripNotVisibleState)); setAttribute(Qt::WA_WState_ExplicitShowHide, false); return QWidget::eventFilter(o, e); } -/*! - \reimp -*/ -bool QSizeGrip::event(QEvent *event) -{ - return QWidget::event(event); -} - -#ifdef Q_WS_WIN -/*! \reimp */ -bool QSizeGrip::winEvent( MSG *m, long *result ) -{ - return QWidget::winEvent(m, result); -} -#endif QT_END_NAMESPACE diff --git a/src/gui/widgets/qsizegrip.h b/src/gui/widgets/qsizegrip.h index 79ec24b62..11e3cd094 100644 --- a/src/gui/widgets/qsizegrip.h +++ b/src/gui/widgets/qsizegrip.h @@ -59,7 +59,6 @@ public: ~QSizeGrip(); QSize sizeHint() const; - void setVisible(bool); protected: void paintEvent(QPaintEvent *); @@ -67,15 +66,7 @@ protected: void mouseMoveEvent(QMouseEvent *); void mouseReleaseEvent(QMouseEvent *mouseEvent); void moveEvent(QMoveEvent *moveEvent); - void showEvent(QShowEvent *showEvent); - void hideEvent(QHideEvent *hideEvent); bool eventFilter(QObject *, QEvent *); - bool event(QEvent *); -#ifdef Q_WS_WIN - bool winEvent(MSG *m, long *result); -#endif - -public: private: Q_DECLARE_PRIVATE(QSizeGrip) diff --git a/src/gui/widgets/qstatusbar.cpp b/src/gui/widgets/qstatusbar.cpp index 5c6a60500..51c97ed85 100644 --- a/src/gui/widgets/qstatusbar.cpp +++ b/src/gui/widgets/qstatusbar.cpp @@ -705,14 +705,6 @@ void QStatusBar::paintEvent(QPaintEvent *event) /*! \reimp */ -void QStatusBar::resizeEvent(QResizeEvent * e) -{ - QWidget::resizeEvent(e); -} - -/*! - \reimp -*/ bool QStatusBar::event(QEvent *e) { @@ -754,48 +746,8 @@ bool QStatusBar::event(QEvent *e) } } } - -// On Mac OS X Leopard it is possible to drag the window by clicking -// on the tool bar on most applications. -#ifndef Q_WS_MAC - return QWidget::event(e); -#else - if (QSysInfo::MacintoshVersion <= QSysInfo::MV_10_4) - return QWidget::event(e); - - // Enable drag-click only if the status bar is the status bar for a - // QMainWindow with a unifed toolbar. - if (parent() == 0 || qobject_cast(parent()) == 0 || - qobject_cast(parent())->unifiedTitleAndToolBarOnMac() == false ) - return QWidget::event(e); - - // Check for mouse events. - QMouseEvent *mouseEvent; - if (e->type() == QEvent::MouseButtonPress || - e->type() == QEvent::MouseMove || - e->type() == QEvent::MouseButtonRelease) { - mouseEvent = static_cast (e); - } else { - return QWidget::event(e); - } - - // The following is a standard mouse drag handler. - if (e->type() == QEvent::MouseButtonPress && (mouseEvent->button() == Qt::LeftButton)) { - d->dragStart = mouseEvent->pos(); - } else if (e->type() == QEvent::MouseMove){ - if (d->dragStart == QPoint()) - return QWidget::event(e); - QPoint pos = mouseEvent->pos(); - QPoint delta = (pos - d->dragStart); - window()->move(window()->pos() + delta); - } else if (e->type() == QEvent::MouseButtonRelease && (mouseEvent->button() == Qt::LeftButton)){ - d->dragStart = QPoint(); - } else { - return QWidget::event(e); - } - return true; -#endif + return QWidget::event(e); } QT_END_NAMESPACE diff --git a/src/gui/widgets/qstatusbar.h b/src/gui/widgets/qstatusbar.h index a91ba5562..1cbc66d4e 100644 --- a/src/gui/widgets/qstatusbar.h +++ b/src/gui/widgets/qstatusbar.h @@ -85,7 +85,6 @@ Q_SIGNALS: protected: void showEvent(QShowEvent *); void paintEvent(QPaintEvent *); - void resizeEvent(QResizeEvent *); // ### Qt 5: consider making reformat() and hideOrShow() private void reformat(); diff --git a/src/gui/widgets/qtabbar.cpp b/src/gui/widgets/qtabbar.cpp index 7f02cb5d0..d93d8152f 100644 --- a/src/gui/widgets/qtabbar.cpp +++ b/src/gui/widgets/qtabbar.cpp @@ -78,42 +78,6 @@ inline static bool verticalTabs(QTabBar::Shape shape) || shape == QTabBar::TriangularEast; } -void QTabBarPrivate::updateMacBorderMetrics() -{ -#if (defined Q_WS_MAC) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5) - if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_5) { - Q_Q(QTabBar); - ::HIContentBorderMetrics metrics; - - // TODO: get metrics to preserve the bottom value - // TODO: test tab bar position - - OSWindowRef window = qt_mac_window_for(q); - - // push base line separator down to the client are so we can paint over it (Carbon) - metrics.top = (documentMode && q->isVisible()) ? 1 : 0; - metrics.bottom = 0; - metrics.left = 0; - metrics.right = 0; - qt_mac_updateContentBorderMetricts(window, metrics); -#ifdef QT_MAC_USE_COCOA - // In Cocoa we need to keep track of the drawRect method. - // If documentMode is enabled we need to change it, unless - // a toolbar is present. - // Notice that all the information is kept in the window, - // that's why we get the private widget for it instead of - // the private widget for this widget. - QWidgetPrivate *privateWidget = qt_widget_private(q->window()); - if(privateWidget) - privateWidget->changeMethods = documentMode; - // Since in Cocoa there is no simple way to remove the baseline, so we just ask the - // top level to do the magic for us. - privateWidget->syncUnifiedMode(); -#endif // QT_MAC_USE_COCOA - } -#endif -} - /*! Initialize \a option with the values from the tab at \a tabIndex. This method is useful for subclasses when they need a QStyleOptionTab, QStyleOptionTabV2, @@ -1395,15 +1359,6 @@ void QTabBar::showEvent(QShowEvent *) d->refresh(); if (!d->validIndex(d->currentIndex)) setCurrentIndex(0); - d->updateMacBorderMetrics(); -} - -/*!\reimp - */ -void QTabBar::hideEvent(QHideEvent *) -{ - Q_D(QTabBar); - d->updateMacBorderMetrics(); } /*!\reimp @@ -1709,9 +1664,6 @@ void QTabBar::mousePressEvent(QMouseEvent *event) d->moveTabFinished(d->pressedIndex); d->pressedIndex = d->indexAtPos(event->pos()); -#ifdef Q_WS_MAC - d->previousPressedIndex = d->pressedIndex; -#endif if (d->validIndex(d->pressedIndex)) { QStyleOptionTabBarBaseV2 optTabBase; optTabBase.init(this); @@ -1736,7 +1688,7 @@ void QTabBar::mouseMoveEvent(QMouseEvent *event) if (d->pressedIndex != -1 && event->buttons() == Qt::NoButton) d->moveTabFinished(d->pressedIndex); - + // Start drag if (!d->dragInProgress && d->pressedIndex != -1) { if ((event->pos() - d->dragStartPosition).manhattanLength() > QApplication::startDragDistance()) { @@ -1792,17 +1744,6 @@ void QTabBar::mouseMoveEvent(QMouseEvent *event) update(); } -#ifdef Q_WS_MAC - } else if (!d->documentMode && event->buttons() == Qt::LeftButton && d->previousPressedIndex != -1) { - int newPressedIndex = d->indexAtPos(event->pos()); - if (d->pressedIndex == -1 && d->previousPressedIndex == newPressedIndex) { - d->pressedIndex = d->previousPressedIndex; - update(tabRect(d->pressedIndex)); - } else if(d->pressedIndex != newPressedIndex) { - d->pressedIndex = -1; - update(tabRect(d->previousPressedIndex)); - } -#endif } if (event->buttons() != Qt::LeftButton) { @@ -1895,9 +1836,6 @@ void QTabBar::mouseReleaseEvent(QMouseEvent *event) event->ignore(); return; } -#ifdef Q_WS_MAC - d->previousPressedIndex = -1; -#endif if (d->movable && d->dragInProgress && d->validIndex(d->pressedIndex)) { int length = d->tabList[d->pressedIndex].dragOffset; int width = verticalTabs(d->shape) @@ -2215,7 +2153,6 @@ void QTabBar::setDocumentMode(bool enabled) Q_D(QTabBar); d->documentMode = enabled; - d->updateMacBorderMetrics(); } /*! diff --git a/src/gui/widgets/qtabbar.h b/src/gui/widgets/qtabbar.h index afbe9cf59..a4639c2d3 100644 --- a/src/gui/widgets/qtabbar.h +++ b/src/gui/widgets/qtabbar.h @@ -185,7 +185,6 @@ protected: bool event(QEvent *); void resizeEvent(QResizeEvent *); void showEvent(QShowEvent *); - void hideEvent(QHideEvent *); void paintEvent(QPaintEvent *); void mousePressEvent (QMouseEvent *); void mouseMoveEvent (QMouseEvent *); diff --git a/src/gui/widgets/qtabbar_p.h b/src/gui/widgets/qtabbar_p.h index a3b07c90e..41d400a8e 100644 --- a/src/gui/widgets/qtabbar_p.h +++ b/src/gui/widgets/qtabbar_p.h @@ -177,7 +177,6 @@ public: void layoutTabs(); void layoutWidgets(int start = 0); void layoutTab(int index); - void updateMacBorderMetrics(); void setupMovableTab(); void makeVisible(int index); diff --git a/src/gui/widgets/qtextbrowser.cpp b/src/gui/widgets/qtextbrowser.cpp index 1b8f427de..5b0f1eb7b 100644 --- a/src/gui/widgets/qtextbrowser.cpp +++ b/src/gui/widgets/qtextbrowser.cpp @@ -979,30 +979,6 @@ void QTextBrowser::keyPressEvent(QKeyEvent *ev) /*! \reimp */ -void QTextBrowser::mouseMoveEvent(QMouseEvent *e) -{ - QTextEdit::mouseMoveEvent(e); -} - -/*! - \reimp -*/ -void QTextBrowser::mousePressEvent(QMouseEvent *e) -{ - QTextEdit::mousePressEvent(e); -} - -/*! - \reimp -*/ -void QTextBrowser::mouseReleaseEvent(QMouseEvent *e) -{ - QTextEdit::mouseReleaseEvent(e); -} - -/*! - \reimp -*/ void QTextBrowser::focusOutEvent(QFocusEvent *ev) { #ifndef QT_NO_CURSOR @@ -1250,12 +1226,6 @@ void QTextBrowser::setOpenLinks(bool open) d->openLinks = open; } -/*! \reimp */ -bool QTextBrowser::event(QEvent *e) -{ - return QTextEdit::event(e); -} - QT_END_NAMESPACE diff --git a/src/gui/widgets/qtextbrowser.h b/src/gui/widgets/qtextbrowser.h index 27ddc83e8..1477419d2 100644 --- a/src/gui/widgets/qtextbrowser.h +++ b/src/gui/widgets/qtextbrowser.h @@ -108,11 +108,7 @@ Q_SIGNALS: void anchorClicked(const QUrl &); protected: - bool event(QEvent *e); virtual void keyPressEvent(QKeyEvent *ev); - virtual void mouseMoveEvent(QMouseEvent *ev); - virtual void mousePressEvent(QMouseEvent *ev); - virtual void mouseReleaseEvent(QMouseEvent *ev); virtual void focusOutEvent(QFocusEvent *ev); virtual bool focusNextPrevChild(bool next); virtual void paintEvent(QPaintEvent *e); diff --git a/src/gui/widgets/qtoolbararealayout.cpp b/src/gui/widgets/qtoolbararealayout.cpp index d4c1733fa..ab3237a3d 100644 --- a/src/gui/widgets/qtoolbararealayout.cpp +++ b/src/gui/widgets/qtoolbararealayout.cpp @@ -652,9 +652,7 @@ QRect QToolBarAreaLayout::fitLayout() docks[QInternal::BottomDock].rect = QRect(rect.left(), center.bottom() + 1, rect.width(), bottom_hint.height()); - if (!mainWindow->unifiedTitleAndToolBarOnMac()) { - docks[QInternal::TopDock].fitLayout(); - } + docks[QInternal::TopDock].fitLayout(); docks[QInternal::LeftDock].fitLayout(); docks[QInternal::RightDock].fitLayout(); docks[QInternal::BottomDock].fitLayout(); @@ -1312,8 +1310,6 @@ bool QToolBarAreaLayout::restoreState(QDataStream &stream, const QList toolBars = _toolBars; int lines; stream >> lines; - if (!testing) - testing = mainWindow->unifiedTitleAndToolBarOnMac(); for (int j = 0; j < lines; ++j) { int pos; @@ -1324,7 +1320,7 @@ bool QToolBarAreaLayout::restoreState(QDataStream &stream, const QList> cnt; QToolBarAreaLayoutInfo &dock = docks[pos]; - const bool applyingLayout = !testing && !(pos == QInternal::TopDock && mainWindow->unifiedTitleAndToolBarOnMac()); + const bool applyingLayout = !testing && !pos == QInternal::TopDock; QToolBarAreaLayoutLine line(dock.o); for (int k = 0; k < cnt; ++k) { diff --git a/src/gui/widgets/qtoolbarlayout.cpp b/src/gui/widgets/qtoolbarlayout.cpp index d1b7ad49b..d1a65d4dd 100644 --- a/src/gui/widgets/qtoolbarlayout.cpp +++ b/src/gui/widgets/qtoolbarlayout.cpp @@ -333,20 +333,6 @@ void QToolBarLayout::updateGeomArray() const rpick(o, that->hint) += handleExtent; that->hint += QSize(2*margin, 2*margin); that->dirty = false; -#ifdef Q_WS_MAC - if (QMainWindow *mw = qobject_cast(parentWidget()->parentWidget())) { - if (mw->unifiedTitleAndToolBarOnMac() - && mw->toolBarArea(static_cast(parentWidget())) == Qt::TopToolBarArea) { - if (expandFlag) { - tb->setMaximumSize(0xFFFFFF, 0xFFFFFF); - } else { - tb->setMaximumSize(hint); - } - } - } -#endif - - that->dirty = false; } static bool defaultWidgetAction(QToolBarItem *item) @@ -401,18 +387,6 @@ void QToolBarLayout::setGeometry(const QRect &rect) if (!extension->isHidden()) extension->hide(); } -#ifdef Q_WS_MAC - // Nothing to do for Carbon... probably -# ifdef QT_MAC_USE_COCOA - if (QMainWindow *win = qobject_cast(tb->parentWidget())) { - Qt::ToolBarArea area = win->toolBarArea(tb); - if (win->unifiedTitleAndToolBarOnMac() && area == Qt::TopToolBarArea) { - qt_mainwindow_layout(win)->fixSizeInUnifiedToolbar(tb); - } - } -# endif -#endif - } bool QToolBarLayout::layoutActions(const QSize &size) diff --git a/src/gui/widgets/qtoolbox.cpp b/src/gui/widgets/qtoolbox.cpp index ac2ec8c66..1637b9dbf 100644 --- a/src/gui/widgets/qtoolbox.cpp +++ b/src/gui/widgets/qtoolbox.cpp @@ -794,12 +794,6 @@ void QToolBox::itemRemoved(int index) \sa setMargin(), QWidget::getContentsMargins() */ -/*! \reimp */ -bool QToolBox::event(QEvent *e) -{ - return QFrame::event(e); -} - QT_END_NAMESPACE #include "moc_qtoolbox.cpp" diff --git a/src/gui/widgets/qtoolbox.h b/src/gui/widgets/qtoolbox.h index ebbebc94a..acf7d7cfc 100644 --- a/src/gui/widgets/qtoolbox.h +++ b/src/gui/widgets/qtoolbox.h @@ -99,7 +99,6 @@ Q_SIGNALS: void currentChanged(int index); protected: - bool event(QEvent *e); virtual void itemInserted(int index); virtual void itemRemoved(int index); void showEvent(QShowEvent *e); diff --git a/src/scripttools/debugging/qscriptenginedebugger.cpp b/src/scripttools/debugging/qscriptenginedebugger.cpp index fb0716719..3c9bb7b49 100644 --- a/src/scripttools/debugging/qscriptenginedebugger.cpp +++ b/src/scripttools/debugging/qscriptenginedebugger.cpp @@ -594,7 +594,6 @@ QMainWindow *QScriptEngineDebugger::standardWindow() const win->setCentralWidget(central); win->setWindowTitle(tr("Qt Script Debugger")); - win->setUnifiedTitleAndToolBarOnMac(true); QSettings settings(QSettings::UserScope, QLatin1String("Trolltech")); QVariant geometry = settings.value(QLatin1String("Qt/scripttools/debugging/mainWindowGeometry")); diff --git a/src/test/qtestcase.cpp b/src/test/qtestcase.cpp index 451ed58af..db779994d 100644 --- a/src/test/qtestcase.cpp +++ b/src/test/qtestcase.cpp @@ -66,25 +66,9 @@ #include #include #include - -#ifdef Q_OS_WIN -#include // for Sleep -#endif -#ifdef Q_OS_UNIX #include #include #include -#endif - -#ifdef Q_WS_MAC -#include // for SetFrontProcess -#ifdef QT_MAC_USE_COCOA -#include -#else -#include -#endif -#undef verify -#endif QT_BEGIN_NAMESPACE @@ -1844,38 +1828,10 @@ int QTest::qExec(QObject *testObject, int argc, char **argv) int callgrindChildExitCode = 0; #endif -#ifdef Q_WS_MAC - bool macNeedsActivate = qApp && (qstrcmp(qApp->metaObject()->className(), "QApplication") == 0); -#ifdef QT_MAC_USE_COCOA - IOPMAssertionID powerID; -#endif -#endif #ifndef QT_NO_EXCEPTIONS try { #endif - #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) - SetErrorMode(SetErrorMode(0) | SEM_NOGPFAULTERRORBOX); - #endif - -#ifdef Q_WS_MAC - // Starting with Qt 4.4, applications launched from the command line - // no longer get focus automatically. Since some tests might depend - // on this, call SetFrontProcess here to get the pre 4.4 behavior. - if (macNeedsActivate) { - ProcessSerialNumber psn = { 0, kCurrentProcess }; - SetFrontProcess(&psn); -# ifdef QT_MAC_USE_COCOA - IOReturn ok = IOPMAssertionCreate(kIOPMAssertionTypeNoDisplaySleep, kIOPMAssertionLevelOn, &powerID); - if (ok != kIOReturnSuccess) - macNeedsActivate = false; // no need to release the assertion on exit. -# else - UpdateSystemActivity(1); // Wake the display. -# endif - } -#endif - - QTestResult::reset(); QTEST_ASSERT(testObject); @@ -1913,33 +1869,23 @@ int QTest::qExec(QObject *testObject, int argc, char **argv) } #ifndef QT_NO_EXCEPTIONS - } catch (...) { - QTestResult::addFailure("Caught unhandled exception", __FILE__, __LINE__); - if (QTestResult::currentTestFunction()) { + } catch (...) { + QTestResult::addFailure("Caught unhandled exception", __FILE__, __LINE__); + if (QTestResult::currentTestFunction()) { QTestResult::finishedCurrentTestFunction(); QTestResult::setCurrentTestFunction(0); - } + } QTestLog::stopLogging(); -#ifdef QT_MAC_USE_COCOA - if (macNeedsActivate) { - IOPMAssertionRelease(powerID); - } -#endif - currentTestObject = 0; + currentTestObject = 0; - // Rethrow exception to make debugging easier. - throw; - return 1; - } + // Rethrow exception to make debugging easier. + throw; + return 1; + } # endif currentTestObject = 0; -#ifdef QT_MAC_USE_COCOA - if (macNeedsActivate) { - IOPMAssertionRelease(powerID); - } -#endif #if defined(QTEST_NOEXITCODE) return 0; diff --git a/src/test/qtestmouse.h b/src/test/qtestmouse.h index 428db120b..1cf538d1e 100644 --- a/src/test/qtestmouse.h +++ b/src/test/qtestmouse.h @@ -101,11 +101,7 @@ namespace QTest break; case MouseMove: QCursor::setPos(widget->mapToGlobal(pos)); -#ifdef QT_MAC_USE_COCOA - QTest::qWait(20); -#else qApp->processEvents(); -#endif return; default: QTEST_ASSERT(false); diff --git a/src/tools/designer/qdesigner_workbench.cpp b/src/tools/designer/qdesigner_workbench.cpp index 3364cfa57..b98748fda 100644 --- a/src/tools/designer/qdesigner_workbench.cpp +++ b/src/tools/designer/qdesigner_workbench.cpp @@ -413,16 +413,13 @@ void QDesignerWorkbench::switchToDockedMode() #ifdef Q_WS_X11 QApplication::setAttribute(Qt::AA_DontUseNativeMenuBar, false); #endif -#ifndef Q_WS_MAC QDesignerToolWindow *widgetBoxWrapper = widgetBoxToolWindow(); widgetBoxWrapper->action()->setVisible(true); widgetBoxWrapper->setWindowTitle(tr("Widget Box")); -#endif m_mode = DockedMode; const QDesignerSettings settings(m_core); m_dockedMainWindow = new DockedMainWindow(this, m_toolbarMenu, m_toolWindows); - m_dockedMainWindow->setUnifiedTitleAndToolBarOnMac(true); m_dockedMainWindow->setCloseEventPolicy(MainWindowBase::EmitCloseEventSignal); connect(m_dockedMainWindow, SIGNAL(closeEventReceived(QCloseEvent*)), this, SLOT(handleCloseEvent(QCloseEvent*))); connect(m_dockedMainWindow, SIGNAL(fileDropped(QString)), this, SLOT(slotFileDropped(QString))); @@ -431,10 +428,8 @@ void QDesignerWorkbench::switchToDockedMode() m_core->setTopLevel(m_dockedMainWindow); -#ifndef Q_WS_MAC m_dockedMainWindow->setMenuBar(m_globalMenuBar); m_globalMenuBar->show(); -#endif qDesigner->setMainWindow(m_dockedMainWindow); foreach (QDesignerFormWindow *fw, m_formWindows) { -- 2.11.0