diff options
-rw-r--r-- | src/widgets/widgets/qlineedit.cpp | 2 | ||||
-rw-r--r-- | src/widgets/widgets/qlineedit_p.cpp | 9 | ||||
-rw-r--r-- | src/widgets/widgets/qlineedit_p.h | 3 |
3 files changed, 12 insertions, 2 deletions
diff --git a/src/widgets/widgets/qlineedit.cpp b/src/widgets/widgets/qlineedit.cpp index ffe1ca1c66..e5e832ab98 100644 --- a/src/widgets/widgets/qlineedit.cpp +++ b/src/widgets/widgets/qlineedit.cpp @@ -2195,10 +2195,12 @@ void QLineEdit::changeEvent(QEvent *ev) update(); break; case QEvent::LayoutDirectionChange: +#if QT_CONFIG(toolbutton) for (const auto &e : d->trailingSideWidgets) { // Refresh icon to show arrow in right direction. if (e.flags & QLineEditPrivate::SideWidgetClearButton) static_cast<QLineEditIconButton *>(e.widget)->setIcon(d->clearButtonIcon()); } +#endif d->positionSideWidgets(); break; default: diff --git a/src/widgets/widgets/qlineedit_p.cpp b/src/widgets/widgets/qlineedit_p.cpp index 7da1d911ee..9947d63279 100644 --- a/src/widgets/widgets/qlineedit_p.cpp +++ b/src/widgets/widgets/qlineedit_p.cpp @@ -313,6 +313,8 @@ void QLineEditPrivate::drag() #endif // QT_NO_DRAGANDDROP + +#if QT_CONFIG(toolbutton) QLineEditIconButton::QLineEditIconButton(QWidget *parent) : QToolButton(parent) , m_opacity(0) @@ -390,6 +392,7 @@ void QLineEditIconButton::updateCursor() setCursor(qFuzzyCompare(m_opacity, qreal(1.0)) || !parentWidget() ? QCursor(Qt::ArrowCursor) : parentWidget()->cursor()); #endif } +#endif // QT_CONFIG(toolbutton) void QLineEditPrivate::_q_textChanged(const QString &text) { @@ -397,7 +400,7 @@ void QLineEditPrivate::_q_textChanged(const QString &text) const int newTextSize = text.size(); if (!newTextSize || !lastTextSize) { lastTextSize = newTextSize; -#ifndef QT_NO_ANIMATION +#if QT_CONFIG(animation) && QT_CONFIG(toolbutton) const bool fadeIn = newTextSize > 0; for (const SideWidgetEntry &e : leadingSideWidgets) { if (e.flags & SideWidgetFadeInWithText) @@ -507,6 +510,7 @@ QWidget *QLineEditPrivate::addAction(QAction *newAction, QAction *before, QLineE flags |= SideWidgetCreatedByWidgetAction; } if (!w) { +#if QT_CONFIG(toolbutton) QLineEditIconButton *toolButton = new QLineEditIconButton(q); toolButton->setIcon(newAction->icon()); toolButton->setOpacity(lastTextSize > 0 || !(flags & SideWidgetFadeInWithText) ? 1 : 0); @@ -514,6 +518,9 @@ QWidget *QLineEditPrivate::addAction(QAction *newAction, QAction *before, QLineE QObject::connect(toolButton, SIGNAL(clicked()), q, SLOT(_q_clearButtonClicked())); toolButton->setDefaultAction(newAction); w = toolButton; +#else + return nullptr; +#endif } // If there is a 'before' action, it takes preference PositionIndexPair positionIndex = before ? findSideWidget(before) : PositionIndexPair(position, -1); diff --git a/src/widgets/widgets/qlineedit_p.h b/src/widgets/widgets/qlineedit_p.h index 0a08aefab3..a903c003e6 100644 --- a/src/widgets/widgets/qlineedit_p.h +++ b/src/widgets/widgets/qlineedit_p.h @@ -74,7 +74,7 @@ QT_BEGIN_NAMESPACE class QLineEditPrivate; // QLineEditIconButton: This is a simple helper class that represents clickable icons that fade in with text - +#if QT_CONFIG(toolbutton) class Q_AUTOTEST_EXPORT QLineEditIconButton : public QToolButton { Q_OBJECT @@ -103,6 +103,7 @@ private: qreal m_opacity; }; +#endif // QT_CONFIG(toolbutton) class Q_AUTOTEST_EXPORT QLineEditPrivate : public QWidgetPrivate { |