Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Force window widget in focus until event occurs



  • I am unsure of what the correct term is, but I my goal is to make a widget to forever be in "focus" or always "active" until, say, a button is clicked.

    I currently have a custom widget where someone can add an Item to a database. I want this to be the only window the user can access until the Cancel or Add Item button is pressed. Then the widget window closes and the user can resume with tasks on the main window. However, when the widget window is open, clicking outside of the widget onto the main application causes the widget window flashes and in in Windows OS, make an annoying sound. I hope that makes sense.

    Is there an option to set this in Qt Designer, or do I need to implement it in code?

    I am using VS with the Qt extension btw.



  • @SGaist ah ok. Can I modify my current widget to turn that into a modal dialog, or do i have to re-create my widget to a modal dialog?

    Edit: Set it up as a QDialog and then after making sure Qt Designer recognized the widget as a QDialog, I checked "modal" in the QDialog settings in Qt Designer and it works great.


  • Lifetime Qt Champion

    Hi,

    From the looks of it, you want a window modal dialog.



  • @SGaist ah ok. Can I modify my current widget to turn that into a modal dialog, or do i have to re-create my widget to a modal dialog?

    Edit: Set it up as a QDialog and then after making sure Qt Designer recognized the widget as a QDialog, I checked "modal" in the QDialog settings in Qt Designer and it works great.


Log in to reply