您的位置:首页 > 产品设计 > UI/UE

产生一个固定大小、禁止最大化、最小化的qquickview窗口

2016-05-24 23:28 766 查看

QQuickView

官方描述:

The QQuickView class provides a window for displaying a Qt Quick user interface.

This is a convenience subclass of QQuickWindow which will automatically load and display a QML scene when given the URL of the main source file. Alternatively, you can instantiate your own objects using QQmlComponent and place them in a manually setup QQuickWindow.

默认的qquickview产生的窗口是这样的:



所以就需要我们设置点什么了。

但是突然发现,怎么折腾没啥用。

后来,索性设置为dialog吧!

但是单词的dialog还是有问题,会出现一个万恶的?(帮助)按钮。

设置flags

设置Dialog

Qt::Dialog:

Indicates that the widget is a window that should be decorated as a dialog (i.e., typically no maximize or minimize buttons in the title bar). This is the default type for QDialog. If you want to use it as a modal dialog, it should be launched from another window, or have a parent and used with the QWidget::windowModality property. If you make it modal, the dialog will prevent other top-level windows in the application from getting any input. We refer to a top-level window that has a parent as a secondary window.

固定大小

Qt::MSWindowsFixedSizeDialogHint:

Gives the window a thin dialog border on Windows. This style is traditionally used for fixed-size dialogs.

带工具栏

Qt::WindowTitleHint:

Gives the window a title bar.

关闭默认的window title

Qt::CustomizeWindowHint:

Turns off the default window title hints.

有一个关闭按钮

Qt::WindowCloseButtonHint:

Adds a close button. On some platforms this implies Qt::WindowSystemMenuHint for it to work.

Qt::WindowFlags flag = Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint | Qt::CustomizeWindowHint | Qt::WindowSystemMenuHint;
pView->setFlags(flag);


稳妥:

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: