-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathmain.cpp
More file actions
32 lines (25 loc) · 780 Bytes
/
main.cpp
File metadata and controls
32 lines (25 loc) · 780 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <QtWidgets>
#include "frmmain.h"
#include <QTextCodec>
//#include <QDesktopWidget>
//#include <QStyleFactory>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
//支持中文编码
//窗体居中显示
QDesktopWidget *desktop=QApplication::desktop();
int width=desktop->width();
int height=desktop->height();
frmMain w;
//设置窗口没有最大化按钮
// w.setWindowFlags(Qt::WindowMinimizeButtonHint);//设置窗口的标题栏只有最小化的按钮
w.move((width-w.width())/2,(height-w.height())/2);
//设置窗口大小
w.setFixedSize(w.width(),w.height());
w.show();
//应用样式
QApplication::setStyle(QStyleFactory::create("GTK"));
QApplication::setPalette(QApplication::style()->standardPalette());
return a.exec();
}