Fix build with -no-feature-toolbutton
Change-Id: I16495548fa3ed24409883fadab08ddb8545efd0d Reviewed-by: Lars Knoll <lars.knoll@qt.io>bb10
parent
b0b726f8c7
commit
033fa96b6c
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue