Qt文档阅读Window and Dialog Widgets

Posted pplxlee

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Qt文档阅读Window and Dialog Widgets相关的知识,希望对你有一定的参考价值。

Window and Dialog Widgets

没有嵌入到父控件中的控件(widget)称之为窗口(window)。通常窗口带有边框和标题栏。

Windows通常集成到桌面环境中,并且在某种程度上由桌面环境提供的窗口管理系统管理。例如,应用程序的选定窗口在任务栏中表示。

Primary and Secondary Windows

任何没有父组件的QWidget都将成为一个窗口,并且在大多数平台上都将在桌面的任务栏中列出。这通常只适用于应用程序中的一个窗口,即主窗口。

此外,通过设置Qt:: window标志,具有父组件的QWidget可以成为一个窗口。根据窗口管理系统的不同,这些辅助窗口通常堆叠在各自的父窗口之上,并且没有自己的任务栏条目。

QMainWindow类在其构造函数中设置了Qt::Window标志,因为它被设计为用作窗口,并提供了子部件不需要的工具。

Main Windows and Dialogs

Window Geometry

技术图片

X11 Peculiarities

On X11, a window does not have a frame until the window manager decorates it. This happens asynchronously at some point in time after calling QWidget::show() and the first paint event the window receives, or it does not happen at all. Bear in mind that X11 is policy-free (others call it flexible). Thus you cannot make any safe assumption about the decoration frame your window will get. Basic rule: There‘s always one user who uses a window manager that breaks your assumption, and who will complain to you.

Furthermore, a toolkit cannot simply place windows on the screen. All Qt can do is to send certain hints to the window manager. The window manager, a separate process, may either obey, ignore or misunderstand them. Due to the partially unclear Inter-Client Communication Conventions Manual (ICCCM), window placement is handled quite differently in existing window managers.

X11 provides no standard or easy way to get the frame geometry once the window is decorated. Qt solves this problem with nifty heuristics and clever code that works on a wide range of window managers that exist today. Don‘t be surprised if you find one where QWidget::frameGeometry() returns wrong results though.

Nor does X11 provide a way to maximize a window. QWidget::showMaximized() has to emulate the feature. Its result depends on the result of QWidget::frameGeometry() and the capability of the window manager to do proper window placement, neither of which can be guaranteed.

以上是关于Qt文档阅读Window and Dialog Widgets的主要内容,如果未能解决你的问题,请参考以下文章

控制窗口不能拖拉出主窗口 Dialog And Window

Qt::WindowFlags枚举类型(对Qt::Widget Qt::Window Qt::Dialog分别讲解,其中Qt::Widget是两用的,如新的窗口部件没有父窗口部件,则它是一个独立的窗口

Qt学习笔记

Qt Application Menu In Window and Mac

jquery dialog 如何设置弹出的dialog的位置???

qt中将窗口关闭后为啥还会显示到历史窗口