summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2015-05-06 17:00:21 +0200
committerGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2015-05-07 22:24:25 +0000
commita34e9ebc1b908d31ba645688a8b0e9e53c2d3c6e (patch)
tree3f6d7bd680e102c127b839912e1c0712728a6b0c /src/widgets
parentea17cc07685575fd1c00c0fc7c4aaa5d87ce72e8 (diff)
QLineEdit: show the clear button if it gets enabled after setting a text
We were fetching "lastText" too late, and setting the opacity of the clear button to 0. Change-Id: I82c2aea7dab4af4424fb57e12f78d07a0374457e Task-number: QTBUG-45518 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/widgets/qlineedit_p.cpp8
-rw-r--r--src/widgets/widgets/qlineedit_p.h2
2 files changed, 5 insertions, 5 deletions
diff --git a/src/widgets/widgets/qlineedit_p.cpp b/src/widgets/widgets/qlineedit_p.cpp
index 6a41c3791f..ad3a92d35a 100644
--- a/src/widgets/widgets/qlineedit_p.cpp
+++ b/src/widgets/widgets/qlineedit_p.cpp
@@ -440,6 +440,10 @@ QWidget *QLineEditPrivate::addAction(QAction *newAction, QAction *before, QLineE
Q_Q(QLineEdit);
if (!newAction)
return 0;
+ if (!hasSideWidgets()) { // initial setup.
+ QObject::connect(q, SIGNAL(textChanged(QString)), q, SLOT(_q_textChanged(QString)));
+ lastTextSize = q->text().size();
+ }
QWidget *w = 0;
// Store flags about QWidgetAction here since removeAction() may be called from ~QAction,
// in which a qobject_cast<> no longer works.
@@ -456,10 +460,6 @@ QWidget *QLineEditPrivate::addAction(QAction *newAction, QAction *before, QLineE
toolButton->setDefaultAction(newAction);
w = toolButton;
}
- if (!hasSideWidgets()) { // initial setup.
- QObject::connect(q, SIGNAL(textChanged(QString)), q, SLOT(_q_textChanged(QString)));
- lastTextSize = q->text().size();
- }
// If there is a 'before' action, it takes preference
PositionIndexPair positionIndex = before ? findSideWidget(before) : PositionIndexPair(position, -1);
SideWidgetEntryList &list = positionIndex.first == QLineEdit::TrailingPosition ? trailingSideWidgets : leadingSideWidgets;
diff --git a/src/widgets/widgets/qlineedit_p.h b/src/widgets/widgets/qlineedit_p.h
index 1ede07e4cb..4654262ea7 100644
--- a/src/widgets/widgets/qlineedit_p.h
+++ b/src/widgets/widgets/qlineedit_p.h
@@ -65,7 +65,7 @@ QT_BEGIN_NAMESPACE
// QLineEditIconButton: This is a simple helper class that represents clickable icons that fade in with text
-class QLineEditIconButton : public QToolButton
+class Q_AUTOTEST_EXPORT QLineEditIconButton : public QToolButton
{
Q_OBJECT
Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity)