Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Mouse event over text box

Mouse event over text box

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 944 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Rath
    wrote on last edited by
    #1

    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!

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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 ?

      1 Reply Last reply
      0
      • R Offline
        R Offline
        Rath
        wrote on last edited by
        #3

        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?

        1 Reply Last reply
        0
        • mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by mrjj
          #4

          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 ?

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved