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 From 6cd46c9a61c3493b975416ec4309af75db5dafaf Mon Sep 17 00:00:00 2001 From: Stephan Binner Date: Sun, 9 Jul 2017 11:37:40 +0200 Subject: Convert features.datetimeedit to QT_[REQUIRE_]CONFIG Change-Id: I083cd565fab8c33dc3633b71f962de099c2b3481 Reviewed-by: Oswald Buddenhagen --- src/widgets/widgets/qabstractspinbox.cpp | 2 ++ src/widgets/widgets/qdatetimeedit.cpp | 4 ---- src/widgets/widgets/qdatetimeedit.h | 7 ++----- src/widgets/widgets/qdatetimeedit_p.h | 4 ---- src/widgets/widgets/widgets.pri | 12 +++++++++--- 5 files changed, 13 insertions(+), 16 deletions(-) (limited to 'src/widgets/widgets') diff --git a/src/widgets/widgets/qabstractspinbox.cpp b/src/widgets/widgets/qabstractspinbox.cpp index 4a3abe0c32..22f3745b26 100644 --- a/src/widgets/widgets/qabstractspinbox.cpp +++ b/src/widgets/widgets/qabstractspinbox.cpp @@ -49,7 +49,9 @@ #include #include #include +#if QT_CONFIG(datetimeedit) #include +#endif #include #include #include diff --git a/src/widgets/widgets/qdatetimeedit.cpp b/src/widgets/widgets/qdatetimeedit.cpp index e136363b17..053b184226 100644 --- a/src/widgets/widgets/qdatetimeedit.cpp +++ b/src/widgets/widgets/qdatetimeedit.cpp @@ -54,8 +54,6 @@ #include -#ifndef QT_NO_DATETIMEEDIT - //#define QDATETIMEEDIT_QDTEDEBUG #ifdef QDATETIMEEDIT_QDTEDEBUG # define QDTEDEBUG qDebug() << QString::fromLatin1("%1:%2").arg(__FILE__).arg(__LINE__) @@ -2674,5 +2672,3 @@ void QCalendarPopup::hideEvent(QHideEvent *) QT_END_NAMESPACE #include "moc_qdatetimeedit.cpp" #include "moc_qdatetimeedit_p.cpp" - -#endif // QT_NO_DATETIMEEDIT diff --git a/src/widgets/widgets/qdatetimeedit.h b/src/widgets/widgets/qdatetimeedit.h index 30e4a58bb3..b46434c1a4 100644 --- a/src/widgets/widgets/qdatetimeedit.h +++ b/src/widgets/widgets/qdatetimeedit.h @@ -45,10 +45,9 @@ #include #include -QT_BEGIN_NAMESPACE - +QT_REQUIRE_CONFIG(datetimeedit); -#ifndef QT_NO_DATETIMEEDIT +QT_BEGIN_NAMESPACE class QDateTimeEditPrivate; class QStyleOptionSpinBox; @@ -228,8 +227,6 @@ Q_SIGNALS: Q_DECLARE_OPERATORS_FOR_FLAGS(QDateTimeEdit::Sections) -#endif // QT_NO_DATETIMEEDIT - QT_END_NAMESPACE #endif // QDATETIMEEDIT_H diff --git a/src/widgets/widgets/qdatetimeedit_p.h b/src/widgets/widgets/qdatetimeedit_p.h index 5302d6d9a7..bc70780de9 100644 --- a/src/widgets/widgets/qdatetimeedit_p.h +++ b/src/widgets/widgets/qdatetimeedit_p.h @@ -63,8 +63,6 @@ #include "qdebug.h" -#ifndef QT_NO_DATETIMEEDIT - QT_BEGIN_NAMESPACE class QCalendarPopup; @@ -181,6 +179,4 @@ private: QT_END_NAMESPACE -#endif // QT_NO_DATETIMEEDIT - #endif // QDATETIMEEDIT_P_H diff --git a/src/widgets/widgets/widgets.pri b/src/widgets/widgets/widgets.pri index b142be8041..610932c6ce 100644 --- a/src/widgets/widgets/widgets.pri +++ b/src/widgets/widgets/widgets.pri @@ -8,8 +8,6 @@ HEADERS += \ widgets/qcalendarwidget.h \ widgets/qcombobox.h \ widgets/qcombobox_p.h \ - widgets/qdatetimeedit.h \ - widgets/qdatetimeedit_p.h \ widgets/qdial.h \ widgets/qdockwidget.h \ widgets/qdockwidget_p.h \ @@ -71,7 +69,6 @@ SOURCES += \ widgets/qabstractspinbox.cpp \ widgets/qcalendarwidget.cpp \ widgets/qcombobox.cpp \ - widgets/qdatetimeedit.cpp \ widgets/qdial.cpp \ widgets/qdockwidget.cpp \ widgets/qdockarealayout.cpp \ @@ -148,6 +145,15 @@ qtConfig(commandlinkbutton) { widgets/qcommandlinkbutton.cpp } +qtConfig(datetimeedit) { + HEADERS += \ + widgets/qdatetimeedit.h \ + widgets/qdatetimeedit_p.h + + SOURCES += \ + widgets/qdatetimeedit.cpp +} + qtConfig(fontcombobox) { HEADERS += widgets/qfontcombobox.h SOURCES += widgets/qfontcombobox.cpp -- cgit v1.2.3 From 01703d026420cd0964bec872f7af54fd077b82ad Mon Sep 17 00:00:00 2001 From: Stephan Binner Date: Sun, 9 Jul 2017 16:53:58 +0200 Subject: Convert features.tableview to QT_[REQUIRE_]CONFIG Change-Id: I7ab479deff7bbf3083d1efa196e0480b181548c5 Reviewed-by: Oswald Buddenhagen --- src/widgets/widgets/qcombobox.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/widgets/widgets') diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp index 5520e9d28f..84d81fa089 100644 --- a/src/widgets/widgets/qcombobox.cpp +++ b/src/widgets/widgets/qcombobox.cpp @@ -47,7 +47,9 @@ #include #include #include +#if QT_CONFIG(tableview) #include +#endif #include #include #include @@ -598,7 +600,7 @@ int QComboBoxPrivateContainer::topMargin() const { if (const QListView *lview = qobject_cast(view)) return lview->spacing(); -#ifndef QT_NO_TABLEVIEW +#if QT_CONFIG(tableview) if (const QTableView *tview = qobject_cast(view)) return tview->showGrid() ? 1 : 0; #endif @@ -613,7 +615,7 @@ int QComboBoxPrivateContainer::spacing() const QListView *lview = qobject_cast(view); if (lview) return 2 * lview->spacing(); // QListView::spacing is the padding around the item. -#ifndef QT_NO_TABLEVIEW +#if QT_CONFIG(tableview) QTableView *tview = qobject_cast(view); if (tview) return tview->showGrid() ? 1 : 0; -- cgit v1.2.3 From 70515726181a7e97e1a7096f6b63d4320581d5c1 Mon Sep 17 00:00:00 2001 From: Daniel Teske Date: Tue, 27 Jun 2017 15:10:35 +0200 Subject: QLineEdit: Fix length calculation for input mask "\\\\" Consider the raw string \\\\. The previous algorithm would consider the last 3 \ to be escaped because the previous character is a \ and thus calculating a maxLength of 3. But this should be treated as two escaped \ with a maxLength of 2. Change-Id: I6c4b8d090a2e1c6e85195d5920ce8b80aea1bc2d Reviewed-by: Marc Mutz --- src/widgets/widgets/qwidgetlinecontrol.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src/widgets/widgets') diff --git a/src/widgets/widgets/qwidgetlinecontrol.cpp b/src/widgets/widgets/qwidgetlinecontrol.cpp index 905bc0f586..97df3427b0 100644 --- a/src/widgets/widgets/qwidgetlinecontrol.cpp +++ b/src/widgets/widgets/qwidgetlinecontrol.cpp @@ -973,12 +973,20 @@ void QWidgetLineControl::parseInputMask(const QString &maskFields) // calculate m_maxLength / m_maskData length m_maxLength = 0; QChar c = 0; + bool escaped = false; for (int i=0; i 0 && m_inputMask.at(i-1) == QLatin1Char('\\')) { - m_maxLength++; - continue; + if (escaped) { + ++m_maxLength; + escaped = false; + continue; } + + if (c == '\\') { + escaped = true; + continue; + } + if (c != QLatin1Char('\\') && c != QLatin1Char('!') && c != QLatin1Char('<') && c != QLatin1Char('>') && c != QLatin1Char('{') && c != QLatin1Char('}') && -- cgit v1.2.3