Important: Please read the Qt Code of Conduct -

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.


    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!

  • Lifetime Qt Champion

    Sort of like a ?
    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?

  • Lifetime Qt Champion

    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
    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