900字范文,内容丰富有趣,生活中的好帮手!
900字范文 > 【Qt】弹出子窗口时禁用主窗口

【Qt】弹出子窗口时禁用主窗口

时间:2019-02-27 21:44:45

相关推荐

【Qt】弹出子窗口时禁用主窗口

子窗口名:userManagerDialogQt::WindowFlags flags = Qt::Dialog;userManagerDialog->setWindowFlags(flags);弹出子窗口时禁用主窗口userManagerDialog->setWindowModality(Qt::ApplicationModal); //阻塞除当前窗体之外的所有的窗体

关于setWindowFlag的解释:

Window flags are a combination of a type (e.g. Qt::Dialog) and zero or more hints to the window system (e.g.Qt::FramelessWindowHint).

If the widget had type Qt::Widget or Qt::SubWindow and becomes a window (Qt::Window,Qt::Dialog, etc.), it is put at position (0, 0) on the desktop. If the widget is a window and becomes aQt::Widget orQt::SubWindow, it is put at position (0, 0) relative to its parent widget.

Note: This function calls setParent() when changing the flags for a window, causing the widget to be hidden. You must callshow() to make the widget visible again..

Access functions:

关于setWindowModality的解释:

This property holds which windows are blocked by the modal widget.

This property only makes sense for windows. A modal widget prevents widgets in other windows from getting input. The value of this property controls which windows are blocked when the widget is visible. Changing this property while the window is visible has no effect; you must hide() the widget first, thenshow() it again.

By default, this property is Qt::NonModal.

This property was introduced in Qt 4.1.

Access functions:

This enum specifies the behavior of a modal window. A modal window is one that blocks input to other windows. Note that windows that are children of a modal window are not blocked.

The values are:

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。