c++ - QT - 检查 QT 应用程序是否是焦点应用程序

标签 c++ qt

这是我想做的:

检查我在 Windows 上的 Qt 应用程序是在前面还是最小化的应用程序。 如果它最小化,则通过使其闪烁来吸引用户的注意。

现在我如何检测应用程序是最小化还是在后台?

最佳答案

我相信这就是您要找的:

http://qt-project.org/doc/qt-5/qwidget.html#isActiveWindow-prop

然后,您可以调用QWidget::activateWindow()

看笔记:

if you are calling this when the application is not currently the active one then it will not make it the active window. It will change the color of the taskbar entry to indicate that the window has changed in some way.

这听起来与您要实现的闪烁效果一模一样。

(链接适用于 Qt5,但这已经存在于 Qt4 中:http://qt-project.org/doc/qt-4.8/qwidget.html#activateWindow)

关于c++ - QT - 检查 QT 应用程序是否是焦点应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25027275/

相关文章:

c++ - 在 C++ 中,另外两个不同的共享对象可以从第三个共享对象访问 Singleton 吗?

c++ - 在 QT C++ 中创建一个类似列表框的控件

c++ - 枚举 C++ 中的枚举

c++ - Qt 和 Q_OBJECT

c++ - 如何捕捉QDockWidget的关闭按钮点击事件

c++ - 在 Qt 中释放和恢复嵌入窗口

qt - 有没有办法通过 Qt WebChannel 使用同步函数调用?

c++ - 数组如何与条件运算符一起使用?

c++ - 控制 std::vector 重新分配

c++ - 混合 STL 调试/发布库