summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJanne Anttila <janne.anttila@digia.com>2009-08-12 10:33:52 (GMT)
committerJanne Anttila <janne.anttila@digia.com>2009-08-12 10:33:52 (GMT)
commit34a4860216723c625e9311c6040fdbd1c5744b02 (patch)
tree0f7d785bb20a8aa004d053a07522cd400a8a3054
parent47f86ea037c11e2890f331f88c05fcd8667118c2 (diff)
parent76dab9f26af4fee925ce36eb237350ad07dfeefd (diff)
downloadQt-34a4860216723c625e9311c6040fdbd1c5744b02.zip
Qt-34a4860216723c625e9311c6040fdbd1c5744b02.tar.gz
Qt-34a4860216723c625e9311c6040fdbd1c5744b02.tar.bz2
Merge branch 'master' of git@scm.dev.troll.no:qt/qt-s60-public
Conflicts: tests/auto/qimagereader/tst_qimagereader.cpp
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp1
-rw-r--r--src/gui/widgets/qlinecontrol.cpp39
-rw-r--r--src/gui/widgets/qlineedit.cpp2
-rw-r--r--src/gui/widgets/qlineedit_p.h4
-rw-r--r--tests/auto/qimagereader/tst_qimagereader.cpp2
-rw-r--r--tests/auto/qprocess/tst_qprocess.cpp8
-rw-r--r--tests/auto/qscriptengine/qscriptengine.pro1
-rw-r--r--tests/auto/qscriptengine/tst_qscriptengine.cpp11
8 files changed, 49 insertions, 19 deletions
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index 2ef78b2..7091b5d 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -9108,7 +9108,6 @@ void QGraphicsTextItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
QApplication::sendEvent(receiver, &_event);
}
}
- QGraphicsItem::mouseReleaseEvent(event);
dd->clickCausedFocus = 0;
dd->sendControlEvent(event);
diff --git a/src/gui/widgets/qlinecontrol.cpp b/src/gui/widgets/qlinecontrol.cpp
index f4a2348..80215e1 100644
--- a/src/gui/widgets/qlinecontrol.cpp
+++ b/src/gui/widgets/qlinecontrol.cpp
@@ -400,8 +400,17 @@ void QLineControl::moveCursor(int pos, bool mark)
*/
void QLineControl::processInputMethodEvent(QInputMethodEvent *event)
{
- int priorState = m_undoState;
- removeSelectedText();
+ int priorState = 0;
+ bool isGettingInput = !event->commitString().isEmpty() || !event->preeditString().isEmpty()
+ || event->replacementLength() > 0;
+ bool cursorPositionChanged = false;
+
+ if (isGettingInput) {
+ // If any text is being input, remove selected text.
+ priorState = m_undoState;
+ removeSelectedText();
+ }
+
int c = m_cursor; // cursor position after insertion of commit string
if (event->replacementStart() <= 0)
@@ -415,11 +424,30 @@ void QLineControl::processInputMethodEvent(QInputMethodEvent *event)
m_selend = m_selstart + event->replacementLength();
removeSelectedText();
}
- if (!event->commitString().isEmpty())
+ if (!event->commitString().isEmpty()) {
insert(event->commitString());
+ cursorPositionChanged = true;
+ }
m_cursor = qMin(c, m_text.length());
+ for (int i = 0; i < event->attributes().size(); ++i) {
+ const QInputMethodEvent::Attribute &a = event->attributes().at(i);
+ if (a.type == QInputMethodEvent::Selection) {
+ m_cursor = qBound(0, a.start + a.length, m_text.length());
+ if (a.length) {
+ m_selstart = qMax(0, qMin(a.start, m_text.length()));
+ m_selend = m_cursor;
+ if (m_selend < m_selstart) {
+ qSwap(m_selstart, m_selend);
+ }
+ } else {
+ m_selstart = m_selend = 0;
+ }
+ cursorPositionChanged = true;
+ }
+ }
+
setPreeditArea(m_cursor, event->preeditString());
m_preeditCursor = event->preeditString().length();
m_hideCursor = false;
@@ -442,9 +470,10 @@ void QLineControl::processInputMethodEvent(QInputMethodEvent *event)
}
m_textLayout.setAdditionalFormats(formats);
updateDisplayText();
- if (!event->commitString().isEmpty())
+ if (cursorPositionChanged)
emitCursorPositionChanged();
- finishChange(priorState);
+ if (isGettingInput)
+ finishChange(priorState);
}
/*!
diff --git a/src/gui/widgets/qlineedit.cpp b/src/gui/widgets/qlineedit.cpp
index 5b04616..cd9666d 100644
--- a/src/gui/widgets/qlineedit.cpp
+++ b/src/gui/widgets/qlineedit.cpp
@@ -1657,7 +1657,7 @@ QVariant QLineEdit::inputMethodQuery(Qt::InputMethodQuery property) const
case Qt::ImFont:
return font();
case Qt::ImCursorPosition:
- return QVariant(d->control->hasSelectedText() ? d->control->selectionEnd() : d->control->cursor());
+ return QVariant(d->control->cursor());
case Qt::ImSurroundingText:
return QVariant(text());
case Qt::ImCurrentSelection:
diff --git a/src/gui/widgets/qlineedit_p.h b/src/gui/widgets/qlineedit_p.h
index b21820c..2c0d08f 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), clickCausedFocus(0),
+ dragEnabled(0), clickCausedFocus(0), hscroll(0), vscroll(0),
alignment(Qt::AlignLeading | Qt::AlignVCenter),
leftTextMargin(0), topTextMargin(0), rightTextMargin(0), bottomTextMargin(0)
{
@@ -101,7 +101,7 @@ public:
inline bool shouldEnableInputMethod() const
{
- return !control->isReadOnly() && (control->echoMode() == QLineEdit::Normal || control->echoMode() == QLineEdit::PasswordEchoOnEdit);
+ return !control->isReadOnly();
}
QPoint tripleClick;
diff --git a/tests/auto/qimagereader/tst_qimagereader.cpp b/tests/auto/qimagereader/tst_qimagereader.cpp
index 291025d..3b1b40b 100644
--- a/tests/auto/qimagereader/tst_qimagereader.cpp
+++ b/tests/auto/qimagereader/tst_qimagereader.cpp
@@ -56,7 +56,7 @@
#include <QTimer>
#if defined(Q_OS_SYMBIAN)
-# define SRCDIR ""
+# define SRCDIR "."
#endif
typedef QMap<QString, QString> QStringMap;
diff --git a/tests/auto/qprocess/tst_qprocess.cpp b/tests/auto/qprocess/tst_qprocess.cpp
index 6059833..111a093 100644
--- a/tests/auto/qprocess/tst_qprocess.cpp
+++ b/tests/auto/qprocess/tst_qprocess.cpp
@@ -164,7 +164,7 @@ protected slots:
void restartProcess();
void waitForReadyReadInAReadyReadSlotSlot();
void waitForBytesWrittenInABytesWrittenSlotSlot();
-
+
private:
QProcess *process;
qint64 bytesAvailable;
@@ -1805,8 +1805,9 @@ void tst_QProcess::setEnvironment_data()
void tst_QProcess::setEnvironment()
{
-#if !defined (Q_OS_WINCE)
- // there is no concept of system variables on Windows CE as there is no console
+#if defined (Q_OS_WINCE) || defined(Q_OS_SYMBIAN)
+ QSKIP("OS doesn't support environment variables", SkipAll);
+#endif
// make sure our environment variables are correct
QVERIFY(qgetenv("tst_QProcess").isEmpty());
@@ -1882,7 +1883,6 @@ void tst_QProcess::setEnvironment()
QCOMPARE(process.readAll(), value.toLocal8Bit());
}
-#endif
}
//-----------------------------------------------------------------------------
void tst_QProcess::systemEnvironment()
diff --git a/tests/auto/qscriptengine/qscriptengine.pro b/tests/auto/qscriptengine/qscriptengine.pro
index c33b979..4d1828f 100644
--- a/tests/auto/qscriptengine/qscriptengine.pro
+++ b/tests/auto/qscriptengine/qscriptengine.pro
@@ -10,5 +10,6 @@ wince*|symbian*: {
}
symbian: {
+ DEFINES += SYMBIAN_SRCDIR_UID=$$lower($$replace(TARGET.UID3,"0x",""))
TARGET.EPOCHEAPSIZE="0x100000 0x1000000 // Min 1Mb, max 16Mb"
}
diff --git a/tests/auto/qscriptengine/tst_qscriptengine.cpp b/tests/auto/qscriptengine/tst_qscriptengine.cpp
index de3a6aa..cb2ab2e 100644
--- a/tests/auto/qscriptengine/tst_qscriptengine.cpp
+++ b/tests/auto/qscriptengine/tst_qscriptengine.cpp
@@ -49,16 +49,17 @@
#include <qstandarditemmodel.h>
#include <QtCore/qnumeric.h>
-#if defined(Q_OS_SYMBIAN)
-# define SRCDIR ""
-#endif
-
Q_DECLARE_METATYPE(QList<int>)
Q_DECLARE_METATYPE(QObjectList)
//TESTED_CLASS=
//TESTED_FILES=
+#if defined(Q_OS_SYMBIAN)
+# define STRINGIFY(x) #x
+# define TOSTRING(x) STRINGIFY(x)
+# define SRCDIR "C:/Private/" TOSTRING(SYMBIAN_SRCDIR_UID)
+#endif
class tst_QScriptEngine : public QObject
{
Q_OBJECT
@@ -231,7 +232,7 @@ void tst_QScriptEngine::newFunction()
QCOMPARE(fun.prototype().isValid(), true);
QCOMPARE(fun.prototype().isFunction(), true);
QCOMPARE(fun.prototype().strictlyEquals(eng.evaluate("Function.prototype")), true);
-
+
QCOMPARE(fun.call().isNull(), true);
QCOMPARE(fun.construct().isObject(), true);
}