summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorJason Barron <jbarron@trolltech.com>2009-08-04 12:33:24 +0200
committerJason Barron <jbarron@trolltech.com>2009-08-04 12:33:24 +0200
commit67ae1b0dac175f48875507f3187ed49276a29ddf (patch)
treef8367c5f583a7d279ad137ec88517f36004ca89b /src/gui
parent4aafbd6222e7aeafd59a4a4356ba8c53b2bfa1d1 (diff)
downloadqt4-tools-67ae1b0dac175f48875507f3187ed49276a29ddf.tar.gz
Fix more compile breakages after merging qt/master-stable.
A lot of the logic was factored out of QLineEdit(Private) and into a private class called QLineControl, however the changes did not compile when keypad navigation is enabled so fix them.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/widgets/qdatetimeedit.cpp10
-rw-r--r--src/gui/widgets/qlinecontrol.cpp11
-rw-r--r--src/gui/widgets/qlineedit.cpp18
-rw-r--r--src/gui/widgets/qlineedit_p.h3
4 files changed, 20 insertions, 22 deletions
diff --git a/src/gui/widgets/qdatetimeedit.cpp b/src/gui/widgets/qdatetimeedit.cpp
index db57b4388f..1533edbf90 100644
--- a/src/gui/widgets/qdatetimeedit.cpp
+++ b/src/gui/widgets/qdatetimeedit.cpp
@@ -1086,10 +1086,7 @@ void QDateTimeEdit::keyPressEvent(QKeyEvent *event)
//hide cursor
d->edit->d_func()->setCursorVisible(false);
- if (d->edit->d_func()->cursorTimer > 0)
- killTimer(d->edit->d_func()->cursorTimer);
- d->edit->d_func()->cursorTimer = 0;
-
+ d->edit->d_func()->control->setCursorBlinkPeriod(0);
d->setSelected(0);
}
}
@@ -1110,10 +1107,7 @@ void QDateTimeEdit::keyPressEvent(QKeyEvent *event)
//hide cursor
d->edit->d_func()->setCursorVisible(false);
- if (d->edit->d_func()->cursorTimer > 0)
- killTimer(d->edit->d_func()->cursorTimer);
- d->edit->d_func()->cursorTimer = 0;
-
+ d->edit->d_func()->control->setCursorBlinkPeriod(0);
d->setSelected(0);
oldCurrent = 0;
}
diff --git a/src/gui/widgets/qlinecontrol.cpp b/src/gui/widgets/qlinecontrol.cpp
index 106d8f2aae..90ec1e387e 100644
--- a/src/gui/widgets/qlinecontrol.cpp
+++ b/src/gui/widgets/qlinecontrol.cpp
@@ -1295,7 +1295,7 @@ bool QLineControl::processEvent(QEvent* ev)
}
if ((ev->type() == QEvent::KeyRelease)
&& !isReadOnly()
- && deleteAllTimer) {
+ && m_deleteAllTimer) {
killTimer(m_deleteAllTimer);
m_deleteAllTimer = 0;
backspace();
@@ -1701,12 +1701,13 @@ void QLineControl::processKeyEvent(QKeyEvent* event)
if (text().length() == 0) {
setText(m_cancelText);
- if (passwordEchoEditing)
+ if (passwordEchoEditing())
updatePasswordEchoEditing(false);
- setEditFocus(false);
- } else if (!deleteAllTimer) {
- deleteAllTimer = startTimer(750);
+ // ### TODO this needs to be fixed.
+ // setEditFocus(false);
+ } else if (!m_deleteAllTimer) {
+ m_deleteAllTimer = startTimer(750);
}
} else {
unknown = true;
diff --git a/src/gui/widgets/qlineedit.cpp b/src/gui/widgets/qlineedit.cpp
index 01d4890587..8ab30fa471 100644
--- a/src/gui/widgets/qlineedit.cpp
+++ b/src/gui/widgets/qlineedit.cpp
@@ -1665,12 +1665,12 @@ QVariant QLineEdit::inputMethodQuery(Qt::InputMethodQuery property) const
case Qt::ImMaximumTextLength:
return QVariant(maxLength());
case Qt::ImAnchorPosition:
- if (d->selstart == d->selend)
- return QVariant(d->cursor);
- else if (d->selstart == d->cursor)
- return QVariant(d->selend);
+ if (d->control->selectionStart() == d->control->selectionEnd())
+ return QVariant(d->control->cursor());
+ else if (d->control->selectionStart() == d->control->cursor())
+ return QVariant(d->control->selectionEnd());
else
- return QVariant(d->selstart);
+ return QVariant(d->control->selectionStart());
default:
return QVariant();
}
@@ -1695,8 +1695,10 @@ void QLineEdit::focusInEvent(QFocusEvent *e)
#ifdef QT_KEYPAD_NAVIGATION
if (!QApplication::keypadNavigationEnabled() || (hasEditFocus() && e->reason() == Qt::PopupFocusReason))
#endif
- int cft = QApplication::cursorFlashTime();
- d->control->setCursorBlinkPeriod(cft/2);
+ {
+ int cft = QApplication::cursorFlashTime();
+ d->control->setCursorBlinkPeriod(cft/2);
+ }
QStyleOptionFrameV2 opt;
initStyleOption(&opt);
if((!hasSelectedText() && d->control->preeditAreaText().isEmpty())
@@ -1707,7 +1709,7 @@ void QLineEdit::focusInEvent(QFocusEvent *e)
qt_mac_secure_keyboard(true);
#endif
#ifdef QT_KEYPAD_NAVIGATION
- d->control->setCancelText(d->text);
+ d->control->setCancelText(d->control->text());
#endif
#ifndef QT_NO_COMPLETER
if (d->control->completer()) {
diff --git a/src/gui/widgets/qlineedit_p.h b/src/gui/widgets/qlineedit_p.h
index 230023de3a..b09c3f03b9 100644
--- a/src/gui/widgets/qlineedit_p.h
+++ b/src/gui/widgets/qlineedit_p.h
@@ -76,7 +76,7 @@ public:
QLineEditPrivate()
: control(0), frame(1), contextMenuEnabled(1), cursorVisible(0),
- dragEnabled(0), hscroll(0), vscroll(0),
+ dragEnabled(0), hscroll(0), vscroll(0), clickCausedFocus(0),
alignment(Qt::AlignLeading | Qt::AlignVCenter),
leftTextMargin(0), topTextMargin(0), rightTextMargin(0), bottomTextMargin(0)
{
@@ -110,6 +110,7 @@ public:
uint contextMenuEnabled : 1;
uint cursorVisible : 1;
uint dragEnabled : 1;
+ uint clickCausedFocus : 1;
int hscroll;
int vscroll;
uint alignment;