开发者

How to keep one of my application windows on top of the other windows of the same application?

开发者 https://www.devze.com 2023-01-08 08:41 出处:网络
I have a Motif-based notepad-like legacy application. I would like the modeless \"Find/Replace\" dialog (which is a Motif TopLevelShell) to always stay on top of the other windows of my application,

I have a Motif-based notepad-like legacy application.

I would like the modeless "Find/Replace" dialog (which is a Motif TopLevelShell) to always stay on top of the other windows of my application, but not on top of other applications.

I don't see any Motif-specific setting to do this.

KDE allows me to set window-specific behavior, but I can only make the "Find/Replace" window stay on top of all windows, which isn't right.

What is the correct way to force one of my application windows to st开发者_高级运维ay on top of the other windows of the same application? Is it possible at all? Is there a way to do it in Motif? KDE? Do I have to drop down to an X call?


If you use a DialogShell then this behavior happens automatically. DialogShells are not modal by default, and do work well for file open and find/replace. Here is a quote from the Motif book:

A DialogShell is always placed on top of the shell widget that owns the parent of the DialogShell.

Dialogs are described well in chapter 5.

Sorry for being 12 years late!


You can subclass KDialog http://api.kde.org/4.x-api/kdelibs-apidocs/kdeui/classKDialog.html#10744dda705aa265a43becab32a43ea4

with Qt::WA_ShowModal attribute http://doc.qt.nokia.com/4.0/qt.html#WindowType-enum

KDialog dialog(parent, Qt::WA_ShowModal)
dialog.exec()

Maybe it's not what you want, but ...

0

精彩评论

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

关注公众号