开发者

How do I know if my Widget is obscured by another application or visible to the user?

Create a new widget, show it, and hide it behind another application.

Is there a way to find out if the widget is visible to the user? For example, if you have two applications running and visible to the user (obviously only one of them has focus and is active) but both are visible

The reason I am interested in this is because my widget has a treewidget which calls setText() (which is very expensive) so I want to optimize the performance by updating only when the treewidget is visible to the user.

But in general, I'd like to know if there's a way of find "if the widget is visible to the user or not."

Thank you for any suggestions and开发者_如何转开发 alternatives.


I think this is an expected behaviour as it is up to the window manager (if I'm not mistaken) to draw the windows according to their position, z-index,... So the Qt lib has nothing to do with that.

If you control when that other application is shown, you could hide the treewidget manually and show it again when you close the other application?

Otherwise, you should try to improve your widget and if you want help therefore, you should give us some code :)


Have you tried QWidget::isActiveWindow()


You propably want something that has to do with focus.

http://doc.qt.io/archives/qt-4.7/qwidget.html#focus-prop

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜