将窗口置于前面 - > raise(),show(),activateWindow()不工作 [英] Bring window to front -> raise(),show(),activateWindow() don’t work

查看:1104
本文介绍了将窗口置于前面 - > raise(),show(),activateWindow()不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的Qt应用程序中,我在默认浏览器中打开一个URL。
然后,我想把我的应用程序的主窗口再次显示在前面。

In my Qt-application I open a URL in the default-browser. Afterwards I want to bring the main-window of my application to the front again.

我尝试了所有的方法,我可以找到但没有工作。它所做的是在任务栏(窗口7)中闪烁
下面是一个例子:

I tried all approaches I could find but none worked. All it does is blink in the taskbar (of Window 7) Here’s an example:

this->viewer->show();
this->viewer->raise();
this->viewer->activateWindow();

* viewer是指向从QDeclarativeView派生的QmlApplicationViewer的指针

*viewer is a pointer to a QmlApplicationViewer which is derived from QDeclarativeView

推荐答案

此问题是特定于Windows的。
如果活动窗口属于某些进程,则Windows不允许其他进程更改活动窗口。

This problem is specific to Windows. If the active window belongs to some process, then Windows does not allow other processes to change the active Window.

(不要尝试以下操作:
https://wiki.qt.io/Qt_project_org_faq#QWidget_ :: activateWindow.28.29 _-_ behavior_under_windows

(Do not try the following: https://wiki.qt.io/Qt_project_org_faq#QWidget_::activateWindow.28.29_-_behavior_under_windows)

这篇关于将窗口置于前面 - > raise(),show(),activateWindow()不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆