QT: Hide the title bar of a dialog/window

随声附和 提交于 2019-12-07 08:23:40

问题


I have a parent window in which a push-button's click event function has the following lines:

SplashScreenDialog *splScrDlg = new SplashScreenDialog(this); splScrDlg->show();

What I want is I want to remove the maximize button, minimize button, close button and also the title bar from the dialog(or window). [Actually it is for a splash screen, it would contain an image for a while and then would exit automatically and opens the main window, you are welcome with other ideas for showing splash screen]


回答1:


Why not using QSplashScreen?

Example extracted from the assistant:

 int main(int argc, char *argv[])
 {
     QApplication app(argc, argv);
     QPixmap pixmap(":/splash.png");
     QSplashScreen splash(pixmap);
     splash.show();
     app.processEvents();
     ...
     QMainWindow window;
     window.show();
     splash.finish(&window);
     return app.exec();
 }



回答2:


Why not use QSplashScreen for this? Anyway, you can set window flags to remove the window decoration. See the documentation for QWidget::setWindowFlags and Qt::WindowFlags.



来源:https://stackoverflow.com/questions/1524474/qt-hide-the-title-bar-of-a-dialog-window

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!