Record it windowFlags The style and usage of various flag bits ,
Qt User defined interface ( Form zoom )
// Set no borders
setWindowFlags(Qt::FramelessWindowHint);
// Transparent background
setAttribute(Qt::WA_TranslucentBackground, true);

setWindowOpacity(0.5); // Set background transparency 0 It is completely transparent
    
setWindowFlags(Qt::Dialog | Qt::FramelessWindowHint |
Qt::WindowStaysOnTopHint); // Set window top
      
code :
#include "qtwindowflagstest.h"
#include <QtWidgets/QApplication>
#include <QStatusBar>
#include <QObject>
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    QtWindowFlagsTest w;
    w.setGeometry(10, 30, 200, 200);
    w.statusBar()->showMessage(QObject::tr("Normal"));
    w.show();

    // There is only one close button
    QtWindowFlagsTest w2;
    w2.setGeometry(225, 30, 200, 200);
    w2.setWindowFlags(Qt::WindowCloseButtonHint);
    w2.statusBar()->showMessage("Qt::WindowCloseButtonHint");
    w2.show();

    // It's like a dialog box , There's a question mark and a close button
    QtWindowFlagsTest w3;
    w3.setGeometry(440, 30, 200, 200);
    w3.setWindowFlags(Qt::WindowContextHelpButtonHint);
    w3.statusBar()->showMessage("Qt::WindowContextHelpButtonHint");
    w3.show();

    // There is no title bar There are no buttons If you show up there, you can't get there , It can't be moved or dragged , Right click on the taskbar and nothing , There is no taskbar window name , But it can be turned off from the task manager
    QtWindowFlagsTest w4;
    w4.setGeometry(655, 30, 200, 200);
    w4.setWindowFlags(Qt::CustomizeWindowHint);
    w4.statusBar()->showMessage("Qt::CustomizeWindowHint");
    w4.show();

    // The window has only one close button
    QtWindowFlagsTest w5;
    w5.setGeometry(870, 30, 200, 200);
    w5.setWindowFlags(Qt::WindowTitleHint);
    w5.statusBar()->showMessage("Qt::WindowTitleHint");
    w5.show();

    // There is only one close button
    QtWindowFlagsTest w6;
    w6.setGeometry(1085, 30, 200, 200);
    w6.setWindowFlags(Qt::WindowSystemMenuHint);
    w6.statusBar()->showMessage("Qt::WindowSystemMenuHint");
    w6.show();

    // The minimize button is not available
    QtWindowFlagsTest w7;
    w7.setGeometry(1300, 30, 200, 200);
    w7.setWindowFlags(Qt::WindowMaximizeButtonHint);
    w7.statusBar()->showMessage("Qt::WindowMaximizeButtonHint");
    w7.show();

    // The restore button is not available
    QtWindowFlagsTest w8;
    w8.setGeometry(1515, 30, 200, 200);
    w8.setWindowFlags(Qt::WindowMinimizeButtonHint);
    w8.statusBar()->showMessage("Qt::WindowMinimizeButtonHint");
    w8.show();

    // The window has no buttons but a title bar You can't see anything in the mission
    QtWindowFlagsTest w9;
    w9.setGeometry(2, 238, 200, 200);
    w9.setWindowFlags(Qt::SubWindow);
    w9.statusBar()->showMessage("Qt::SubWindow");
    w9.show();

    // It's not on the desktop, it's not on the task . But there's more in the mission tube
    QtWindowFlagsTest w10;
    w10.setGeometry(217, 238, 200, 200);
    w10.setWindowFlags(Qt::Desktop);
    w10.statusBar()->showMessage("Qt::Desktop");
    w10.show();

    // There is no title bar There are no buttons If you show up there, you can't get there , It can't be moved or dragged , Right click on the taskbar and nothing , There is no taskbar window name , But it can be turned off from the task manager
    QtWindowFlagsTest w11;
    w11.setGeometry(432, 238, 200, 200);
    w11.setWindowFlags(Qt::SplashScreen);
    w11.statusBar()->showMessage("Qt::SplashScreen");
    w11.show();

    // There is no title bar There are no buttons If you show up there, you can't get there , It can't be moved or dragged , Right click on the taskbar and nothing , There is no taskbar window name , But it can be turned off from the task manager
top window Always on top
    QtWindowFlagsTest w12;
    w12.setGeometry(647, 238, 200, 200);
    w12.setWindowFlags(Qt::ToolTip);
    w12.statusBar()->showMessage("Qt::ToolTip");
    w12.show();

    // There's a little close button , But it doesn't really close
    QtWindowFlagsTest w13;
    w13.setGeometry(862, 238, 200, 200);
    w13.setWindowFlags(Qt::Tool);
    w13.statusBar()->showMessage("Qt::Tool");
    w13.show();
    return a.exec();

}

Run as follows :

Technology
©2019-2020 Toolsou All rights reserved,
The 11th Blue Bridge Cup python The real topic of the University Group National Games JavaSwing To achieve a simple Lianliankan games 【Spring Source code analysis 】42-@Conditional Detailed explanation element-ui Step on pit record 2019PHP Interview questions ( Continuously updated )PHPJava Misunderstanding —— Method overloading is a manifestation of polymorphism ? First issue 500 100 million , Set up a new Department , What is Tencent going to do ? Google chrome The browser can't open the web page , But what if other browsers can open it ? Regression of dependent variable order categories (R language )【Golang Basic series 10 】Go language On conditional sentences if