Select widget via function... ?



  • Hey

    I'd like to create a "action" that would behave like :

    1. I press the button.
    2. Now once I move, widgets highlight/frame outline once mouse hover
    3. Click would return that widget ptr...

    Any idea how to bite it ?


  • Lifetime Qt Champion

    Hi,

    One way could be to create a transparent widget on top of your UI, make it track the mouse moves and draw a QRubberBand on the widget that's under the mouse cursor. You enable that widget with your button.



  • Set a stylesheet for the widgets:

    QWidget:hover { border: 1px solid red; }
    

    And get the clicked widget's pointers by connecting to QApplication::focusChanged(QWidget *old, QWidget *now).


Log in to reply