diff options
author | Sami Merila <sami.merila@nokia.com> | 2010-08-30 11:30:39 +0300 |
---|---|---|
committer | Sami Merila <sami.merila@nokia.com> | 2010-08-30 11:30:39 +0300 |
commit | 1760f0e50cc2f5b39edb5fc751198a2f28871d83 (patch) | |
tree | 6cfe4846fd50d589cb2d2525665661970f254bd3 /demos/embedded | |
parent | 287001fcd6d854b58bd61412e8b2c5bbdcb67b05 (diff) | |
download | qt4-tools-1760f0e50cc2f5b39edb5fc751198a2f28871d83.tar.gz |
Text is inputted on top of existing text in anomaly
Switch Anomaly demo app to use QLineEdit::setPlaceHolderText instead
of using own internal paint event handling for Address bar widget.
Task-number: QT-3657
Reviewed-by: Miikka Heikkinen
Diffstat (limited to 'demos/embedded')
-rw-r--r-- | demos/embedded/anomaly/src/AddressBar.cpp | 20 |
1 files changed, 2 insertions, 18 deletions
diff --git a/demos/embedded/anomaly/src/AddressBar.cpp b/demos/embedded/anomaly/src/AddressBar.cpp index 12523f2506..f83876e6eb 100644 --- a/demos/embedded/anomaly/src/AddressBar.cpp +++ b/demos/embedded/anomaly/src/AddressBar.cpp @@ -44,27 +44,11 @@ #include <QtCore> #include <QtGui> -class LineEdit: public QLineEdit -{ -public: - LineEdit(QWidget *parent = 0): QLineEdit(parent) {} - - void paintEvent(QPaintEvent *event) { - QLineEdit::paintEvent(event); - if (text().isEmpty()) { - QPainter p(this); - int flags = Qt::AlignLeft | Qt::AlignVCenter; - p.setPen(palette().color(QPalette::Disabled, QPalette::Text)); - p.drawText(rect().adjusted(10, 0, 0, 0), flags, "Enter address or search terms"); - p.end(); - } - } -}; - AddressBar::AddressBar(QWidget *parent) : QWidget(parent) { - m_lineEdit = new LineEdit(parent); + m_lineEdit = new QLineEdit(parent); + m_lineEdit->setPlaceholderText("Enter address or search terms"); connect(m_lineEdit, SIGNAL(returnPressed()), SLOT(processAddress())); m_toolButton = new QToolButton(parent); m_toolButton->setText("Go"); |