2019-09-29 12:43:40 +00:00
|
|
|
|
#include "frmmain.h"
|
2020-03-16 08:40:48 +00:00
|
|
|
|
#include <QApplication>
|
|
|
|
|
#include <QTextCodec>
|
|
|
|
|
#include <QDesktopWidget>
|
2019-09-29 12:43:40 +00:00
|
|
|
|
|
|
|
|
|
int main(int argc, char *argv[])
|
|
|
|
|
{
|
|
|
|
|
QApplication a(argc, argv);
|
|
|
|
|
a.setFont(QFont("Microsoft Yahei", 9));
|
|
|
|
|
|
2020-03-16 08:40:48 +00:00
|
|
|
|
#if (QT_VERSION <= QT_VERSION_CHECK(5,0,0))
|
|
|
|
|
#if _MSC_VER
|
|
|
|
|
QTextCodec *codec = QTextCodec::codecForName("gbk");
|
|
|
|
|
#else
|
|
|
|
|
QTextCodec *codec = QTextCodec::codecForName("utf-8");
|
|
|
|
|
#endif
|
|
|
|
|
QTextCodec::setCodecForLocale(codec);
|
|
|
|
|
QTextCodec::setCodecForCStrings(codec);
|
|
|
|
|
QTextCodec::setCodecForTr(codec);
|
|
|
|
|
#else
|
|
|
|
|
QTextCodec *codec = QTextCodec::codecForName("utf-8");
|
|
|
|
|
QTextCodec::setCodecForLocale(codec);
|
|
|
|
|
#endif
|
|
|
|
|
|
2019-09-29 12:43:40 +00:00
|
|
|
|
frmMain w;
|
2021-03-03 08:37:44 +00:00
|
|
|
|
w.setWindowTitle("styledemo Author: feiyangqingyun@163.com QQ: 517216493");
|
2019-09-29 12:43:40 +00:00
|
|
|
|
w.show();
|
|
|
|
|
|
2020-03-16 08:40:48 +00:00
|
|
|
|
//居中显示窗体
|
|
|
|
|
QDesktopWidget deskWidget;
|
|
|
|
|
int deskWidth = deskWidget.availableGeometry().width();
|
|
|
|
|
int deskHeight = deskWidget.availableGeometry().height();
|
|
|
|
|
QPoint movePoint(deskWidth / 2 - w.width() / 2, deskHeight / 2 - w.height() / 2);
|
|
|
|
|
w.move(movePoint);
|
|
|
|
|
|
2019-09-29 12:43:40 +00:00
|
|
|
|
return a.exec();
|
|
|
|
|
}
|