Ai
1 Star 0 Fork 0

Pengwei/QMavPlotter

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
main.cpp 1.68 KB
一键复制 编辑 原始数据 按行查看 历史
#include "mainwindow.h"
#include <QApplication>
#include <QSplashScreen>
#include <QTextCodec>
#include <QFile>
#include <QDebug>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
// a.setFont(QFont("Microsoft Yahei", 11));
QSplashScreen *splash = new QSplashScreen;
splash->setPixmap(QPixmap(":/res/fonts/start.png"));
splash->show();
// Start photo
Qt::Alignment pos = Qt::AlignRight| Qt::AlignBottom;
splash->showMessage(QObject::tr("Loading Settings......."),pos,Qt::white);
// Set start time
for(int i=0;i<5000;i++){
splash->repaint();
}
// Load Settings
QString iniName = QCoreApplication::applicationDirPath() + "/Settings.ini";
QSettings *iniSetting = new QSettings(iniName,QSettings::IniFormat);
QString color = iniSetting->value("/THEME/color").toString();
QString fontsize = iniSetting->value("/THEME/fontsize").toString();
delete iniSetting;
// Theme style
QString style;
if("Light" == color){
style = ":/res/light/style.qss";
}else{
style = ":/res/dark/style.qss";
}
QFile file(style);
if(file.open(QIODevice::ReadOnly | QIODevice::Text)) {
QString qss = QLatin1String(file.readAll());
qApp->setStyleSheet(qss);
file.close();
}else{
qDebug() << "Failed to load: " << file.fileName();
}
// Set App's icon and name
MainWindow w;
QIcon appIcon(":/res/fonts/barchart.png"); // Get the icon for the right corner
w.setWindowIcon(appIcon);
w.setWindowTitle("QMavPlotter (QMP)");
w.show();
// Close the start picture
splash->finish(&w);
delete splash;
return a.exec();
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/alvin1991/QMavPlotter.git
git@gitee.com:alvin1991/QMavPlotter.git
alvin1991
QMavPlotter
QMavPlotter
master

搜索帮助