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/accessible/qaccessiblewidget.cpp | 2 ++ .../accessible/qaccessiblewidgetfactory.cpp | 2 +- src/widgets/accessible/qaccessiblewidgets.cpp | 2 ++ src/widgets/graphicsview/qgraphicsview.cpp | 18 ++++++------- src/widgets/graphicsview/qgraphicsview.h | 6 ++--- src/widgets/graphicsview/qgraphicsview_p.h | 2 +- src/widgets/itemviews/qlistview.cpp | 4 ++- src/widgets/itemviews/qlistview_p.h | 1 - src/widgets/styles/qcommonstyle.cpp | 10 +++++--- src/widgets/styles/qmacstyle_mac.mm | 2 ++ src/widgets/styles/qmacstyle_mac_p_p.h | 2 ++ src/widgets/styles/qstyleoption.cpp | 4 +-- src/widgets/styles/qstyleoption.h | 6 +++-- src/widgets/styles/qwindowsstyle.cpp | 10 +++++--- src/widgets/styles/qwindowsxpstyle.cpp | 12 ++++----- 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 +++-- 27 files changed, 95 insertions(+), 79 deletions(-) diff --git a/src/widgets/accessible/qaccessiblewidget.cpp b/src/widgets/accessible/qaccessiblewidget.cpp index f18930f273..3bc0f7e77b 100644 --- a/src/widgets/accessible/qaccessiblewidget.cpp +++ b/src/widgets/accessible/qaccessiblewidget.cpp @@ -54,7 +54,9 @@ #include "qwidget.h" #include "qdebug.h" #include +#if QT_CONFIG(rubberband) #include +#endif #include #include #include diff --git a/src/widgets/accessible/qaccessiblewidgetfactory.cpp b/src/widgets/accessible/qaccessiblewidgetfactory.cpp index e7db53c251..ccd176cd04 100644 --- a/src/widgets/accessible/qaccessiblewidgetfactory.cpp +++ b/src/widgets/accessible/qaccessiblewidgetfactory.cpp @@ -193,7 +193,7 @@ QAccessibleInterface *qAccessibleFactory(const QString &classname, QObject *obje } else if (classname == QLatin1String("QDial")) { iface = new QAccessibleDial(widget); #endif -#ifndef QT_NO_RUBBERBAND +#if QT_CONFIG(rubberband) } else if (classname == QLatin1String("QRubberBand")) { iface = new QAccessibleWidget(widget, QAccessible::Border); #endif diff --git a/src/widgets/accessible/qaccessiblewidgets.cpp b/src/widgets/accessible/qaccessiblewidgets.cpp index 7f77f7c524..60f489d487 100644 --- a/src/widgets/accessible/qaccessiblewidgets.cpp +++ b/src/widgets/accessible/qaccessiblewidgets.cpp @@ -58,7 +58,9 @@ #include #endif #include +#if QT_CONFIG(rubberband) #include +#endif #include #include #include diff --git a/src/widgets/graphicsview/qgraphicsview.cpp b/src/widgets/graphicsview/qgraphicsview.cpp index f5f24649c2..a00156ef01 100644 --- a/src/widgets/graphicsview/qgraphicsview.cpp +++ b/src/widgets/graphicsview/qgraphicsview.cpp @@ -353,7 +353,7 @@ QGraphicsViewPrivate::QGraphicsViewPrivate() viewportUpdateMode(QGraphicsView::MinimalViewportUpdate), optimizationFlags(0), scene(0), -#ifndef QT_NO_RUBBERBAND +#if QT_CONFIG(rubberband) rubberBanding(false), rubberBandSelectionMode(Qt::IntersectsItemShape), rubberBandSelectionOperation(Qt::ReplaceSelection), @@ -633,7 +633,7 @@ void QGraphicsViewPrivate::mouseMoveEventHandler(QMouseEvent *event) { Q_Q(QGraphicsView); -#ifndef QT_NO_RUBBERBAND +#if QT_CONFIG(rubberband) updateRubberBand(event); #endif @@ -708,7 +708,7 @@ void QGraphicsViewPrivate::mouseMoveEventHandler(QMouseEvent *event) /*! \internal */ -#ifndef QT_NO_RUBBERBAND +#if QT_CONFIG(rubberband) QRegion QGraphicsViewPrivate::rubberBandRegion(const QWidget *widget, const QRect &rect) const { QStyleHintReturnMask mask; @@ -1508,7 +1508,7 @@ void QGraphicsView::setDragMode(DragMode mode) #endif } -#ifndef QT_NO_RUBBERBAND +#if QT_CONFIG(rubberband) /*! \property QGraphicsView::rubberBandSelectionMode \brief the behavior for selecting items with a rubber band selection rectangle. @@ -3274,7 +3274,7 @@ void QGraphicsView::mousePressEvent(QMouseEvent *event) } } -#ifndef QT_NO_RUBBERBAND +#if QT_CONFIG(rubberband) if (d->dragMode == QGraphicsView::RubberBandDrag && !d->rubberBanding) { if (d->sceneInteractionAllowed) { // Rubberbanding is only allowed in interactive mode. @@ -3336,7 +3336,7 @@ void QGraphicsView::mouseReleaseEvent(QMouseEvent *event) { Q_D(QGraphicsView); -#ifndef QT_NO_RUBBERBAND +#if QT_CONFIG(rubberband) if (d->dragMode == QGraphicsView::RubberBandDrag && d->sceneInteractionAllowed && !event->buttons()) { if (d->rubberBanding) { if (d->viewportUpdateMode != QGraphicsView::NoViewportUpdate){ @@ -3459,7 +3459,7 @@ void QGraphicsView::paintEvent(QPaintEvent *event) // Set up the painter QPainter painter(viewport()); -#ifndef QT_NO_RUBBERBAND +#if QT_CONFIG(rubberband) if (d->rubberBanding && !d->rubberBandRect.isEmpty()) painter.save(); #endif @@ -3583,7 +3583,7 @@ void QGraphicsView::paintEvent(QPaintEvent *event) // Foreground drawForeground(&painter, exposedSceneRect); -#ifndef QT_NO_RUBBERBAND +#if QT_CONFIG(rubberband) // Rubberband if (d->rubberBanding && !d->rubberBandRect.isEmpty()) { painter.restore(); @@ -3651,7 +3651,7 @@ void QGraphicsView::scrollContentsBy(int dx, int dy) if (d->viewportUpdateMode != QGraphicsView::NoViewportUpdate) { if (d->viewportUpdateMode != QGraphicsView::FullViewportUpdate) { if (d->accelerateScrolling) { -#ifndef QT_NO_RUBBERBAND +#if QT_CONFIG(rubberband) // Update new and old rubberband regions if (!d->rubberBandRect.isEmpty()) { QRegion rubberBandRegion(d->rubberBandRegion(viewport(), d->rubberBandRect)); diff --git a/src/widgets/graphicsview/qgraphicsview.h b/src/widgets/graphicsview/qgraphicsview.h index fb975b9d71..d70ce6cf1c 100644 --- a/src/widgets/graphicsview/qgraphicsview.h +++ b/src/widgets/graphicsview/qgraphicsview.h @@ -72,7 +72,7 @@ class Q_WIDGETS_EXPORT QGraphicsView : public QAbstractScrollArea Q_PROPERTY(ViewportAnchor transformationAnchor READ transformationAnchor WRITE setTransformationAnchor) Q_PROPERTY(ViewportAnchor resizeAnchor READ resizeAnchor WRITE setResizeAnchor) Q_PROPERTY(ViewportUpdateMode viewportUpdateMode READ viewportUpdateMode WRITE setViewportUpdateMode) -#ifndef QT_NO_RUBBERBAND +#if QT_CONFIG(rubberband) Q_PROPERTY(Qt::ItemSelectionMode rubberBandSelectionMode READ rubberBandSelectionMode WRITE setRubberBandSelectionMode) #endif Q_PROPERTY(OptimizationFlags optimizationFlags READ optimizationFlags WRITE setOptimizationFlags) @@ -144,7 +144,7 @@ public: DragMode dragMode() const; void setDragMode(DragMode mode); -#ifndef QT_NO_RUBBERBAND +#if QT_CONFIG(rubberband) Qt::ItemSelectionMode rubberBandSelectionMode() const; void setRubberBandSelectionMode(Qt::ItemSelectionMode mode); QRect rubberBandRect() const; @@ -228,7 +228,7 @@ public Q_SLOTS: void invalidateScene(const QRectF &rect = QRectF(), QGraphicsScene::SceneLayers layers = QGraphicsScene::AllLayers); void updateSceneRect(const QRectF &rect); -#ifndef QT_NO_RUBBERBAND +#if QT_CONFIG(rubberband) Q_SIGNALS: void rubberBandChanged(QRect viewportRect, QPointF fromScenePoint, QPointF toScenePoint); #endif diff --git a/src/widgets/graphicsview/qgraphicsview_p.h b/src/widgets/graphicsview/qgraphicsview_p.h index 10103a1809..b34be77f11 100644 --- a/src/widgets/graphicsview/qgraphicsview_p.h +++ b/src/widgets/graphicsview/qgraphicsview_p.h @@ -136,7 +136,7 @@ public: QGraphicsView::OptimizationFlags optimizationFlags; QPointer scene; -#ifndef QT_NO_RUBBERBAND +#if QT_CONFIG(rubberband) QRect rubberBandRect; QRegion rubberBandRegion(const QWidget *widget, const QRect &rect) const; void updateRubberBand(const QMouseEvent *event); diff --git a/src/widgets/itemviews/qlistview.cpp b/src/widgets/itemviews/qlistview.cpp index 396d84de9c..ca416d9c04 100644 --- a/src/widgets/itemviews/qlistview.cpp +++ b/src/widgets/itemviews/qlistview.cpp @@ -50,7 +50,9 @@ #include #include #include +#if QT_CONFIG(rubberband) #include +#endif #include #include #include @@ -1043,7 +1045,7 @@ void QListView::paintEvent(QPaintEvent *e) d->commonListView->paintDragDrop(&painter); #endif -#ifndef QT_NO_RUBBERBAND +#if QT_CONFIG(rubberband) // #### move this implementation into a dynamic class if (d->showElasticBand && d->elasticBand.isValid()) { QStyleOptionRubberBand opt; diff --git a/src/widgets/itemviews/qlistview_p.h b/src/widgets/itemviews/qlistview_p.h index 5b674b3eca..6c0e470a93 100644 --- a/src/widgets/itemviews/qlistview_p.h +++ b/src/widgets/itemviews/qlistview_p.h @@ -53,7 +53,6 @@ #include #include "private/qabstractitemview_p.h" -#include "qrubberband.h" #include "qbitarray.h" #include "qbsptree_p.h" #include diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp index ad3ba88756..56f9bfb3e7 100644 --- a/src/widgets/styles/qcommonstyle.cpp +++ b/src/widgets/styles/qcommonstyle.cpp @@ -68,7 +68,9 @@ #include #include #include +#if QT_CONFIG(rubberband) #include +#endif #include "qtreeview.h" #include #include @@ -2002,7 +2004,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, p->restore(); break; } #endif // QT_NO_SIZEGRIP -#ifndef QT_NO_RUBBERBAND +#if QT_CONFIG(rubberband) case CE_RubberBand: { if (const QStyleOptionRubberBand *rbOpt = qstyleoption_cast(opt)) { QPixmap tiledPixmap(16, 16); @@ -2030,7 +2032,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, p->restore(); } break; } -#endif // QT_NO_RUBBERBAND +#endif // QT_CONFIG(rubberband) #ifndef QT_NO_DOCKWIDGET case CE_DockWidgetTitle: if (const QStyleOptionDockWidget *dwOpt = qstyleoption_cast(opt)) { @@ -5093,7 +5095,7 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget } } break; -#ifndef QT_NO_RUBBERBAND +#if QT_CONFIG(rubberband) case SH_RubberBand_Mask: if (const QStyleOptionRubberBand *rbOpt = qstyleoption_cast(opt)) { ret = 0; @@ -5107,7 +5109,7 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget } } break; -#endif // QT_NO_RUBBERBAND +#endif // QT_CONFIG(rubberband) case SH_SpinControls_DisableOnBounds: ret = 1; break; diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm index fafe9c9e2c..423ab6be5e 100644 --- a/src/widgets/styles/qmacstyle_mac.mm +++ b/src/widgets/styles/qmacstyle_mac.mm @@ -80,7 +80,9 @@ #include #endif #include +#if QT_CONFIG(rubberband) #include +#endif #include #include #include diff --git a/src/widgets/styles/qmacstyle_mac_p_p.h b/src/widgets/styles/qmacstyle_mac_p_p.h index 2b388091a6..f6bb2fdddd 100644 --- a/src/widgets/styles/qmacstyle_mac_p_p.h +++ b/src/widgets/styles/qmacstyle_mac_p_p.h @@ -82,7 +82,9 @@ #include #endif #include +#if QT_CONFIG(rubberband) #include +#endif #include #include #include diff --git a/src/widgets/styles/qstyleoption.cpp b/src/widgets/styles/qstyleoption.cpp index c12b3285f1..452f112117 100644 --- a/src/widgets/styles/qstyleoption.cpp +++ b/src/widgets/styles/qstyleoption.cpp @@ -2797,7 +2797,7 @@ QStyleOptionToolBox::QStyleOptionToolBox(int version) a selected tab nor is it the selected tab. */ -#ifndef QT_NO_RUBBERBAND +#if QT_CONFIG(rubberband) /*! \class QStyleOptionRubberBand \brief The QStyleOptionRubberBand class is used to describe the @@ -2887,7 +2887,7 @@ QStyleOptionRubberBand::QStyleOptionRubberBand(int version) The default value is true. */ -#endif // QT_NO_RUBBERBAND +#endif // QT_CONFIG(rubberband) /*! \class QStyleOptionTitleBar diff --git a/src/widgets/styles/qstyleoption.h b/src/widgets/styles/qstyleoption.h index 0e76d53eea..a3ed35c762 100644 --- a/src/widgets/styles/qstyleoption.h +++ b/src/widgets/styles/qstyleoption.h @@ -49,7 +49,9 @@ #include #include #include +#if QT_CONFIG(rubberband) #include +#endif #include #ifndef QT_NO_ITEMVIEWS # include @@ -467,7 +469,7 @@ protected: typedef Q_DECL_DEPRECATED QStyleOptionToolBox QStyleOptionToolBoxV2; -#ifndef QT_NO_RUBBERBAND +#if QT_CONFIG(rubberband) class Q_WIDGETS_EXPORT QStyleOptionRubberBand : public QStyleOption { public: @@ -483,7 +485,7 @@ public: protected: QStyleOptionRubberBand(int version); }; -#endif // QT_NO_RUBBERBAND +#endif // QT_CONFIG(rubberband) // -------------------------- Complex style options ------------------------------- class Q_WIDGETS_EXPORT QStyleOptionComplex : public QStyleOption diff --git a/src/widgets/styles/qwindowsstyle.cpp b/src/widgets/styles/qwindowsstyle.cpp index efbb972a06..f805e29db1 100644 --- a/src/widgets/styles/qwindowsstyle.cpp +++ b/src/widgets/styles/qwindowsstyle.cpp @@ -51,7 +51,9 @@ #include #include "qpaintengine.h" #include "qpainter.h" +#if QT_CONFIG(rubberband) #include "qrubberband.h" +#endif #include "qstyleoption.h" #include "qtabbar.h" #include "qwidget.h" @@ -606,7 +608,7 @@ int QWindowsStyle::styleHint(StyleHint hint, const QStyleOption *opt, const QWid ret = 400; break; } -#ifndef QT_NO_RUBBERBAND +#if QT_CONFIG(rubberband) case SH_RubberBand_Mask: if (const QStyleOptionRubberBand *rbOpt = qstyleoption_cast(opt)) { ret = 0; @@ -622,7 +624,7 @@ int QWindowsStyle::styleHint(StyleHint hint, const QStyleOption *opt, const QWid } } break; -#endif // QT_NO_RUBBERBAND +#endif // QT_CONFIG(rubberband) #if QT_CONFIG(wizard) case SH_WizardStyle: ret = QWizard::ModernStyle; @@ -1080,7 +1082,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai const QWidget *widget) const { switch (ce) { -#ifndef QT_NO_RUBBERBAND +#if QT_CONFIG(rubberband) case CE_RubberBand: if (qstyleoption_cast(opt)) { // ### workaround for slow general painter path @@ -1103,7 +1105,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai return; } break; -#endif // QT_NO_RUBBERBAND +#endif // QT_CONFIG(rubberband) #if !defined(QT_NO_MENU) && !defined(QT_NO_MAINWINDOW) case CE_MenuBarEmptyArea: diff --git a/src/widgets/styles/qwindowsxpstyle.cpp b/src/widgets/styles/qwindowsxpstyle.cpp index 25321559b3..87ac2ee4ae 100644 --- a/src/widgets/styles/qwindowsxpstyle.cpp +++ b/src/widgets/styles/qwindowsxpstyle.cpp @@ -1159,7 +1159,7 @@ void QWindowsXPStyle::polish(QWidget *widget) widget->setAttribute(Qt::WA_Hover); } -#ifndef QT_NO_RUBBERBAND +#if QT_CONFIG(rubberband) if (qobject_cast(widget)) { widget->setWindowOpacity(0.6); } @@ -1194,7 +1194,7 @@ void QWindowsXPStyle::polish(QPalette &pal) /*! \reimp */ void QWindowsXPStyle::unpolish(QWidget *widget) { -#ifndef QT_NO_RUBBERBAND +#if QT_CONFIG(rubberband) if (qobject_cast(widget)) { widget->setWindowOpacity(1.0); } @@ -2412,7 +2412,7 @@ void QWindowsXPStyle::drawControl(ControlElement element, const QStyleOption *op } break; #endif // QT_NO_DOCKWIDGET -#ifndef QT_NO_RUBBERBAND +#if QT_CONFIG(rubberband) case CE_RubberBand: if (qstyleoption_cast(option)) { QColor highlight = option->palette.color(QPalette::Active, QPalette::Highlight); @@ -2428,7 +2428,7 @@ void QWindowsXPStyle::drawControl(ControlElement element, const QStyleOption *op return; } break; -#endif // QT_NO_RUBBERBAND +#endif // QT_CONFIG(rubberband) case CE_HeaderEmptyArea: if (option->state & State_Horizontal) { @@ -3752,12 +3752,12 @@ int QWindowsXPStyle::styleHint(StyleHint hint, const QStyleOption *option, const } } break; -#ifndef QT_NO_RUBBERBAND +#if QT_CONFIG(rubberband) case SH_RubberBand_Mask: if (qstyleoption_cast(option)) res = 0; break; -#endif // QT_NO_RUBBERBAND +#endif // QT_CONFIG(rubberband) case SH_ItemView_DrawDelegateFrame: res = 1; 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