如何隐藏QDialog窗口的标题栏? [英] How to hide titlebar of the QDialog window?
本文介绍了如何隐藏QDialog窗口的标题栏?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在qt应用程序中的菜单操作单击窗口上显示一个对话框,该对话框显示得很完美,但是我想隐藏其标题栏,因为它只是主窗口内的一个子窗口。
I show a dialog in my qt application on menu action click window is appearing perfectly but I want to hide its title bar as it is just a sub-window inside main window.
我尝试过:
this->setWindowFlags(Qt::Window |Qt::FramelessWindowHint);
在对话框构造函数中:
ui->setupUi(this);
this->setWindowState (Qt::WindowActive);
setWindowModality(Qt::ApplicationModal);
setAttribute (Qt::WA_DeleteOnClose);
this->setWindowFlags(Qt::Window |Qt::FramelessWindowHint) ; //
这确实删除了标题栏,但同时也隐藏了主窗口,这对我来说是不利的
This does remove the title bar but it also hides the main window, which is bad for my application.
如何隐藏对话框标题栏而不打扰应用程序的基本主窗口?
How can I hide dialog title bar without disturbing the base main window of the application?
推荐答案
QDialog *dialog(new QDialog /* this should be your dialog class youve created obviously*/));
dialog->setWindowFlags(Qt::FramelessWindowHint | Qt::Dialog);
dialog->show();
这篇关于如何隐藏QDialog窗口的标题栏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文