From 3835194d340f8756d2ac7a5f9ae2a3519cb891b9 Mon Sep 17 00:00:00 2001 From: Stephan Binner Date: Sun, 9 Jul 2017 11:04:38 +0200 Subject: Convert features.rubberband to QT_[REQUIRE_]CONFIG Change-Id: I6d634bafa6d26c1e78069fddd412e6de24f5775c Reviewed-by: Oswald Buddenhagen --- src/widgets/widgets/qmainwindowlayout.cpp | 6 ++++-- src/widgets/widgets/qmainwindowlayout_p.h | 2 +- src/widgets/widgets/qmdiarea.cpp | 16 ++++++++-------- src/widgets/widgets/qmdiarea_p.h | 6 +++--- src/widgets/widgets/qmdisubwindow.cpp | 30 +++++++++++++++--------------- src/widgets/widgets/qmdisubwindow_p.h | 8 ++++---- src/widgets/widgets/qrubberband.cpp | 4 ---- src/widgets/widgets/qrubberband.h | 7 ++----- src/widgets/widgets/qsplitter.cpp | 2 ++ src/widgets/widgets/qsplitter_p.h | 1 - src/widgets/widgets/qtoolbar.cpp | 2 ++ src/widgets/widgets/widgets.pri | 7 +++++-- 12 files changed, 46 insertions(+), 45 deletions(-) (limited to 'src/widgets/widgets') diff --git a/src/widgets/widgets/qmainwindowlayout.cpp b/src/widgets/widgets/qmainwindowlayout.cpp index d31fa3ddfa..1393294f0a 100644 --- a/src/widgets/widgets/qmainwindowlayout.cpp +++ b/src/widgets/widgets/qmainwindowlayout.cpp @@ -49,7 +49,9 @@ #include "qtoolbar.h" #include "qtoolbarlayout_p.h" #include "qwidgetanimator_p.h" +#if QT_CONFIG(rubberband) #include "qrubberband.h" +#endif #include "qtabbar_p.h" #include @@ -2449,7 +2451,7 @@ QLayoutItem *QMainWindowLayout::unplug(QWidget *widget, bool group) void QMainWindowLayout::updateGapIndicator() { -#ifndef QT_NO_RUBBERBAND +#if QT_CONFIG(rubberband) if ((!widgetAnimator.animating() && !currentGapPos.isEmpty()) #if QT_CONFIG(dockwidget) || currentHoveredFloat @@ -2477,7 +2479,7 @@ void QMainWindowLayout::updateGapIndicator() } else if (gapIndicator) { gapIndicator->hide(); } -#endif //QT_NO_RUBBERBAND +#endif // QT_CONFIG(rubberband) } void QMainWindowLayout::hover(QLayoutItem *widgetItem, const QPoint &mousePos) diff --git a/src/widgets/widgets/qmainwindowlayout_p.h b/src/widgets/widgets/qmainwindowlayout_p.h index ed8da61bc3..5544730c30 100644 --- a/src/widgets/widgets/qmainwindowlayout_p.h +++ b/src/widgets/widgets/qmainwindowlayout_p.h @@ -301,7 +301,7 @@ public: QList currentGapPos; QRect currentGapRect; QWidget *pluggingWidget; -#ifndef QT_NO_RUBBERBAND +#if QT_CONFIG(rubberband) QPointer gapIndicator; #endif #ifndef QT_NO_DOCKWIDGET diff --git a/src/widgets/widgets/qmdiarea.cpp b/src/widgets/widgets/qmdiarea.cpp index 18cb823702..e25b454409 100644 --- a/src/widgets/widgets/qmdiarea.cpp +++ b/src/widgets/widgets/qmdiarea.cpp @@ -672,7 +672,7 @@ QMdiAreaPrivate::QMdiAreaPrivate() regularTiler(0), iconTiler(0), placer(0), -#ifndef QT_NO_RUBBERBAND +#if QT_CONFIG(rubberband) rubberBand(0), #endif #ifndef QT_NO_TABBAR @@ -1036,7 +1036,7 @@ void QMdiAreaPrivate::activateHighlightedWindow() activateWindow(nextVisibleSubWindow(-1, QMdiArea::ActivationHistoryOrder)); else activateWindow(childWindows.at(indexToHighlighted)); -#ifndef QT_NO_RUBBERBAND +#if QT_CONFIG(rubberband) hideRubberBand(); #endif } @@ -1140,7 +1140,7 @@ void QMdiAreaPrivate::updateActiveWindow(int removedIndex, bool activeRemoved) } if (indexToHighlighted >= 0) { -#ifndef QT_NO_RUBBERBAND +#if QT_CONFIG(rubberband) // Hide rubber band if highlighted window is removed. if (indexToHighlighted == removedIndex) hideRubberBand(); @@ -1514,7 +1514,7 @@ void QMdiAreaPrivate::highlightNextSubWindow(int increaseFactor) if (!highlight) return; -#ifndef QT_NO_RUBBERBAND +#if QT_CONFIG(rubberband) if (!rubberBand) { rubberBand = new QRubberBand(QRubberBand::Rectangle, q); // For accessibility to identify this special widget. @@ -1524,7 +1524,7 @@ void QMdiAreaPrivate::highlightNextSubWindow(int increaseFactor) #endif // Only highlight if we're not switching back to the previously active window (Ctrl-Tab once). -#ifndef QT_NO_RUBBERBAND +#if QT_CONFIG(rubberband) if (tabToPreviousTimerId == -1) showRubberBandFor(highlight); #endif @@ -2351,7 +2351,7 @@ void QMdiArea::timerEvent(QTimerEvent *timerEvent) d->tabToPreviousTimerId = -1; if (d->indexToHighlighted < 0) return; -#ifndef QT_NO_RUBBERBAND +#if QT_CONFIG(rubberband) // We're not doing a "quick switch" ... show rubber band. Q_ASSERT(d->indexToHighlighted < d->childWindows.size()); Q_ASSERT(d->rubberBand); @@ -2594,7 +2594,7 @@ bool QMdiArea::eventFilter(QObject *object, QEvent *event) if (keyPress) area->d_func()->highlightNextSubWindow(keyEvent->key() == Qt::Key_Tab ? 1 : -1); return true; -#ifndef QT_NO_RUBBERBAND +#if QT_CONFIG(rubberband) case Qt::Key_Escape: area->d_func()->hideRubberBand(); break; @@ -2643,7 +2643,7 @@ bool QMdiArea::eventFilter(QObject *object, QEvent *event) case QEvent::Hide: d->isSubWindowsTiled = false; break; -#ifndef QT_NO_RUBBERBAND +#if QT_CONFIG(rubberband) case QEvent::Close: if (d->childWindows.indexOf(subWindow) == d->indexToHighlighted) d->hideRubberBand(); diff --git a/src/widgets/widgets/qmdiarea_p.h b/src/widgets/widgets/qmdiarea_p.h index 353144a6ab..b77f3f63ea 100644 --- a/src/widgets/widgets/qmdiarea_p.h +++ b/src/widgets/widgets/qmdiarea_p.h @@ -144,7 +144,7 @@ public: QMdi::Rearranger *regularTiler; QMdi::Rearranger *iconTiler; QMdi::Placer *placer; -#ifndef QT_NO_RUBBERBAND +#if QT_CONFIG(rubberband) QRubberBand *rubberBand; #endif QMdiAreaTabBar *tabBar; @@ -254,7 +254,7 @@ public: subWindow->d_func()->setActive(active, changeFocus); } -#ifndef QT_NO_RUBBERBAND +#if QT_CONFIG(rubberband) void showRubberBandFor(QMdiSubWindow *subWindow); inline void hideRubberBand() @@ -263,7 +263,7 @@ public: rubberBand->hide(); indexToHighlighted = -1; } -#endif // QT_NO_RUBBERBAND +#endif // QT_CONFIG(rubberband) }; #endif // QT_NO_MDIAREA diff --git a/src/widgets/widgets/qmdisubwindow.cpp b/src/widgets/widgets/qmdisubwindow.cpp index b4f2c97e04..663572802c 100644 --- a/src/widgets/widgets/qmdisubwindow.cpp +++ b/src/widgets/widgets/qmdisubwindow.cpp @@ -864,14 +864,14 @@ QMdiSubWindowPrivate::QMdiSubWindowPrivate() #ifndef QT_NO_SIZEGRIP sizeGrip(0), #endif -#ifndef QT_NO_RUBBERBAND +#if QT_CONFIG(rubberband) rubberBand(0), #endif userMinimumSize(0,0), resizeEnabled(true), moveEnabled(true), isInInteractiveMode(false), -#ifndef QT_NO_RUBBERBAND +#if QT_CONFIG(rubberband) isInRubberBandMode(false), #endif isShadeMode(false), @@ -945,13 +945,13 @@ void QMdiSubWindowPrivate::_q_enterInteractiveMode() oldGeometry = q->geometry(); isInInteractiveMode = true; q->setFocus(); -#ifndef QT_NO_RUBBERBAND +#if QT_CONFIG(rubberband) if ((q->testOption(QMdiSubWindow::RubberBandResize) && (currentOperation == BottomRightResize || currentOperation == BottomLeftResize)) || (q->testOption(QMdiSubWindow::RubberBandMove) && currentOperation == Move)) { enterRubberBandMode(); } else -#endif // QT_NO_RUBBERBAND +#endif // QT_CONFIG(rubberband) { q->grabMouse(); } @@ -978,7 +978,7 @@ void QMdiSubWindowPrivate::_q_processFocusChanged(QWidget *old, QWidget *now) void QMdiSubWindowPrivate::leaveInteractiveMode() { Q_Q(QMdiSubWindow); -#ifndef QT_NO_RUBBERBAND +#if QT_CONFIG(rubberband) if (isInRubberBandMode) leaveRubberBandMode(); else @@ -1893,7 +1893,7 @@ void QMdiSubWindowPrivate::updateWindowTitle(bool isRequestFromChild) ignoreWindowTitleChange = false; } -#ifndef QT_NO_RUBBERBAND +#if QT_CONFIG(rubberband) void QMdiSubWindowPrivate::enterRubberBandMode() { Q_Q(QMdiSubWindow); @@ -1925,7 +1925,7 @@ void QMdiSubWindowPrivate::leaveRubberBandMode() rubberBand->hide(); currentOperation = None; } -#endif // QT_NO_RUBBERBAND +#endif // QT_CONFIG(rubberband) // Taken from the old QWorkspace (::readColors()) QPalette QMdiSubWindowPrivate::desktopPalette() const @@ -2424,7 +2424,7 @@ void QMdiSubWindow::setOption(SubWindowOption option, bool on) Q_D(QMdiSubWindow); d->options.setFlag(option, on); -#ifndef QT_NO_RUBBERBAND +#if QT_CONFIG(rubberband) if ((option & (RubberBandResize | RubberBandMove)) && !on && d->isInRubberBandMode) d->leaveRubberBandMode(); #endif @@ -2723,7 +2723,7 @@ bool QMdiSubWindow::eventFilter(QObject *object, QEvent *event) d->oldGeometry = geometry(); d->currentOperation = isLeftToRight() ? QMdiSubWindowPrivate::BottomRightResize : QMdiSubWindowPrivate::BottomLeftResize; -#ifndef QT_NO_RUBBERBAND +#if QT_CONFIG(rubberband) d->enterRubberBandMode(); #endif return true; @@ -2837,7 +2837,7 @@ bool QMdiSubWindow::event(QEvent *event) d->currentOperation = QMdiSubWindowPrivate::None; d->activeSubControl = QStyle::SC_None; d->hoveredSubControl = QStyle::SC_None; -#ifndef QT_NO_RUBBERBAND +#if QT_CONFIG(rubberband) if (d->isInRubberBandMode) d->leaveRubberBandMode(); #endif @@ -3196,7 +3196,7 @@ void QMdiSubWindow::mousePressEvent(QMouseEvent *mouseEvent) Q_D(QMdiSubWindow); if (d->isInInteractiveMode) d->leaveInteractiveMode(); -#ifndef QT_NO_RUBBERBAND +#if QT_CONFIG(rubberband) if (d->isInRubberBandMode) d->leaveRubberBandMode(); #endif @@ -3211,7 +3211,7 @@ void QMdiSubWindow::mousePressEvent(QMouseEvent *mouseEvent) d->mousePressPosition = mapToParent(mouseEvent->pos()); if (d->resizeEnabled || d->moveEnabled) d->oldGeometry = geometry(); -#ifndef QT_NO_RUBBERBAND +#if QT_CONFIG(rubberband) if ((testOption(QMdiSubWindow::RubberBandResize) && d->isResizeOperation()) || (testOption(QMdiSubWindow::RubberBandMove) && d->isMoveOperation())) { d->enterRubberBandMode(); @@ -3291,7 +3291,7 @@ void QMdiSubWindow::mouseReleaseEvent(QMouseEvent *mouseEvent) Q_D(QMdiSubWindow); if (d->currentOperation != QMdiSubWindowPrivate::None) { -#ifndef QT_NO_RUBBERBAND +#if QT_CONFIG(rubberband) if (d->isInRubberBandMode && !d->isInInteractiveMode) d->leaveRubberBandMode(); #endif @@ -3406,13 +3406,13 @@ void QMdiSubWindow::keyPressEvent(QKeyEvent *keyEvent) #ifndef QT_NO_CURSOR QPoint newPosition = parentWidget()->mapFromGlobal(cursor().pos() + delta); QRect oldGeometry = -#ifndef QT_NO_RUBBERBAND +#if QT_CONFIG(rubberband) d->isInRubberBandMode ? d->rubberBand->geometry() : #endif geometry(); d->setNewGeometry(newPosition); QRect currentGeometry = -#ifndef QT_NO_RUBBERBAND +#if QT_CONFIG(rubberband) d->isInRubberBandMode ? d->rubberBand->geometry() : #endif geometry(); diff --git a/src/widgets/widgets/qmdisubwindow_p.h b/src/widgets/widgets/qmdisubwindow_p.h index 33fa73eb0d..71fcc38378 100644 --- a/src/widgets/widgets/qmdisubwindow_p.h +++ b/src/widgets/widgets/qmdisubwindow_p.h @@ -179,7 +179,7 @@ public: #ifndef QT_NO_SIZEGRIP QPointer sizeGrip; #endif -#ifndef QT_NO_RUBBERBAND +#if QT_CONFIG(rubberband) QRubberBand *rubberBand; #endif QPoint mousePressPosition; @@ -190,7 +190,7 @@ public: bool resizeEnabled; bool moveEnabled; bool isInInteractiveMode; -#ifndef QT_NO_RUBBERBAND +#if QT_CONFIG(rubberband) bool isInRubberBandMode; #endif bool isShadeMode; @@ -258,7 +258,7 @@ public: void removeButtonsFromMenuBar(); #endif void updateWindowTitle(bool requestFromChild); -#ifndef QT_NO_RUBBERBAND +#if QT_CONFIG(rubberband) void enterRubberBandMode(); void leaveRubberBandMode(); #endif @@ -310,7 +310,7 @@ public: Q_Q(QMdiSubWindow); Q_ASSERT(parent); geometry->setSize(geometry->size().expandedTo(internalMinimumSize)); -#ifndef QT_NO_RUBBERBAND +#if QT_CONFIG(rubberband) if (isInRubberBandMode) rubberBand->setGeometry(*geometry); else diff --git a/src/widgets/widgets/qrubberband.cpp b/src/widgets/widgets/qrubberband.cpp index c91f837093..ade8675db8 100644 --- a/src/widgets/widgets/qrubberband.cpp +++ b/src/widgets/widgets/qrubberband.cpp @@ -43,8 +43,6 @@ #include "qrubberband.h" #include "qtimer.h" -#ifndef QT_NO_RUBBERBAND - #include "qstyle.h" #include "qstyleoption.h" #if 0 // Used to be included in Qt4 for Q_WS_MAC @@ -334,5 +332,3 @@ bool QRubberBand::event(QEvent *e) QT_END_NAMESPACE #include "moc_qrubberband.cpp" - -#endif // QT_NO_RUBBERBAND diff --git a/src/widgets/widgets/qrubberband.h b/src/widgets/widgets/qrubberband.h index 217261bf75..a05eb0d543 100644 --- a/src/widgets/widgets/qrubberband.h +++ b/src/widgets/widgets/qrubberband.h @@ -43,10 +43,9 @@ #include #include -QT_BEGIN_NAMESPACE - +QT_REQUIRE_CONFIG(rubberband); -#ifndef QT_NO_RUBBERBAND +QT_BEGIN_NAMESPACE class QRubberBandPrivate; class QStyleOptionRubberBand; @@ -91,8 +90,6 @@ inline void QRubberBand::setGeometry(int ax, int ay, int aw, int ah) inline void QRubberBand::move(int ax, int ay) { setGeometry(ax, ay, width(), height()); } -#endif // QT_NO_RUBBERBAND - QT_END_NAMESPACE #endif // QRUBBERBAND_H diff --git a/src/widgets/widgets/qsplitter.cpp b/src/widgets/widgets/qsplitter.cpp index 0c98c3875a..7d507aa7f4 100644 --- a/src/widgets/widgets/qsplitter.cpp +++ b/src/widgets/widgets/qsplitter.cpp @@ -47,7 +47,9 @@ #include "qlayout.h" #include "qlist.h" #include "qpainter.h" +#if QT_CONFIG(rubberband) #include "qrubberband.h" +#endif #include "qstyle.h" #include "qstyleoption.h" #include "qtextstream.h" diff --git a/src/widgets/widgets/qsplitter_p.h b/src/widgets/widgets/qsplitter_p.h index 0730fab824..34ae34121e 100644 --- a/src/widgets/widgets/qsplitter_p.h +++ b/src/widgets/widgets/qsplitter_p.h @@ -53,7 +53,6 @@ #include #include "private/qframe_p.h" -#include "qrubberband.h" QT_BEGIN_NAMESPACE diff --git a/src/widgets/widgets/qtoolbar.cpp b/src/widgets/widgets/qtoolbar.cpp index 48fa88b7a0..bdb17f10d3 100644 --- a/src/widgets/widgets/qtoolbar.cpp +++ b/src/widgets/widgets/qtoolbar.cpp @@ -48,7 +48,9 @@ #include #include #include +#if QT_CONFIG(rubberband) #include +#endif #include #include #include diff --git a/src/widgets/widgets/widgets.pri b/src/widgets/widgets/widgets.pri index 726235ef4e..b142be8041 100644 --- a/src/widgets/widgets/widgets.pri +++ b/src/widgets/widgets/widgets.pri @@ -32,7 +32,6 @@ HEADERS += \ widgets/qmenubar.h \ widgets/qmenubar_p.h \ widgets/qprogressbar.h \ - widgets/qrubberband.h \ widgets/qscrollbar.h \ widgets/qscrollbar_p.h \ widgets/qscrollarea_p.h \ @@ -89,7 +88,6 @@ SOURCES += \ widgets/qmenu.cpp \ widgets/qmenubar.cpp \ widgets/qprogressbar.cpp \ - widgets/qrubberband.cpp \ widgets/qscrollbar.cpp \ widgets/qsizegrip.cpp \ widgets/qslider.cpp \ @@ -197,6 +195,11 @@ qtConfig(dialogbuttonbox) { widgets/qdialogbuttonbox.cpp } +qtConfig(rubberband) { + HEADERS += widgets/qrubberband.h + SOURCES += widgets/qrubberband.cpp +} + qtConfig(splashscreen) { HEADERS += \ widgets/qsplashscreen.h -- cgit v1.2.3