diff options
Diffstat (limited to 'src/widgets/widgets')
24 files changed, 42 insertions, 477 deletions
diff --git a/src/widgets/widgets/qabstractscrollarea.cpp b/src/widgets/widgets/qabstractscrollarea.cpp index 55b2dcd662..b295e66574 100644 --- a/src/widgets/widgets/qabstractscrollarea.cpp +++ b/src/widgets/widgets/qabstractscrollarea.cpp @@ -62,10 +62,6 @@ #include <private/qapplication_p.h> -#if 0 // Used to be included in Qt4 for Q_WS_MAC -#include <private/qt_mac_p.h> -#include <private/qt_cocoa_helpers_mac_p.h> -#endif #ifdef Q_OS_WIN # include <qt_windows.h> #endif @@ -169,9 +165,6 @@ QAbstractScrollAreaPrivate::QAbstractScrollAreaPrivate() shownOnce(false), inResize(false), sizeAdjustPolicy(QAbstractScrollArea::AdjustIgnored), viewport(0), cornerWidget(0), left(0), top(0), right(0), bottom(0), xoffset(0), yoffset(0), viewportFilter(0) -#if 0 // Used to be included in Qt4 for Q_WS_WIN - , singleFingerPanEnabled(false) -#endif { } @@ -322,16 +315,6 @@ void QAbstractScrollAreaPrivate::init() #endif } -#if 0 // Used to be included in Qt4 for Q_WS_WIN -void QAbstractScrollAreaPrivate::setSingleFingerPanEnabled(bool on) -{ - singleFingerPanEnabled = on; - QWidgetPrivate *dd = static_cast<QWidgetPrivate *>(QObjectPrivate::get(viewport)); - if (dd) - dd->winSetupGestures(); -} -#endif - void QAbstractScrollAreaPrivate::layoutChildren() { bool needH = false; @@ -362,38 +345,6 @@ void QAbstractScrollAreaPrivate::layoutChildren_helper(bool *needHorizontalScrol const int hscrollOverlap = hbar->style()->pixelMetric(QStyle::PM_ScrollView_ScrollBarOverlap, &opt, hbar); const int vscrollOverlap = vbar->style()->pixelMetric(QStyle::PM_ScrollView_ScrollBarOverlap, &opt, vbar); -#if 0 // Used to be included in Qt4 for Q_WS_MAC - QWidget * const window = q->window(); - - // Use small scroll bars for tool windows, to match the native size grip. - bool hbarIsSmall = hbar->testAttribute(Qt::WA_MacSmallSize); - bool vbarIsSmall = vbar->testAttribute(Qt::WA_MacSmallSize); - const Qt::WindowType windowType = window->windowType(); - if (windowType == Qt::Tool) { - if (!hbarIsSmall) { - hbar->setAttribute(Qt::WA_MacMiniSize, false); - hbar->setAttribute(Qt::WA_MacNormalSize, false); - hbar->setAttribute(Qt::WA_MacSmallSize, true); - } - if (!vbarIsSmall) { - vbar->setAttribute(Qt::WA_MacMiniSize, false); - vbar->setAttribute(Qt::WA_MacNormalSize, false); - vbar->setAttribute(Qt::WA_MacSmallSize, true); - } - } else { - if (hbarIsSmall) { - hbar->setAttribute(Qt::WA_MacMiniSize, false); - hbar->setAttribute(Qt::WA_MacNormalSize, false); - hbar->setAttribute(Qt::WA_MacSmallSize, false); - } - if (vbarIsSmall) { - vbar->setAttribute(Qt::WA_MacMiniSize, false); - vbar->setAttribute(Qt::WA_MacNormalSize, false); - vbar->setAttribute(Qt::WA_MacSmallSize, false); - } - } -#endif - const int hsbExt = hbar->sizeHint().height(); const int vsbExt = vbar->sizeHint().width(); const QPoint extPoint(vsbExt, hsbExt); @@ -403,30 +354,6 @@ void QAbstractScrollAreaPrivate::layoutChildren_helper(bool *needHorizontalScrol const bool hasCornerWidget = (cornerWidget != 0); -// If the scroll bars are at the very right and bottom of the window we -// move their positions to be aligned with the size grip. -#if 0 // Used to be included in Qt4 for Q_WS_MAC - // Check if a native sizegrip is present. - bool hasMacReverseSizeGrip = false; - bool hasMacSizeGrip = false; - bool nativeGripPresent = false; - if (q->testAttribute(Qt::WA_WState_Created)) - nativeGripPresent = qt_mac_checkForNativeSizeGrip(q); - - if (nativeGripPresent) { - // Look for a native size grip at the visual window bottom right and at the - // absolute window bottom right. In reverse mode, the native size grip does not - // swich side, so we need to check if it is on the "wrong side". - const QPoint scrollAreaBottomRight = q->mapTo(window, widgetRect.bottomRight() - QPoint(frameWidth, frameWidth)); - const QPoint windowBottomRight = window->rect().bottomRight(); - const QPoint visualWindowBottomRight = QStyle::visualPos(opt.direction, opt.rect, windowBottomRight); - const QPoint offset = windowBottomRight - scrollAreaBottomRight; - const QPoint visualOffset = visualWindowBottomRight - scrollAreaBottomRight; - hasMacSizeGrip = (visualOffset.manhattanLength() < vsbExt); - hasMacReverseSizeGrip = (hasMacSizeGrip == false && (offset.manhattanLength() < hsbExt)); - } -#endif - QPoint cornerOffset((needv && vscrollOverlap == 0) ? vsbExt : 0, (needh && hscrollOverlap == 0) ? hsbExt : 0); QRect controlsRect; QRect viewportRect; @@ -458,12 +385,6 @@ void QAbstractScrollAreaPrivate::layoutChildren_helper(bool *needHorizontalScrol if (hasCornerWidget && ((needv && vscrollOverlap == 0) || (needh && hscrollOverlap == 0))) cornerOffset = extPoint; -#if 0 // Used to be included in Qt4 for Q_WS_MAC - // Also move the scroll bars if they are covered by the native Mac size grip. - if (hasMacSizeGrip) - cornerOffset = extPoint; -#endif - // The corner point is where the scroll bar rects, the corner widget rect and the // viewport rect meets. const QPoint cornerPoint(controlsRect.bottomRight() + QPoint(1, 1) - cornerOffset); @@ -475,13 +396,6 @@ void QAbstractScrollAreaPrivate::layoutChildren_helper(bool *needHorizontalScrol else cornerPaintingRect = QRect(); -#if 0 // Used to be included in Qt4 for Q_WS_MAC - if (hasMacReverseSizeGrip) - reverseCornerPaintingRect = QRect(controlsRect.bottomRight() + QPoint(1, 1) - extPoint, extSize); - else - reverseCornerPaintingRect = QRect(); -#endif - // move the scrollbars away from top/left headers int vHeaderRight = 0; int hHeaderBottom = 0; @@ -501,10 +415,7 @@ void QAbstractScrollAreaPrivate::layoutChildren_helper(bool *needHorizontalScrol #endif // QT_CONFIG(itemviews) if (needh) { QRect horizontalScrollBarRect(QPoint(controlsRect.left() + vHeaderRight, cornerPoint.y()), QPoint(cornerPoint.x() - 1, controlsRect.bottom())); -#if 0 // Used to be included in Qt4 for Q_WS_MAC - if (hasMacReverseSizeGrip) - horizontalScrollBarRect.adjust(vsbExt, 0, 0, 0); -#endif + if (!hasCornerWidget && htransient) horizontalScrollBarRect.adjust(0, 0, cornerOffset.x(), 0); scrollBarContainers[Qt::Horizontal]->setGeometry(QStyle::visualRect(opt.direction, opt.rect, horizontalScrollBarRect)); @@ -617,11 +528,9 @@ void QAbstractScrollArea::setViewport(QWidget *widget) d->viewport->setParent(this); d->viewport->setFocusProxy(this); d->viewport->installEventFilter(d->viewportFilter.data()); -#if 1 // Used to be excluded in Qt4 for Q_WS_MAC #ifndef QT_NO_GESTURES d->viewport->grabGesture(Qt::PanGesture); #endif -#endif d->layoutChildren(); #ifndef QT_NO_OPENGL QWidgetPrivate::get(d->viewport)->initializeViewportFramebuffer(); @@ -1043,13 +952,6 @@ bool QAbstractScrollArea::event(QEvent *e) QPainter p(this); style()->drawPrimitive(QStyle::PE_PanelScrollAreaCorner, &option, &p, this); } -#if 0 // Used to be included in Qt4 for Q_WS_MAC - if (d->reverseCornerPaintingRect.isValid()) { - option.rect = d->reverseCornerPaintingRect; - QPainter p(this); - style()->drawPrimitive(QStyle::PE_PanelScrollAreaCorner, &option, &p, this); - } -#endif } QFrame::paintEvent((QPaintEvent*)e); break; @@ -1122,38 +1024,10 @@ bool QAbstractScrollArea::event(QEvent *e) hBar->setValue(se->contentPos().x()); vBar->setValue(se->contentPos().y()); -#if 0 // Used to be included in Qt4 for Q_WS_WIN - typedef BOOL (*PtrBeginPanningFeedback)(HWND); - typedef BOOL (*PtrUpdatePanningFeedback)(HWND, LONG, LONG, BOOL); - typedef BOOL (*PtrEndPanningFeedback)(HWND, BOOL); - - static PtrBeginPanningFeedback ptrBeginPanningFeedback = 0; - static PtrUpdatePanningFeedback ptrUpdatePanningFeedback = 0; - static PtrEndPanningFeedback ptrEndPanningFeedback = 0; - - if (!ptrBeginPanningFeedback) - ptrBeginPanningFeedback = (PtrBeginPanningFeedback) QLibrary::resolve(QLatin1String("UxTheme"), "BeginPanningFeedback"); - if (!ptrUpdatePanningFeedback) - ptrUpdatePanningFeedback = (PtrUpdatePanningFeedback) QLibrary::resolve(QLatin1String("UxTheme"), "UpdatePanningFeedback"); - if (!ptrEndPanningFeedback) - ptrEndPanningFeedback = (PtrEndPanningFeedback) QLibrary::resolve(QLatin1String("UxTheme"), "EndPanningFeedback"); - - if (ptrBeginPanningFeedback && ptrUpdatePanningFeedback && ptrEndPanningFeedback) { - WId wid = window()->winId(); - - if (!se->overshootDistance().isNull() && d->overshoot.isNull()) - ptrBeginPanningFeedback(wid); - if (!se->overshootDistance().isNull()) - ptrUpdatePanningFeedback(wid, -se->overshootDistance().x(), -se->overshootDistance().y(), false); - if (se->overshootDistance().isNull() && !d->overshoot.isNull()) - ptrEndPanningFeedback(wid, true); - } else -#endif - { - QPoint delta = d->overshoot - se->overshootDistance().toPoint(); - if (!delta.isNull()) - viewport()->move(viewport()->pos() + delta); - } + QPoint delta = d->overshoot - se->overshootDistance().toPoint(); + if (!delta.isNull()) + viewport()->move(viewport()->pos() + delta); + d->overshoot = se->overshootDistance().toPoint(); return true; @@ -1546,13 +1420,6 @@ void QAbstractScrollAreaPrivate::_q_vslide(int y) void QAbstractScrollAreaPrivate::_q_showOrHideScrollBars() { layoutChildren(); -#if 0 // Used to be included in Qt4 for Q_WS_WIN - // Need to re-subscribe to gestures as the content changes to make sure we - // enable/disable panning when needed. - QWidgetPrivate *dd = static_cast<QWidgetPrivate *>(QObjectPrivate::get(viewport)); - if (dd) - dd->winSetupGestures(); -#endif } QPoint QAbstractScrollAreaPrivate::contentsOffset() const diff --git a/src/widgets/widgets/qabstractscrollarea_p.h b/src/widgets/widgets/qabstractscrollarea_p.h index 732a2ab40d..6d78b9db6d 100644 --- a/src/widgets/widgets/qabstractscrollarea_p.h +++ b/src/widgets/widgets/qabstractscrollarea_p.h @@ -85,9 +85,7 @@ public: QWidget *viewport; QWidget *cornerWidget; QRect cornerPaintingRect; -#if 0 // Used to be included in Qt4 for Q_WS_MAC - QRect reverseCornerPaintingRect; -#endif + int left, top, right, bottom; // viewport margin int xoffset, yoffset; @@ -112,11 +110,6 @@ public: inline bool viewportEvent(QEvent *event) { return q_func()->viewportEvent(event); } QScopedPointer<QObject> viewportFilter; - -#if 0 // Used to be included in Qt4 for Q_WS_WIN - bool singleFingerPanEnabled; - void setSingleFingerPanEnabled(bool on = true); -#endif }; class QAbstractScrollAreaFilter : public QObject diff --git a/src/widgets/widgets/qabstractslider.cpp b/src/widgets/widgets/qabstractslider.cpp index 129d540f50..dc325ab871 100644 --- a/src/widgets/widgets/qabstractslider.cpp +++ b/src/widgets/widgets/qabstractslider.cpp @@ -721,15 +721,10 @@ bool QAbstractSliderPrivate::scrollByDelta(Qt::Orientation orientation, Qt::Keyb offset_accumulated = 0; offset_accumulated += stepsToScrollF; -#if 1 // Used to be excluded in Qt4 for Q_WS_MAC + // Don't scroll more than one page in any case: stepsToScroll = qBound(-pageStep, int(offset_accumulated), pageStep); -#else - // Native UI-elements on Mac can scroll hundreds of lines at a time as - // a result of acceleration. So keep the same behaviour in Qt, and - // don't restrict stepsToScroll to certain maximum (pageStep): - stepsToScroll = int(offset_accumulated); -#endif + offset_accumulated -= int(offset_accumulated); if (stepsToScroll == 0) { // We moved less than a line, but might still have accumulated partial scroll, diff --git a/src/widgets/widgets/qcalendarwidget.cpp b/src/widgets/widgets/qcalendarwidget.cpp index 78706b1854..81cc0b833a 100644 --- a/src/widgets/widgets/qcalendarwidget.cpp +++ b/src/widgets/widgets/qcalendarwidget.cpp @@ -1585,7 +1585,6 @@ protected: { Q_UNUSED(e) -#if 1 // Used to be excluded in Qt4 for Q_WS_MAC QStyleOptionToolButton opt; initStyleOption(&opt); @@ -1598,7 +1597,7 @@ protected: toolPalette.setColor(QPalette::ButtonText, toolPalette.color(QPalette::HighlightedText)); setPalette(toolPalette); } -#endif + QToolButton::paintEvent(e); } }; diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp index 68f19cc334..e73c63f657 100644 --- a/src/widgets/widgets/qcombobox.cpp +++ b/src/widgets/widgets/qcombobox.cpp @@ -447,13 +447,6 @@ void QComboBoxPrivateContainer::paintEvent(QPaintEvent *e) void QComboBoxPrivateContainer::leaveEvent(QEvent *) { -// On Mac using the Mac style we want to clear the selection -// when the mouse moves outside the popup. -#if 0 // Used to be included in Qt4 for Q_WS_MAC - QStyleOptionComboBox opt = comboStyleOption(); - if (combo->style()->styleHint(QStyle::SH_ComboBox_Popup, &opt, combo)) - view->clearSelection(); -#endif } QComboBoxPrivateContainer::QComboBoxPrivateContainer(QAbstractItemView *itemView, QComboBox *parent) diff --git a/src/widgets/widgets/qdatetimeedit.cpp b/src/widgets/widgets/qdatetimeedit.cpp index 3c92d4be0e..17dc94bba1 100644 --- a/src/widgets/widgets/qdatetimeedit.cpp +++ b/src/widgets/widgets/qdatetimeedit.cpp @@ -1125,16 +1125,6 @@ void QDateTimeEdit::keyPressEvent(QKeyEvent *event) select = false; break; } -#if 0 // Used to be included in Qt4 for Q_WS_MAC - else -#ifdef QT_KEYPAD_NAVIGATION - if (!QApplicationPrivate::keypadNavigationEnabled()) -#endif - { - select = (event->modifiers() & Qt::ShiftModifier); - break; - } -#endif } Q_FALLTHROUGH(); case Qt::Key_Backtab: diff --git a/src/widgets/widgets/qdockarealayout.cpp b/src/widgets/widgets/qdockarealayout.cpp index 55ae42db04..9be99c4723 100644 --- a/src/widgets/widgets/qdockarealayout.cpp +++ b/src/widgets/widgets/qdockarealayout.cpp @@ -1934,11 +1934,6 @@ bool QDockAreaLayoutInfo::restoreState(QDataStream &stream, QList<QDockWidget*> QDockAreaLayoutItem item(new QDockWidgetItem(widget)); if (flags & StateFlagFloating) { bool drawer = false; -#if 0 // Used to be included in Qt4 for Q_WS_MAC // drawer support - extern bool qt_mac_is_macdrawer(const QWidget *); //qwidget_mac.cpp - extern bool qt_mac_set_drawer_preferred_edge(QWidget *, Qt::DockWidgetArea); //qwidget_mac.cpp - drawer = qt_mac_is_macdrawer(widget); -#endif if (!testing) { widget->hide(); @@ -1949,13 +1944,6 @@ bool QDockAreaLayoutInfo::restoreState(QDataStream &stream, QList<QDockWidget*> int x, y, w, h; stream >> x >> y >> w >> h; -#if 0 // Used to be included in Qt4 for Q_WS_MAC // drawer support - if (drawer) { - mainWindow->window()->createWinId(); - widget->window()->createWinId(); - qt_mac_set_drawer_preferred_edge(widget, toDockWidgetArea(dockPos)); - } else -#endif if (!testing) widget->setGeometry(QDockAreaLayout::constrainedRect(QRect(x, y, w, h), widget)); @@ -2049,9 +2037,8 @@ void QDockAreaLayoutInfo::updateSeparatorWidgets() const } j++; -#if 1 // Used to be excluded in Qt4 for Q_WS_MAC sepWidget->raise(); -#endif + QRect sepRect = separatorRect(i).adjusted(-2, -2, 2, 2); sepWidget->setGeometry(sepRect); sepWidget->setMask( QRegion(separatorRect(i).translated( - sepRect.topLeft()))); @@ -3090,10 +3077,6 @@ bool QDockAreaLayout::restoreDockWidget(QDockWidget *dockWidget) dockWidget->d_func()->setWindowState(true, true, r); } dockWidget->setVisible(!placeHolder->hidden); -#if 0 // Used to be included in Qt4 for Q_WS_X11 - if (placeHolder->window) // gets rid of the X11BypassWindowManager window flag - dockWidget->d_func()->setWindowState(true); -#endif item->placeHolderItem = 0; delete placeHolder; @@ -3340,9 +3323,8 @@ void QDockAreaLayout::updateSeparatorWidgets() const } j++; -#if 1 // Used to be excluded in Qt4 for Q_WS_MAC 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/widgets/widgets/qdockwidget.cpp b/src/widgets/widgets/qdockwidget.cpp index 28a7cee2a0..1ba34e0fed 100644 --- a/src/widgets/widgets/qdockwidget.cpp +++ b/src/widgets/widgets/qdockwidget.cpp @@ -977,11 +977,7 @@ bool QDockWidgetPrivate::mouseMoveEvent(QMouseEvent *event) && (event->pos() - state->pressPos).manhattanLength() > QApplication::startDragDistance()) { startDrag(); -#if 0 // Used to be included in Qt4 for Q_WS_WIN - grabMouseWhileInWindow(); -#else q->grabMouse(); -#endif ret = true; } } @@ -1029,13 +1025,6 @@ void QDockWidgetPrivate::nonClientAreaMouseEvent(QMouseEvent *event) QWidget *tl = q->topLevelWidget(); QRect geo = tl->geometry(); QRect titleRect = tl->frameGeometry(); -#if 0 // Used to be included in Qt4 for Q_WS_MAC - if ((features & QDockWidget::DockWidgetVerticalTitleBar)) { - titleRect.setTop(geo.top()); - titleRect.setBottom(geo.bottom()); - titleRect.setRight(geo.left() - 1); - } else -#endif { titleRect.setLeft(geo.left()); titleRect.setRight(geo.right()); @@ -1588,17 +1577,6 @@ bool QDockWidget::event(QEvent *event) if (d->mouseMoveEvent(static_cast<QMouseEvent *>(event))) return true; break; -#if 0 // Used to be included in Qt4 for Q_WS_WIN - case QEvent::Leave: - if (d->state != 0 && d->state->dragging && !d->state->nca) { - // This is a workaround for loosing the mouse on Vista. - QPoint pos = QCursor::pos(); - QMouseEvent fake(QEvent::MouseMove, mapFromGlobal(pos), pos, Qt::NoButton, - QGuiApplication::mouseButtons(), QGuiApplication::keyboardModifiers()); - d->mouseMoveEvent(&fake); - } - break; -#endif case QEvent::MouseButtonRelease: if (d->mouseReleaseEvent(static_cast<QMouseEvent *>(event))) return true; diff --git a/src/widgets/widgets/qmaccocoaviewcontainer_mac.mm b/src/widgets/widgets/qmaccocoaviewcontainer_mac.mm index 0b64b2a2bb..88baf0410b 100644 --- a/src/widgets/widgets/qmaccocoaviewcontainer_mac.mm +++ b/src/widgets/widgets/qmaccocoaviewcontainer_mac.mm @@ -82,8 +82,32 @@ The following is a snippet showing how to subclass QMacCocoaViewContainer to wrap an NSSearchField. - \snippet macmainwindow.mm 0 + \code + SearchWidget::SearchWidget(QWidget *parent) + : QMacCocoaViewContainer(0, parent) + { + // Many Cocoa objects create temporary autorelease objects, + // so create a pool to catch them. + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + + // Create the NSSearchField, set it on the QCocoaViewContainer. + NSSearchField *search = [[NSSearchField alloc] init]; + setCocoaView(search); + + // Use a Qt menu for the search field menu. + QMenu *qtMenu = createMenu(this); + NSMenu *nsMenu = qtMenu->macMenu(0); + [[search cell] setSearchMenuTemplate:nsMenu]; + + // Release our reference, since our super class takes ownership and we + // don't need it anymore. + [search release]; + + // Clean up our pool as we no longer need it. + [pool release]; + } + \endcode */ QT_BEGIN_NAMESPACE diff --git a/src/widgets/widgets/qmdiarea.cpp b/src/widgets/widgets/qmdiarea.cpp index c7b7e5bf97..6e3de1b1ff 100644 --- a/src/widgets/widgets/qmdiarea.cpp +++ b/src/widgets/widgets/qmdiarea.cpp @@ -2493,13 +2493,6 @@ bool QMdiArea::event(QEvent *event) { Q_D(QMdiArea); switch (event->type()) { -#if 0 // Used to be included in Qt4 for Q_WS_WIN - // QWidgetPrivate::hide_helper activates another sub-window when closing a - // modal dialog on Windows (see activateWindow() inside the ifdef). - case QEvent::WindowUnblocked: - d->activateCurrentWindow(); - break; -#endif case QEvent::WindowActivate: { d->isActivated = true; if (d->childWindows.isEmpty()) @@ -2557,11 +2550,7 @@ bool QMdiArea::eventFilter(QObject *object, QEvent *event) QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event); // Ingore key events without a Ctrl modifier (except for press/release on the modifier itself). -#if 0 // Used to be included in Qt4 for Q_WS_MAC - if (!(keyEvent->modifiers() & Qt::MetaModifier) && keyEvent->key() != Qt::Key_Meta) -#else if (!(keyEvent->modifiers() & Qt::ControlModifier) && keyEvent->key() != Qt::Key_Control) -#endif return QAbstractScrollArea::eventFilter(object, event); // Find closest mdi area (in case we have a nested workspace). @@ -2576,11 +2565,7 @@ bool QMdiArea::eventFilter(QObject *object, QEvent *event) // 3) Ctrl-Shift-Tab (Tab, Tab, ...) -> iterate through all windows in the opposite // direction (activatePreviousSubWindow()) switch (keyEvent->key()) { -#if 0 // Used to be included in Qt4 for Q_WS_MAC - case Qt::Key_Meta: -#else case Qt::Key_Control: -#endif if (keyPress) area->d_func()->startTabToPreviousTimer(); else diff --git a/src/widgets/widgets/qmdisubwindow.cpp b/src/widgets/widgets/qmdisubwindow.cpp index 474cce983c..d58a1d06db 100644 --- a/src/widgets/widgets/qmdisubwindow.cpp +++ b/src/widgets/widgets/qmdisubwindow.cpp @@ -288,13 +288,6 @@ static inline bool isHoverControl(QStyle::SubControl control) return control != QStyle::SC_None && control != QStyle::SC_TitleBarLabel; } -#if 0 // Used to be included in Qt4 for Q_WS_WIN -static inline QRgb colorref2qrgb(COLORREF col) -{ - return qRgb(GetRValue(col),GetGValue(col),GetBValue(col)); -} -#endif - #ifndef QT_NO_TOOLTIP static void showToolTip(QHelpEvent *helpEvent, QWidget *widget, const QStyleOptionComplex &opt, QStyle::ComplexControl complexControl, QStyle::SubControl subControl) @@ -1926,43 +1919,7 @@ QPalette QMdiSubWindowPrivate::desktopPalette() const QPalette newPalette = q->palette(); bool colorsInitialized = false; -#if 0 // Used to be included in Qt4 for Q_WS_WIN // ask system properties on windows -#ifndef SPI_GETGRADIENTCAPTIONS -#define SPI_GETGRADIENTCAPTIONS 0x1008 -#endif -#ifndef COLOR_GRADIENTACTIVECAPTION -#define COLOR_GRADIENTACTIVECAPTION 27 -#endif -#ifndef COLOR_GRADIENTINACTIVECAPTION -#define COLOR_GRADIENTINACTIVECAPTION 28 -#endif - if (QGuiApplication::desktopSettingsAware()) { - newPalette.setColor(QPalette::Active, QPalette::Highlight, - colorref2qrgb(GetSysColor(COLOR_ACTIVECAPTION))); - newPalette.setColor(QPalette::Inactive, QPalette::Highlight, - colorref2qrgb(GetSysColor(COLOR_INACTIVECAPTION))); - newPalette.setColor(QPalette::Active, QPalette::HighlightedText, - colorref2qrgb(GetSysColor(COLOR_CAPTIONTEXT))); - newPalette.setColor(QPalette::Inactive, QPalette::HighlightedText, - colorref2qrgb(GetSysColor(COLOR_INACTIVECAPTIONTEXT))); - colorsInitialized = true; - BOOL hasGradient = false; - SystemParametersInfo(SPI_GETGRADIENTCAPTIONS, 0, &hasGradient, 0); - - if (hasGradient) { - newPalette.setColor(QPalette::Active, QPalette::Base, - colorref2qrgb(GetSysColor(COLOR_GRADIENTACTIVECAPTION))); - newPalette.setColor(QPalette::Inactive, QPalette::Base, - colorref2qrgb(GetSysColor(COLOR_GRADIENTINACTIVECAPTION))); - } else { - newPalette.setColor(QPalette::Active, QPalette::Base, - newPalette.color(QPalette::Active, QPalette::Highlight)); - newPalette.setColor(QPalette::Inactive, QPalette::Base, - newPalette.color(QPalette::Inactive, QPalette::Highlight)); - } - } -#endif if (!colorsInitialized) { newPalette.setColor(QPalette::Active, QPalette::Highlight, newPalette.color(QPalette::Active, QPalette::Highlight)); diff --git a/src/widgets/widgets/qplaintextedit.cpp b/src/widgets/widgets/qplaintextedit.cpp index 8843797430..0a81931b57 100644 --- a/src/widgets/widgets/qplaintextedit.cpp +++ b/src/widgets/widgets/qplaintextedit.cpp @@ -825,9 +825,6 @@ void QPlainTextEditPrivate::init(const QString &txt) viewport->setCursor(Qt::IBeamCursor); #endif originalOffsetY = 0; -#if 0 // Used to be included in Qt4 for Q_WS_WIN - setSingleFingerPanEnabled(true); -#endif } void QPlainTextEditPrivate::_q_textChanged() diff --git a/src/widgets/widgets/qpushbutton.cpp b/src/widgets/widgets/qpushbutton.cpp index b578aa0b18..f48b5706f7 100644 --- a/src/widgets/widgets/qpushbutton.cpp +++ b/src/widgets/widgets/qpushbutton.cpp @@ -684,38 +684,6 @@ bool QPushButton::event(QEvent *e) return QAbstractButton::event(e); } -#if 0 // Used to be included in Qt4 for 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<QPushButtonPrivate *>(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 - - QT_END_NAMESPACE #include "moc_qpushbutton.cpp" diff --git a/src/widgets/widgets/qpushbutton_p.h b/src/widgets/widgets/qpushbutton_p.h index a58675fe64..439b6e35d6 100644 --- a/src/widgets/widgets/qpushbutton_p.h +++ b/src/widgets/widgets/qpushbutton_p.h @@ -73,9 +73,6 @@ public: inline void init() { resetLayoutItemMargins(); } static QPushButtonPrivate* get(QPushButton *b) { return b->d_func(); } -#if 0 // Used to be included in Qt4 for Q_WS_MAC - bool hitButton(const QPoint &pos); -#endif #if QT_CONFIG(menu) QPoint adjustedMenuPosition(); #endif diff --git a/src/widgets/widgets/qrubberband.cpp b/src/widgets/widgets/qrubberband.cpp index ade8675db8..af730f8023 100644 --- a/src/widgets/widgets/qrubberband.cpp +++ b/src/widgets/widgets/qrubberband.cpp @@ -45,10 +45,6 @@ #include "qstyle.h" #include "qstyleoption.h" -#if 0 // Used to be included in Qt4 for Q_WS_MAC -# include <private/qt_mac_p.h> -# include <private/qt_cocoa_helpers_mac_p.h> -#endif #include <qdebug.h> @@ -140,18 +136,9 @@ QRubberBand::QRubberBand(Shape s, QWidget *p) Q_D(QRubberBand); d->shape = s; setAttribute(Qt::WA_TransparentForMouseEvents); -#if 1 // Used to be excluded in Qt4 for Q_WS_WIN setAttribute(Qt::WA_NoSystemBackground); -#endif setAttribute(Qt::WA_WState_ExplicitShowHide); setVisible(false); -#if 0 // Used to be included in Qt4 for Q_WS_MAC - if (isWindow()) { - createWinId(); - extern OSWindowRef qt_mac_window_for(const QWidget *); //qwidget_mac.cpp - macWindowSetHasShadow(qt_mac_window_for(this), false); - } -#endif } /*! diff --git a/src/widgets/widgets/qsizegrip.cpp b/src/widgets/widgets/qsizegrip.cpp index dc5a7158dd..835af9c7b8 100644 --- a/src/widgets/widgets/qsizegrip.cpp +++ b/src/widgets/widgets/qsizegrip.cpp @@ -50,10 +50,6 @@ #include "qdebug.h" #include <QDesktopWidget> -#if 0 // Used to be included in Qt4 for Q_WS_MAC -#include <private/qt_mac_p.h> -#endif - #include <private/qwidget_p.h> #include <private/qdesktopwidget_p.h> #include <QtWidgets/qabstractscrollarea.h> @@ -81,9 +77,7 @@ public: Qt::Corner m_corner; bool gotMousePress; QPointer<QWidget> tlw; -#if 0 // Used to be included in Qt4 for Q_WS_MAC - void updateMacSizer(bool hide) const; -#endif + Qt::Corner corner() const; inline bool atBottom() const { @@ -119,9 +113,7 @@ public: updateTopLevelWidget(); if (tlw && showSizeGrip) { Qt::WindowStates sizeGripNotVisibleState = Qt::WindowFullScreen; -#if 1 // Used to be excluded in Qt4 for Q_WS_MAC sizeGripNotVisibleState |= Qt::WindowMaximized; -#endif // Don't show the size grip if the tlw is maximized or in full screen mode. showSizeGrip = !(tlw->windowState() & sizeGripNotVisibleState); } @@ -141,18 +133,6 @@ QSizeGripPrivate::QSizeGripPrivate() { } -#if 0 // Used to be included in Qt4 for 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<QSizeGrip *>(q)); - if(topLevelWindow && topLevelWindow->isWindow()) - QWidgetPrivate::qt_mac_update_sizer(topLevelWindow, hide ? -1 : 1); -} -#endif - Qt::Corner QSizeGripPrivate::corner() const { Q_Q(const QSizeGrip); @@ -227,7 +207,7 @@ void QSizeGripPrivate::init() Q_Q(QSizeGrip); m_corner = q->isLeftToRight() ? Qt::BottomRightCorner : Qt::BottomLeftCorner; -#if !defined(QT_NO_CURSOR) && !0 /* Used to be included in Qt4 for Q_WS_MAC */ +#if !defined(QT_NO_CURSOR) q->setCursor(m_corner == Qt::TopLeftCorner || m_corner == Qt::BottomRightCorner ? Qt::SizeFDiagCursor : Qt::SizeBDiagCursor); #endif @@ -440,7 +420,7 @@ void QSizeGrip::moveEvent(QMoveEvent * /*moveEvent*/) return; d->m_corner = d->corner(); -#if !defined(QT_NO_CURSOR) && !0 /* Used to be included in Qt4 for Q_WS_MAC */ +#if !defined(QT_NO_CURSOR) setCursor(d->m_corner == Qt::TopLeftCorner || d->m_corner == Qt::BottomRightCorner ? Qt::SizeFDiagCursor : Qt::SizeBDiagCursor); #endif @@ -451,9 +431,6 @@ void QSizeGrip::moveEvent(QMoveEvent * /*moveEvent*/) */ void QSizeGrip::showEvent(QShowEvent *showEvent) { -#if 0 // Used to be included in Qt4 for Q_WS_MAC - d_func()->updateMacSizer(false); -#endif QWidget::showEvent(showEvent); } @@ -462,9 +439,6 @@ void QSizeGrip::showEvent(QShowEvent *showEvent) */ void QSizeGrip::hideEvent(QHideEvent *hideEvent) { -#if 0 // Used to be included in Qt4 for Q_WS_MAC - d_func()->updateMacSizer(true); -#endif QWidget::hideEvent(hideEvent); } @@ -486,9 +460,7 @@ bool QSizeGrip::eventFilter(QObject *o, QEvent *e) return QWidget::eventFilter(o, e); } Qt::WindowStates sizeGripNotVisibleState = Qt::WindowFullScreen; -#if 1 // Used to be excluded in Qt4 for Q_WS_MAC sizeGripNotVisibleState |= Qt::WindowMaximized; -#endif // 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); diff --git a/src/widgets/widgets/qstatusbar.cpp b/src/widgets/widgets/qstatusbar.cpp index e9044e6cad..39f0f11daf 100644 --- a/src/widgets/widgets/qstatusbar.cpp +++ b/src/widgets/widgets/qstatusbar.cpp @@ -90,10 +90,6 @@ public: int savedStrut; -#if 0 // Used to be included in Qt4 for Q_WS_MAC - QPoint dragStart; -#endif - int indexToLastNonPermanentWidget() const { int i = items.size() - 1; @@ -747,44 +743,7 @@ 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. -#if 1 // Used to be excluded in Qt4 for Q_WS_MAC return QWidget::event(e); -#else - // Enable drag-click only if the status bar is the status bar for a - // QMainWindow with a unifed toolbar. - if (parent() == 0 || qobject_cast<QMainWindow *>(parent()) == 0 || - qobject_cast<QMainWindow *>(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 <QMouseEvent*>(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 } QT_END_NAMESPACE diff --git a/src/widgets/widgets/qtabbar.cpp b/src/widgets/widgets/qtabbar.cpp index 18fda11ddf..7e1794efef 100644 --- a/src/widgets/widgets/qtabbar.cpp +++ b/src/widgets/widgets/qtabbar.cpp @@ -68,11 +68,6 @@ #include "private/qapplication_p.h" #include "private/qtabbar_p.h" -#if 0 // Used to be included in Qt4 for Q_WS_MAC -#include <private/qt_mac_p.h> -#include <private/qt_cocoa_helpers_mac_p.h> -#endif - QT_BEGIN_NAMESPACE namespace { @@ -1976,9 +1971,7 @@ void QTabBar::mousePressEvent(QMouseEvent *event) d->moveTabFinished(d->pressedIndex); d->pressedIndex = d->indexAtPos(event->pos()); -#if 0 // Used to be included in Qt4 for Q_WS_MAC - d->previousPressedIndex = d->pressedIndex; -#endif + if (d->validIndex(d->pressedIndex)) { QStyleOptionTabBarBase optTabBase; optTabBase.init(this); @@ -2058,17 +2051,6 @@ void QTabBar::mouseMoveEvent(QMouseEvent *event) update(); } -#if 0 // Used to be included in Qt4 for 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) { @@ -2162,9 +2144,7 @@ void QTabBar::mouseReleaseEvent(QMouseEvent *event) event->ignore(); return; } -#if 0 // Used to be included in Qt4 for 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) diff --git a/src/widgets/widgets/qtabbar_p.h b/src/widgets/widgets/qtabbar_p.h index 458d486b10..5552c43548 100644 --- a/src/widgets/widgets/qtabbar_p.h +++ b/src/widgets/widgets/qtabbar_p.h @@ -93,9 +93,6 @@ public: selectionBehaviorOnRemove(QTabBar::SelectRightTab), paintWithOffsets(true), movable(false), dragInProgress(false), documentMode(false), autoHide(false), changeCurrentOnDrag(false), switchTabCurrentIndex(-1), switchTabTimerId(0), movingTab(nullptr) -#if 0 // Used to be included in Qt4 for Q_WS_MAC - , previousPressedIndex(-1) -#endif {} int currentIndex; @@ -232,9 +229,6 @@ public: int switchTabTimerId; QMovableTabWidget *movingTab; -#if 0 // Used to be included in Qt4 for Q_WS_MAC - int previousPressedIndex; -#endif // shared by tabwidget and qtabbar static void initStyleBaseOption(QStyleOptionTabBarBase *optTabBase, QTabBar *tabbar, QSize size) { diff --git a/src/widgets/widgets/qtextedit.cpp b/src/widgets/widgets/qtextedit.cpp index bd9e5f8159..0ccbad7eaa 100644 --- a/src/widgets/widgets/qtextedit.cpp +++ b/src/widgets/widgets/qtextedit.cpp @@ -200,9 +200,6 @@ void QTextEditPrivate::init(const QString &html) #ifndef QT_NO_CURSOR viewport->setCursor(Qt::IBeamCursor); #endif -#if 0 // Used to be included in Qt4 for Q_WS_WIN - setSingleFingerPanEnabled(true); -#endif } void QTextEditPrivate::_q_repaintContents(const QRectF &contentsRect) diff --git a/src/widgets/widgets/qtoolbar.cpp b/src/widgets/widgets/qtoolbar.cpp index d1a0f5ea78..58e9c4fd87 100644 --- a/src/widgets/widgets/qtoolbar.cpp +++ b/src/widgets/widgets/qtoolbar.cpp @@ -324,13 +324,8 @@ bool QToolBarPrivate::mouseMoveEvent(QMouseEvent *event) event->y() >= 0 && event->y() < q->height()); startDrag(moving); - if (!moving && !wasDragging) { -#if 0 // Used to be included in Qt4 for Q_WS_WIN - grabMouseWhileInWindow(); -#else + if (!moving && !wasDragging) q->grabMouse(); -#endif - } } if (state->dragging) { diff --git a/src/widgets/widgets/qwidgetlinecontrol.cpp b/src/widgets/widgets/qwidgetlinecontrol.cpp index 46bc29eed7..9cdae4f28f 100644 --- a/src/widgets/widgets/qwidgetlinecontrol.cpp +++ b/src/widgets/widgets/qwidgetlinecontrol.cpp @@ -78,11 +78,6 @@ int QWidgetLineControl::redoTextLayout() const QTextLine l = m_textLayout.createLine(); m_textLayout.endLayout(); -#if 0 // Used to be included in Qt4 for Q_WS_MAC - if (m_threadChecks) - m_textLayoutThread = QThread::currentThread(); -#endif - return qRound(l.ascent()); } diff --git a/src/widgets/widgets/qwidgetlinecontrol_p.h b/src/widgets/widgets/qwidgetlinecontrol_p.h index 940a17714f..8ebed25084 100644 --- a/src/widgets/widgets/qwidgetlinecontrol_p.h +++ b/src/widgets/widgets/qwidgetlinecontrol_p.h @@ -95,10 +95,6 @@ public: m_selstart(0), m_selend(0), m_passwordEchoEditing(false) , m_passwordEchoTimer(0) , m_passwordMaskDelay(-1) -#if 0 // Used to be included in Qt4 for Q_WS_MAC - , m_threadChecks(false) - , m_textLayoutThread(0) - #endif #if defined(QT_BUILD_INTERNAL) , m_passwordMaskDelayOverride(-1) #endif @@ -404,25 +400,9 @@ public: QTextLayout *textLayout() const { -#if 0 // Used to be included in Qt4 for Q_WS_MAC - if (m_threadChecks && QThread::currentThread() != m_textLayoutThread) - redoTextLayout(); -#endif return &m_textLayout; } -#if 0 // Used to be included in Qt4 for Q_WS_MAC - void setThreadChecks(bool threadChecks) - { - m_threadChecks = threadChecks; - } - - bool threadChecks() const - { - return m_threadChecks; - } -#endif - private: void init(const QString &txt); void removeSelectedText(); @@ -534,10 +514,6 @@ private: } int redoTextLayout() const; -#if 0 // Used to be included in Qt4 for Q_WS_MAC - bool m_threadChecks; - mutable QThread *m_textLayoutThread; -#endif public: #if defined(QT_BUILD_INTERNAL) diff --git a/src/widgets/widgets/qwidgetresizehandler.cpp b/src/widgets/widgets/qwidgetresizehandler.cpp index e8d435429f..9dbba12aba 100644 --- a/src/widgets/widgets/qwidgetresizehandler.cpp +++ b/src/widgets/widgets/qwidgetresizehandler.cpp @@ -124,21 +124,6 @@ bool QWidgetResizeHandler::eventFilter(QObject *o, QEvent *ee) if (!widgetRect.contains(cursorPoint)) return false; if (e->button() == Qt::LeftButton) { -#if 0 // Used to be included in Qt4 for Q_WS_X11 - /* - Implicit grabs do not stop the X server from changing - the cursor in children, which looks *really* bad when - doing resizingk, so we grab the cursor. Note that we do - not do this on Windows since double clicks are lost due - to the grab (see change 198463). - */ - if (e->spontaneous()) -# if !defined(QT_NO_CURSOR) - widget->grabMouse(widget->cursor()); -# else - widget->grabMouse(); -# endif // QT_NO_CURSOR -#endif buttonDown = false; emit activate(); bool me = movingEnabled; |