qt中如何去掉主窗口标题栏
1个回答
展开全部
有这样一个程序:#include #include #include #include #include "widget.h"int main(int argc, char *argv[]){QTextCodec::setCodecForTr(QTextCodec::codecForName("GB2312"));QApplication a(argc, argv);QDialog dialog;dialog.setStyleSheet(QString::fromUtf8("background-image: url(:/images/1.PNG);/n""color: rgb(0, 255, 0);/n""font: 75 16pt /"/345/256/213/344/275/223/";"));dialog.setGeometry(QRect(50, 50, 350, 250)); //可设置窗口显示的方位与大小dialog.setWindowFlags(Qt::FramelessWindowHint); //也是去掉标题栏的语句Widget w;QTimer timer;QObject::connect(&timer, SIGNAL(timeout()), &w, SLOT(showNormal()));QObject::connect(&timer, SIGNAL(timeout()), &dialog, SLOT(accept()));timer.start(5000);dialog.exec();w.showNormal(); // 1、可更改的地方。return a.exec();} Widget::Widget(QWidget *parent) : QWidget(parent){QMessageBox::StandardButton message;QApplication::setStyle(QStyleFactory::create("plastique"));QApplication::setPalette(QApplication::style()->standardPalette());ui.setupUi(this);connect(ui.pushButton, SIGNAL(clicked()), this, SLOT(mountMessage()));connect(ui.pushButton_2, SIGNAL(clicked()), this, SLOT(umountMessage()));connect(ui.pushButton_3, SIGNAL(clicked()), this, SLOT(saveMessage()));connect(ui.pushButton_5, SIGNAL(clicked()), this, SLOT(adjustMessage()));connect(ui.pushButton_7, SIGNAL(clicked()), this, SLOT(about_usMessage()));connect(ui.pushButton_4, SIGNAL(clicked()), this, SLOT(stop_saveMessage()));connect(ui.pushButton_6, SIGNAL(clicked()), this, SLOT(touchMessage()));connect(ui.pushButton_8, SIGNAL(clicked()), this, SLOT(exitMessage())); mount_u(); //挂载U盘成功!if( !have_video() ) { //if have WebCam?message = QMessageBox::information(this, tr("摄像头未连接"),tr("摄像头未连接,请连接摄像头。") );}setWindowFlags(Qt::FramelessWindowHint); /2、可更改的地方setWindowTitle(tr("欢迎使用迷你监控器!"));} 程序中更改两处显示主窗口的样式。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询