Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
5.5.1
-
None
-
Precompiled Qt 5.5.1 for win32 (using mingw)
-
1d0f808c7dc708f5ec8093f09f332615b94f4318 (qt/qtdeclarative/dev)
Description
I'm trying to use a TextEdit to have some selectable (selectByMouse set to true) text on, but I don't want the user to be able to change it, so I have set readOnly to true.
The problem is that I have several of these TextEdit's, and I don't want the selection state to persist when selecting text from one of the other components, so I set persistentSelection to false hoping that would do it, but it doesn't seem to work.
However, if I set readOnly to false the persistentSelection property works as intended.
I'm not sure if that is intended behaviour or not, and if I perhaps should be using some other component that will work better.
import QtQuick 2.12 import QtQuick.Window 2.12 Window { id: window width: 640 height: 480 visible: true title: "QTBUG-50587" readonly property bool readOnly: true Row { Column { Text { text: "TextInput" anchors.horizontalCenter: parent.horizontalCenter } TextInput { text: "readOnly: " + readOnly padding: 12 readOnly: window.readOnly selectByMouse: true Rectangle { anchors.fill: parent color: "transparent" border.color: "darkorange" } } TextInput { text: "readOnly: " + readOnly padding: 12 readOnly: window.readOnly selectByMouse: true Rectangle { anchors.fill: parent color: "transparent" border.color: "darkorange" } } } Column { Text { text: "TextEdit" anchors.horizontalCenter: parent.horizontalCenter } TextEdit { text: "readOnly: " + readOnly padding: 12 readOnly: window.readOnly selectByMouse: true Rectangle { anchors.fill: parent color: "transparent" border.color: "darkorange" } } TextEdit { text: "readOnly: " + readOnly padding: 12 readOnly: window.readOnly selectByMouse: true Rectangle { anchors.fill: parent color: "transparent" border.color: "darkorange" } } } } }