这是我想做的:
检查我在 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/