summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2011-03-14 16:21:32 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2011-03-14 16:21:32 (GMT)
commit659351bc2e49637a14359dccdafc3ed03b46e645 (patch)
tree12f3a3ef6be31079a92776994334de258b549bc2
parent5662cda2d836f448d036ed516d0b9a2795f6905c (diff)
parent71c84f0be1632a6c7b3cee7b55762e656c5a7826 (diff)
downloadQt-659351bc2e49637a14359dccdafc3ed03b46e645.zip
Qt-659351bc2e49637a14359dccdafc3ed03b46e645.tar.gz
Qt-659351bc2e49637a14359dccdafc3ed03b46e645.tar.bz2
Merge branch 4.7 into qt-master-from-4.7
-rw-r--r--src/gui/styles/qs60style.cpp7
-rw-r--r--src/gui/text/qtextcontrol.cpp11
-rw-r--r--tests/auto/declarative/qdeclarativetextedit/data/mouseselection_false_words.qml7
-rw-r--r--tests/auto/declarative/qdeclarativetextedit/data/mouseselection_true_words.qml7
-rw-r--r--tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp2
5 files changed, 30 insertions, 4 deletions
diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp
index ecc2539..c107511 100644
--- a/src/gui/styles/qs60style.cpp
+++ b/src/gui/styles/qs60style.cpp
@@ -2643,10 +2643,13 @@ QSize QS60Style::sizeFromContents(ContentsType ct, const QStyleOption *opt,
sz = QCommonStyle::sizeFromContents( ct, opt, csz, widget);
//native items have small empty areas at the beginning and end of menu item
sz.setWidth(sz.width() + 2 * pixelMetric(PM_MenuHMargin) + 2 * QS60StylePrivate::pixelMetric(PM_FrameCornerWidth));
- if (QS60StylePrivate::isTouchSupported())
+ if (QS60StylePrivate::isTouchSupported()) {
//Make itemview easier to use in touch devices
+ sz.setHeight(sz.height() + 2 * pixelMetric(PM_FocusFrameVMargin));
//QCommonStyle does not adjust height with horizontal margin, it only adjusts width
- sz.setHeight(sz.height() + 2 * pixelMetric(PM_FocusFrameVMargin) - 8); //QCommonstyle adds 8 to height that this style handles through PM values
+ if (ct == CT_MenuItem)
+ sz.setHeight(sz.height() - 8); //QCommonstyle adds 8 to height that this style handles through PM values
+ }
break;
#ifndef QT_NO_COMBOBOX
case CT_ComboBox: {
diff --git a/src/gui/text/qtextcontrol.cpp b/src/gui/text/qtextcontrol.cpp
index c847bb5..b7a2697 100644
--- a/src/gui/text/qtextcontrol.cpp
+++ b/src/gui/text/qtextcontrol.cpp
@@ -1608,7 +1608,10 @@ void QTextControlPrivate::mouseMoveEvent(QEvent *e, Qt::MouseButton button, cons
if (!(buttons & Qt::LeftButton))
return;
- if (!((interactionFlags & Qt::TextSelectableByMouse) || (interactionFlags & Qt::TextEditable)))
+ const bool selectable = interactionFlags & Qt::TextSelectableByMouse;
+ const bool editable = interactionFlags & Qt::TextEditable;
+
+ if (!selectable && !editable)
return;
if (!(mousePressed
@@ -1624,6 +1627,10 @@ void QTextControlPrivate::mouseMoveEvent(QEvent *e, Qt::MouseButton button, cons
startDrag();
return;
}
+
+ if (!selectable)
+ return;
+
const qreal mouseX = qreal(mousePos.x());
int newCursorPos = q->hitTest(mousePos, Qt::FuzzyHit);
@@ -1639,7 +1646,7 @@ void QTextControlPrivate::mouseMoveEvent(QEvent *e, Qt::MouseButton button, cons
extendBlockwiseSelection(newCursorPos);
else if (selectedWordOnDoubleClick.hasSelection())
extendWordwiseSelection(newCursorPos, mouseX);
- else if (interactionFlags & Qt::TextSelectableByMouse)
+ else
setCursorPosition(newCursorPos, QTextCursor::KeepAnchor);
if (interactionFlags & Qt::TextEditable) {
diff --git a/tests/auto/declarative/qdeclarativetextedit/data/mouseselection_false_words.qml b/tests/auto/declarative/qdeclarativetextedit/data/mouseselection_false_words.qml
new file mode 100644
index 0000000..22a9871
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativetextedit/data/mouseselection_false_words.qml
@@ -0,0 +1,7 @@
+import QtQuick 1.0
+
+TextEdit {
+ focus: true
+ text: "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ selectByMouse: false
+}
diff --git a/tests/auto/declarative/qdeclarativetextedit/data/mouseselection_true_words.qml b/tests/auto/declarative/qdeclarativetextedit/data/mouseselection_true_words.qml
new file mode 100644
index 0000000..d61da46
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativetextedit/data/mouseselection_true_words.qml
@@ -0,0 +1,7 @@
+import QtQuick 1.0
+
+TextEdit {
+ focus: true
+ text: "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ selectByMouse: true
+}
diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
index 7aac76c..f62c2c5 100644
--- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
+++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
@@ -1305,6 +1305,8 @@ void tst_qdeclarativetextedit::mouseSelection_data()
QTest::newRow("on") << SRCDIR "/data/mouseselection_true.qml" << true;
QTest::newRow("off") << SRCDIR "/data/mouseselection_false.qml" << false;
QTest::newRow("default") << SRCDIR "/data/mouseselection_default.qml" << false;
+ QTest::newRow("on word selection") << SRCDIR "/data/mouseselection_true_words.qml" << true;
+ QTest::newRow("off word selection") << SRCDIR "/data/mouseselection_false_words.qml" << false;
}
void tst_qdeclarativetextedit::mouseSelection()