diff options
author | Berthold Krevert <berthold.krevert@basyskom.com> | 2014-05-12 17:07:39 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-05-13 17:16:32 +0200 |
commit | 8c7ca2d9139c767e3b950850274d4d69eea664e9 (patch) | |
tree | 50fe1bf5774d139c9cc7fc6ddbb498edb518b619 | |
parent | d980f5e818cdb3485ca55ec35bf1b565b2531a27 (diff) | |
download | qtquickcontrols-8c7ca2d9139c767e3b950850274d4d69eea664e9.tar.gz |
Fix selection handling in texteditor example
Task-number: QTBUG-31784
Change-Id: I7122abbfd346edd85f17c54dfde37db93a1ba0fc
Reviewed-by: Caroline Chao <caroline.chao@digia.com>
Reviewed-by: Mitch Curtis <mitch.curtis@digia.com>
-rw-r--r-- | examples/quick/controls/texteditor/qml/main.qml | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/examples/quick/controls/texteditor/qml/main.qml b/examples/quick/controls/texteditor/qml/main.qml index 1a66afa5..26e22e98 100644 --- a/examples/quick/controls/texteditor/qml/main.qml +++ b/examples/quick/controls/texteditor/qml/main.qml @@ -272,16 +272,19 @@ ApplicationWindow { implicitWidth: 150 model: Qt.fontFamilies() property bool special : false - onCurrentTextChanged: { - if (special == false || currentIndex != 0) - document.fontFamily = currentText + onActivated: { + if (special == false || index != 0) { + document.fontFamily = textAt(index) + } } } SpinBox { id: fontSizeSpinBox + activeFocusOnPress: false implicitWidth: 50 value: 0 - onValueChanged: document.fontSize = value + property bool valueGuard: true + onValueChanged: if (valueGuard) document.fontSize = value } Item { Layout.fillWidth: true } } @@ -307,7 +310,11 @@ ApplicationWindow { selectionStart: textArea.selectionStart selectionEnd: textArea.selectionEnd Component.onCompleted: document.fileUrl = "qrc:/example.html" - onFontSizeChanged: fontSizeSpinBox.value = document.fontSize + onFontSizeChanged: { + fontSizeSpinBox.valueGuard = false + fontSizeSpinBox.value = document.fontSize + fontSizeSpinBox.valueGuard = true + } onFontFamilyChanged: { var index = Qt.fontFamilies().indexOf(document.fontFamily) if (index == -1) { |