Details
-
Suggestion
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
None
-
None
Description
In design studio there is a use case where a CheckBox can be "read-only". The user can't click on it, but they can click on an action indicator to the left of it that opens a menu. Currently the only way to achieve this is to use a MouseArea to block the CheckBox while the "readOnly" property is true. Using Binding to force the checked state doesn't work (you can still affect it by clicking on it):
import QtQuick 2.12 import QtQuick.Controls 2.12 ApplicationWindow { width: 640 height: 480 visible: true CheckBox { id: checkBox property bool readOnly: true Binding { target: checkBox property: "checked" value: false when: checkBox.readOnly } Binding { target: checkBox property: "checkState" value: Qt.Unchecked when: checkBox.readOnly } } }
Setting enabled to false is not an option because that then disables the action indicator (which is a child of the CheckBox).
So we could add an interactive property which disables interaction with the control itself but not its children.
Attachments
Issue Links
- relates to
-
QTBUG-89785 Add a means to allow mouse/touch events to pass through a Control if desired instead of just accepting all of them
- Reported
- resulted from
-
QDS-4679 Enable read only controls in the property editor
- Reported