mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-08-06 05:23:58 -06:00
Add a ReadOnlySpinBox control that provides a spinBox with a readOnly property
Contributes to CURA-342
This commit is contained in:
parent
f71ddc4b9f
commit
1cb836aea5
1 changed files with 23 additions and 0 deletions
23
resources/qml/Preferences/ReadOnlySpinBox.qml
Normal file
23
resources/qml/Preferences/ReadOnlySpinBox.qml
Normal file
|
@ -0,0 +1,23 @@
|
|||
// Copyright (c) 2016 Ultimaker B.V.
|
||||
// Uranium is released under the terms of the AGPLv3 or higher.
|
||||
|
||||
import QtQuick 2.1
|
||||
import QtQuick.Controls 1.1
|
||||
import QtQuick.Dialogs 1.2
|
||||
|
||||
// Provides a SpinBox with the same readOnly property as a TextField
|
||||
SpinBox
|
||||
{
|
||||
id: base
|
||||
property bool readOnly: false
|
||||
|
||||
Keys.enabled: !readOnly
|
||||
MouseArea
|
||||
{
|
||||
acceptedButtons: Qt.AllButtons;
|
||||
anchors.fill: parent;
|
||||
enabled: parent.readOnly;
|
||||
onWheel: wheel.accepted = true;
|
||||
cursorShape: enabled ? Qt.ArrowCursor : Qt.IBeamCursor;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue