开发者

Design a window without a caption bar - QT Designer

开发者 https://www.devze.com 2023-02-06 22:51 出处:网络
How can I declare a window without caption w开发者_如何学JAVAhen I use QT Designer?if you\'re looking to remove window title, then the easiest way would be to set the window flags in your widget\'s co

How can I declare a window without caption w开发者_如何学JAVAhen I use QT Designer?


if you're looking to remove window title, then the easiest way would be to set the window flags in your widget's constructor, smth like this:

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent, Qt::FramelessWindowHint),  //<-- this will remove the title bar
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
... 

or call

Qt::WindowFlags flags = Qt::CustomizeWindowHint;
setWindowFlags(flags);

more details on window types here: enum Qt::WindowType flags Qt::WindowFlags

hope this helps, regards


you didn't say which language you mean, so I say how to do it in Python with Qt : First of all, you can't-do it in Qt Designer application!

After you designed your GUI via Qt designer app, then you should add this line of python code to your FILE.py (generated with pyuic5) :

MainWindow.setWindowFlags(QtCore.Qt.CustomizeWindowHint)

0

精彩评论

暂无评论...
验证码 换一张
取 消