qt - 我如何知道我的 Widget 是否被其他应用程序遮挡或对用户可见?

标签 qt qt4 qwidget qtreewidget qt4.7

创建一个新的小部件,显示它,然后将它隐藏在另一个应用程序后面。

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

我对此感兴趣的原因是因为我的小部件有一个调用 setText() 的 treewidget(这非常昂贵)所以我想通过仅在 treewidget 对用户可见时更新来优化性能。

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."

感谢您提出任何建议和替代方案。

最佳答案

我认为这是一个预期的行为,因为它取决于窗口管理器(如果我没记错的话)根据它们的位置、z-index 等来绘制窗口,所以 Qt 库与它无关

如果您控制其他应用程序的显示时间,您可以手动隐藏 treewidget 并在关闭其他应用程序时再次显示它?

否则,您应该尝试改进您的小部件,因此如果您需要帮助,您应该给我们一些代码:)

关于qt - 我如何知道我的 Widget 是否被其他应用程序遮挡或对用户可见?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7259625/

相关文章:

c++ - Qt4 小部件 : implementing a wait function without blocking the widget

performance - 如何优化基于 QGraphicsView 的应用程序的性能?

qt - 如何防止 QWidget 绘制,但仍响应事件?

c++ - 如何从父级不是 QMainWindow 的 QWidget 访问 QMainWindow

c++ - 需要手动删除 QValidator 吗?

c++ - Qt 隐式共享类 - 调用函数按值传递和返回的成本高吗?

qt - 在 BB10 应用程序上,如何在到达列表末尾之前向 ListView 添加更多项目?

c++ - Mlt 框架 : Crashes while playing video

c++ - 无法将 std::wstring 写入 wofstream

ruby - 如何强制 Qt 小部件保持相等的高度和宽度?