Quantcast
Channel: Qt DevNet forums: Qt Quick 1283365070**
Viewing all articles
Browse latest Browse all 4972

[SOLVED] IntValidator does not check range correctly after assignment of min/max range from delegate

$
0
0
Hello, IntValidator behaves strangely when I assign the limits through a delegate : The value from the model data appears, and I can edit that, but the range is not checked : – I can enter 8888888888888888888 when range is set to -100,+100. – when i delete all characters, i can no longer type new digits into the field. If this same assignment is executed in a separate test, Testscreen1.qml, a simple button onclick handler, this works fine, I don’t see why this works and the other situation not. When I look with the qml ‘live’ debug object viewer, the assignments seem to be ok. In the c++ objects from the qlist in the mode, the properties are QStrings : Q_PROPERTY(QString prop_min READ getmin WRITE setmin NOTIFY minChanged) Q_PROPERTY(QString prop_max READ getmax WRITE setmax NOTIFY maxChanged) (I use string properties as this may later be extended to a hex range as well). So I would be very happy if an expert here can see what I am doing wrong (be it a bug or the wrong way). Thank you, Serge // code from delegate, this causes the problem :   id: paramlijstDelegate             Row {                 id: paramlijst                 Rectangle {                     width: 250                     height: 60                     color: "#353535"                     radius : 5                     MouseArea{                         id: paramlistMouseArea                         anchors.fill: parent                         onClicked: {                             paramedit1.paramname = model.modelData.prop_name;                             paramedit1.paramdescription = model.modelData.prop_description;                             paramedit1.paramvalue = model.modelData.prop_value;                             paramedit1.parammax = model.modelData.prop_max;                             paramedit1.parammin = model.modelData.prop_min;                         }                     }                     Column {                         width: parent.width                         anchors.horizontalCenter: parent.horizontalCenter                         Text { width: parent.width; anchors.horizontalCenter: parent.horizontalCenter; font.pointSize : 18 ; horizontalAlignment:Text.AlignHCenter; text : model.modelData.prop_name; color: "#00B4FF"   }                         Text { width: parent.width;  anchors.horizontalCenter: parent.horizontalCenter; font.pointSize : 14 ; horizontalAlignment:Text.AlignHCenter; text:  model.modelData.prop_value; color: "#FFFFFF" }                     }                 } // code from Testscreen1.qml, this does work fine     Button {         id: udpateparam_button         x: 50         y: 325         width: 50         text: qsTr("Assign Data")         onClicked: {                         paramedit.paramname = "updatedparam";                         paramedit.paramdescription = "description";                         paramedit.paramvalue = "20";                         paramedit.parammax = "99";                         paramedit.parammin = "-99";                     }     } //ParamEdit.qml   import QtQuick 2.2 import QtQuick.Dialogs 1.1 import QtGraphicalEffects 1.0 import QtQuick.Controls 1.2 import QtQuick.Controls.Styles 1.2 import "controls" import "." Item {       property string paramname :"paramname"     property string paramvalue :"500"     property string parammin : "-999"     property string parammax : "999"     property string paramdescription : "no description"     Text {         id: paramnamelabel         x: 25         y: 15         color : "#00B4FF"         text:  paramname         font.pixelSize: 24     }     TNumericEditV1{         id: paramvalueedit         x: 25         y: 55         width: 80         height: 35         text: paramvalue         minimum : parseInt(parammin)         maximum : parseInt(parammax)         font.pixelSize: 18     }     Text {         id: paramdescriptionlabel         x: 25         y: 100         text:  paramdescription         color : "#B3B3B3"         font.pixelSize: 12     }     Button {         id: button_apply_field         x: 25         y: 300         text: qsTr("Apply")         onClicked : marpguiobj1.setParameterValue(paramnamelabel.text,paramvalueedit.text);     }   }   //TNumericEditV1.qml import QtQuick 2.2   Rectangle {     width: 96; height: input.height + 8     color: "lightsteelblue"     border.color: "gray"     property alias text: input.text     property alias input: input     property alias font : input.font     property int minimum :  0     property int maximum :  1000       TextInput {         id: input         anchors.fill: parent         anchors.margins: 4         focus: true         validator: IntValidator { bottom:minimum; top: maximum}         inputMethodHints : Qt.ImhFormattedNumbersOnly     } }

Viewing all articles
Browse latest Browse all 4972

Trending Articles