Qt correct way to show/display/raise window

前端 未结 2 1729
孤独总比滥情好
孤独总比滥情好 2021-01-07 18:24

Quite often I find that I need to show and bring a window to a front. For example when the user attempts to reload the same document I simply bring up the old one. To do thi

相关标签:
2条回答
  • 2021-01-07 19:03

    this is a working "shortcut" :

    widget->setWindowState(Qt::WindowActive) ;
    

    You can couple it with the last Qt::WindowState of the window. This notation is not very explicit though.

    0 讨论(0)
  • 2021-01-07 19:30

    No need for such complication. This is enough :

    widget->raise();
    widget->show();
    

    By the way, you can call show() once, and unless you hide() it, there are no needs to call show() again.

    0 讨论(0)
提交回复
热议问题