Qt::WindowFlags Enumeration type resolution

By Xchen 20160718

in use Qt I often see it when I design QWidget The following statement appears in the constructor of the control :
QWidget(QWidget *parent=0,Qt::WindowFlags f=0)
QWidget *parent=0 This code is easy to understand , Is the assignment of the parent widget .
Qt::WindowFlags f=0 Some of this code is confusing , In fact, it is the window ID of the specified control . The value is 0 Namely Qt::Widget.

Then it is necessary to talk about the window logo settings of the control . The window identifier consists of two parts: window type and window prompt hint, A window has only one window type . Window prompts define the appearance of the window , There can be multiple prompts , The window prompts to select or by bit .

Make it clear Qt::WindowFlags Enumerating types requires two concepts : Windows and parts ( This division is easy to distinguish )
window : Relatively independent , It can be divided into child window and parent window , The main feature is that the window has a complete border .
parts : Must exist depending on the parent window , Strong dependence , Appears inside the interface of the parent form .

With the above concept, it is easy to explain Qt::WindowFlags Enumerate the usage of type . First of all, determine whether a control is a form or not according to the parameters parent Assignment of , If the value is 0 Then we can judge that it is a window . Otherwise, it needs to be based on Qt::WindowFlags Enumeration type can be used to determine whether it is a window or a part .

stay Qt Assistant Search inside Qt::WindowFlags A detailed explanation will appear . Take some of them here :
Qt::Widget // Is a window or widget , Having a parent window is a component , No, it's the window Qt::Window // It's a window , There are window borders and titles Qt::Dialog
// Is a dialog window Qt::Sheet // Is a window or widget Macintosh form Qt::Drawer // Is a window or widget Macintosh drawer Qt
::Popup // Is a pop-up top-level window Qt::Tool // It's a tool window Qt::ToolTip // It's a prompt window , No title bar and window border Qt
::SplashScreen // It's a welcome window , yes QSplashScreen Default value of constructor Qt::Desktop // Is a desktop window or widget Qt
::SubWindow // It's a child window // Add some functions to the window Qt::CustomizeWindowHint // Turn off default window title prompt Qt
::WindowTitleHint // Decorate the window with a title bar Qt::WindowSystemMenuHint // Decorate a window menu system for windows Qt
::WindowMinimizeButtonHint // Add minimize button to window Qt::WindowMaximizeButtonHint
// Add a maximize button to the window Qt::WindowMinMaxButtonsHint // Add maximize and minimize buttons for the window Qt
::WindowCloseButtonHint Qt::WindowContextHelpButtonHint Qt
::MacWindowToolBarButtonHint Qt::WindowFullscreenButtonHint Qt
::BypassGraphicsProxyWidget Qt::WindowShadeButtonHint Qt::WindowStaysOnTopHint
Qt::WindowStaysOnBottomHint Qt::WindowOkButtonHint Qt::WindowCancelButtonHint Qt
thus , That's it Qt::WindowFlags Enumeration type , Mastering these will make the future interface design more flexible .

©2019-2020 Toolsou All rights reserved,
C Review of basic language knowledge Go Language learning notes (GUI programming )Java Misunderstanding —— Method overloading is a manifestation of polymorphism ? How to achieve low cost and high stability for cloud native applications ?elementui Shuttle box el-transfer Display list content text too long C/C++ Memory model Element-Ui assembly Message Message prompt , alert Popup C# Making a simplified version of calculator Python In pycharm editor Interface style modification Tiktok refresh progress bar ( Two little balls turn ), The code is simple