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,
In the problem of target detection “ recall Recall”,“ Accuracy Precision”Linux Page replacement algorithm C Language implementation About wechat payment body( Product description ) Problems encountered stay Vue Use in Web Worker Calculate the working days of each month c++ Memory Pointer out of bounds detection mechanism _CrtMemBlockHeadeJavaScript Medium Call and Apply Remember once EventBus Project issues caused by memory leaks Hundreds of millions of locusts rarely collide Locusts want to be self driving Heroes Java Swing JList: List box components