[Interest] TextInput, "NumberEdit" and mouse events

VStevenP vstevenpavao at yahoo.com
Wed Jul 9 15:19:56 CEST 2014


I'm trying to implement an enhanced version of QML TextInput component as a custom QML "NumberEdit" component.  It works great, in general, except I can't seem to add one necessary feature.

One of the added features is to be able to drag the mouse to edit the numeric value within a range of integer values described by a backend parameter descriptor which I've exposed to QML.

In every other way I've worked with TextInput, I've had great success reusing it, but for this case, I can't seem to get unfettered access the to the mouse events which would allow me to detect dragging and perform this sort of numeric edit.  I've tried using a MouseArea and using the different properties which allow events to propagate, but I haven't been able to achieve this feature.

Does anyone have an idea how to successfully enhance a TextInput to behave like a NumberEdit, yet still be able to drag the mouse to edit within a range?  I want to be able to implement custom handling for mouse press and move, but not break the features of TextInput.  Using a QML MouseArea seemed to cause contention and I was never able to reach my goal of accessing the mouse events without causing a problem with the TextInput behavior.

I know this is a generic and probably somewhat difficult question to answer, but perhaps someone who has intimate knowledge of the TextInput implementation would be able to let me know if it would be easy to enhance that widget to allow mouse events to propagate more easily to a nested MouseArea, allowing such a drag edit feature to be realized.

- VStevenP



More information about the Interest mailing list