How to Bring the Widget Bring to front in Qt?

前端 未结 1 362
别那么骄傲
别那么骄傲 2020-12-31 02:36

Please have a look at this screenshot:

The circles are custom controls. When I click a control, I need to bring the widget to the front. Ex. if I click the

相关标签:
1条回答
  • 2020-12-31 03:12

    Have you tried QWidget::raise()?

    Raises this widget to the top of the parent widget's stack. After this call the widget will be visually in front of any overlapping sibling widgets.
    Note: When using activateWindow(), you can call this function to ensure that the window is stacked on top.

    So the pattern I usually use that will ensure a window is shown, brought to the front of sibling widgets and brought in front of other applications is:

    widget->show();
    widget->activateWindow();
    widget->raise();
    
    0 讨论(0)
提交回复
热议问题