Skip to content

Commit

Permalink
Use numeric input for Range widgets
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Sep 7, 2016
1 parent 2817610 commit 8b680d2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
23 changes: 13 additions & 10 deletions src/qml/FeatureForm.qml
@@ -1,6 +1,7 @@
import QtQuick 2.6
import QtQuick.Controls 1.4 as Controls
import QtQuick.Controls.Styles 1.4
import QtQuick.Controls.Private 1.0
import QtQuick.Layouts 1.1
import QtGraphicalEffects 1.0
import QtQml.Models 2.2
Expand Down Expand Up @@ -42,6 +43,16 @@ Rectangle {

id: container


// A container for the main form area (below the tabs)
Connections {
target: container
onVisibleChanged: {
if ( container.visible )
content.sourceComponent = element
}
}

// Tabs
Item {
anchors.fill: parent
Expand Down Expand Up @@ -199,14 +210,6 @@ Rectangle {
content.pType = 'tab'
}
}

Connections {
target: container
onVisibleChanged: {
if ( container.visible )
content.sourceComponent = element
}
}
}

/**
Expand Down Expand Up @@ -249,7 +252,7 @@ Rectangle {
text: name
height: name === '' ? 0 : undefined
anchors { left: parent.left; right: parent.right }
font { pointSize: 20 * dp; bold: true }
font { pixelSize: 1.4 * TextSingleton.font.pixelSize; bold: true }
}

Column {
Expand Down Expand Up @@ -328,7 +331,7 @@ Rectangle {
if ( attributeEditorLoader.status === Loader.Error )
{
console.warn( "Editor widget type '" + editorWidget + "' not avaliable." )
widget = 'TextEdit'
source = 'editorwidgets/TextEdit.qml'
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/qml/editorwidgets/TextEdit.qml
Expand Up @@ -14,7 +14,7 @@ Item {

text: value || ''

inputMethodHints: field.isNumeric ? Qt.ImhDigitsOnly : Qt.ImhNone
inputMethodHints: field.isNumeric || widget == 'Range' ? Qt.ImhDigitsOnly : Qt.ImhNone

onEditingFinished: {
valueChanged( text, text == '' )
Expand Down

0 comments on commit 8b680d2

Please sign in to comment.