summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-08-30 16:12:56 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-08-30 16:12:56 (GMT)
commit998569ea293741f16e0a7fb4a7a249e902966bf7 (patch)
tree4e85e55f2c586349c1b4282108e4f05d4857a21c
parent51582e3d1251766a3ed941530d966e1a591cbed6 (diff)
parent1760f0e50cc2f5b39edb5fc751198a2f28871d83 (diff)
downloadQt-998569ea293741f16e0a7fb4a7a249e902966bf7.zip
Qt-998569ea293741f16e0a7fb4a7a249e902966bf7.tar.gz
Qt-998569ea293741f16e0a7fb4a7a249e902966bf7.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-s60-public into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-s60-public: Text is inputted on top of existing text in anomaly QLineEdit cursor is shown when asked to be non-visible
-rw-r--r--demos/embedded/anomaly/src/AddressBar.cpp20
-rw-r--r--src/gui/widgets/qlinecontrol.cpp4
2 files changed, 5 insertions, 19 deletions
diff --git a/demos/embedded/anomaly/src/AddressBar.cpp b/demos/embedded/anomaly/src/AddressBar.cpp
index 12523f2..f83876e 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");
diff --git a/src/gui/widgets/qlinecontrol.cpp b/src/gui/widgets/qlinecontrol.cpp
index d027b91..7f0c6c8 100644
--- a/src/gui/widgets/qlinecontrol.cpp
+++ b/src/gui/widgets/qlinecontrol.cpp
@@ -464,6 +464,8 @@ void QLineControl::processInputMethodEvent(QInputMethodEvent *event)
if (a.type == QInputMethodEvent::Cursor) {
m_preeditCursor = a.start;
m_hideCursor = !a.length;
+ if (m_hideCursor)
+ setCursorBlinkPeriod(0);
} else if (a.type == QInputMethodEvent::TextFormat) {
QTextCharFormat f = qvariant_cast<QTextFormat>(a.value).toCharFormat();
if (f.isValid()) {
@@ -527,7 +529,7 @@ void QLineControl::draw(QPainter *painter, const QPoint &offset, const QRect &cl
int cursor = m_cursor;
if (m_preeditCursor != -1)
cursor += m_preeditCursor;
- if(!m_blinkPeriod || m_blinkStatus)
+ if (!m_hideCursor && (!m_blinkPeriod || m_blinkStatus))
m_textLayout.drawCursor(painter, offset, cursor, m_cursorWidth);
}
}