Mouse event over text box



  • Hi

    I am working on a opengl based model viewer and I want to have the transform properties of the model controlled from the UI using textboxes which I can have type and mouse events similar to what is shown in the picture.

    0_1522766517890_5b449042-857e-4da9-82a0-d148410bbdb4-image.png

    How do I achieve it? Right now I have a text edit where I manually enter the values for transforms but I want to control it with the mouse. So I can decrease and increase the values of the transform as I drag and move the mouse left and right. Please point me in the right direction. Also any tutorial links would be greatly appreciated which does what I want.

    Thanks in advance!


  • Qt Champions 2017

    Hi
    Sort of like a
    http://doc.qt.io/qt-5/qspinbox.html#details ?
    But without the buttons and you click in value area and drag to increase/decrease the value ?



  • Hi mrjj,

    Thanks for your response.

    Yes sorta like a spinbox where you increase and decrease values but I want it controlled with mouse click and drag as you have mentioned!

    How do I do it?


  • Qt Champions 2017

    Hi
    If you still want to be able to input , you can subclass lineEdit and override mousePress and mRelease to implement the logic.
    You could maybe do it via event filter on a std edit/spinbox but
    http://doc.qt.io/qt-5/qobject.html#eventFilter
    its nothing i have tried.

    You could also subclass SpinBox to get most features of it (increase value etc) and maybe get the most complete solution. But might be a bit overkill ?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.