更新代码

master
feiyangqingyun 2024-03-08 10:41:45 +08:00
parent a834f26a5c
commit fa1ee7d535
37 changed files with 747 additions and 284 deletions

View File

@ -1,5 +1,5 @@
#include "appdata.h" #include "appdata.h"
#include "quihelper.h" #include "qthelper.h"
QString AppData::TitleFlag = "(QQ: 517216493 WX: feiyangqingyun)"; QString AppData::TitleFlag = "(QQ: 517216493 WX: feiyangqingyun)";
int AppData::RowHeight = 25; int AppData::RowHeight = 25;
@ -10,7 +10,7 @@ int AppData::FormHeight = 750;
void AppData::checkRatio() void AppData::checkRatio()
{ {
//根据分辨率设定宽高 //根据分辨率设定宽高
int width = QUIHelper::deskWidth(); int width = QtHelper::deskWidth();
if (width >= 1440) { if (width >= 1440) {
RowHeight = RowHeight < 25 ? 25 : RowHeight; RowHeight = RowHeight < 25 ? 25 : RowHeight;
RightWidth = RightWidth < 220 ? 220 : RightWidth; RightWidth = RightWidth < 220 ? 220 : RightWidth;

View File

@ -33,17 +33,27 @@ bool AppInit::eventFilter(QObject *watched, QEvent *event)
static QPoint mousePoint; static QPoint mousePoint;
static bool mousePressed = false; static bool mousePressed = false;
QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event); int type = event->type();
if (mouseEvent->type() == QEvent::MouseButtonPress) { QPoint p;
QMouseEvent *mouseEvent = (QMouseEvent *)(event);
if (mouseEvent) {
#if (QT_VERSION < QT_VERSION_CHECK(6,0,0))
p = mouseEvent->globalPos();
#else
p = mouseEvent->globalPosition().toPoint();
#endif
}
if (type == QEvent::MouseButtonPress) {
if (mouseEvent->button() == Qt::LeftButton) { if (mouseEvent->button() == Qt::LeftButton) {
mousePressed = true; mousePressed = true;
mousePoint = mouseEvent->globalPos() - w->pos(); mousePoint = p - w->pos();
} }
} else if (mouseEvent->type() == QEvent::MouseButtonRelease) { } else if (type == QEvent::MouseButtonRelease) {
mousePressed = false; mousePressed = false;
} else if (mouseEvent->type() == QEvent::MouseMove) { } else if (type == QEvent::MouseMove) {
if (mousePressed) { if (mousePressed) {
w->move(mouseEvent->globalPos() - mousePoint); w->move(p - mousePoint);
return true; return true;
} }
} }

View File

@ -1,9 +1,9 @@
QT += network QT *= network
greaterThan(QT_MAJOR_VERSION, 4) { greaterThan(QT_MAJOR_VERSION, 4) {
lessThan(QT_MAJOR_VERSION, 6) { lessThan(QT_MAJOR_VERSION, 6) {
android {QT += androidextras} android {QT *= androidextras}
} else { } else {
QT += core-private QT *= core-private
}} }}
#指定编译产生的文件分门别类放到对应目录 #指定编译产生的文件分门别类放到对应目录
@ -13,13 +13,15 @@ UI_DIR = temp/ui
OBJECTS_DIR = temp/obj OBJECTS_DIR = temp/obj
#指定编译生成的可执行文件放到源码上一级目录下的bin目录 #指定编译生成的可执行文件放到源码上一级目录下的bin目录
!android { !android:!ios {
!wasm {
DESTDIR = $$PWD/../bin DESTDIR = $$PWD/../bin
}} }
#把所有警告都关掉眼不见为净 #把所有警告都关掉眼不见为净
CONFIG += warn_off CONFIG += warn_off
#QMAKE_CXXFLAGS_WARN_ON -= -w34100
#QMAKE_CXXFLAGS *= -Wno-unused-parameter
#开启大资源支持 #开启大资源支持
CONFIG += resources_big CONFIG += resources_big
#开启后会将打印信息用控制台输出 #开启后会将打印信息用控制台输出
@ -27,7 +29,7 @@ CONFIG += resources_big
#开启后不会生成空的 debug release 目录 #开启后不会生成空的 debug release 目录
#CONFIG -= debug_and_release #CONFIG -= debug_and_release
#引入全志H3芯片依赖 #引入全志H3芯片依赖(不需要的用户可以删除)
include ($$PWD/h3.pri) include ($$PWD/h3.pri)
#将当前目录加入到头文件路径 #将当前目录加入到头文件路径
INCLUDEPATH += $$PWD INCLUDEPATH += $$PWD
@ -47,8 +49,8 @@ SOURCES += $$PWD/customstyle.cpp
HEADERS += $$PWD/iconhelper.h HEADERS += $$PWD/iconhelper.h
SOURCES += $$PWD/iconhelper.cpp SOURCES += $$PWD/iconhelper.cpp
HEADERS += $$PWD/quihelper.h HEADERS += $$PWD/qthelper.h
SOURCES += $$PWD/quihelper.cpp SOURCES += $$PWD/qthelper.cpp
#可以指定不加载对应的资源文件 #可以指定不加载对应的资源文件
!contains(DEFINES, no_qrc_image) { !contains(DEFINES, no_qrc_image) {
@ -62,3 +64,9 @@ RESOURCES += $$PWD/qrc/qm.qrc
!contains(DEFINES, no_qrc_font) { !contains(DEFINES, no_qrc_font) {
RESOURCES += $$PWD/qrc/font.qrc RESOURCES += $$PWD/qrc/font.qrc
} }
wasm {
HEADERS += $$PWD/wasmhelper.h
SOURCES += $$PWD/wasmhelper.cpp
RESOURCES += $$PWD/qrc/wasm.qrc
}

Binary file not shown.

View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@ -0,0 +1,5 @@
<RCC>
<qresource prefix="/">
<file>font/DroidSansFallback.ttf</file>
</qresource>
</RCC>

File diff suppressed because it is too large Load Diff

View File

@ -1,15 +1,17 @@
#ifndef QUIHELPER2_H #ifndef QTHELPER_H
#define QUIHELPER2_H #define QTHELPER_H
#include "head.h" #include "head.h"
class QUIHelper class QtHelper
{ {
public: public:
//获取当前鼠标所在屏幕索引/区域尺寸/缩放系数 //获取所有屏幕区域/当前鼠标所在屏幕索引/区域尺寸/缩放系数
static QList<QRect> getScreenRects(bool available = true);
static int getScreenIndex(); static int getScreenIndex();
static QRect getScreenRect(bool available = true); static QRect getScreenRect(bool available = true);
static qreal getScreenRatio(bool devicePixel = false); static qreal getScreenRatio(int index = -1, bool devicePixel = false);
//矫正当前鼠标所在屏幕居中尺寸 //矫正当前鼠标所在屏幕居中尺寸
static QRect checkCenterRect(QRect &rect, bool available = true); static QRect checkCenterRect(QRect &rect, bool available = true);
@ -24,12 +26,20 @@ public:
static void setFormInCenter(QWidget *form); static void setFormInCenter(QWidget *form);
static void showForm(QWidget *form); static void showForm(QWidget *form);
//程序文件名称+当前所在路径 //程序文件名称当前所在路径
static QString appName(); static QString appName();
static QString appPath(); static QString appPath();
//程序最前面获取应用程序路径和名称
static void getCurrentInfo(char *argv[], QString &path, QString &name);
//程序最前面读取配置文件节点的值
static QString getIniValue(const QString &fileName, const QString &key);
static QString getIniValue(char *argv[], const QString &key, const QString &dir = QString(), const QString &file = QString());
//获取本地网卡IP集合 //获取本地网卡IP集合
static QStringList getLocalIPs(); static QStringList getLocalIPs();
//添加网卡集合并根据默认值设置当前项
static void initLocalIPs(QComboBox *cbox, const QString &defaultIP, bool local127 = true);
//获取内置颜色集合 //获取内置颜色集合
static QList<QColor> colors; static QList<QColor> colors;
@ -53,8 +63,10 @@ public:
static QString getUuid(); static QString getUuid();
//校验目录 //校验目录
static void checkPath(const QString &dirName); static void checkPath(const QString &dirName);
//延时 //通用延时函数(支持Qt4 Qt5 Qt6)
static void sleep(int msec); static void sleep(int msec, bool exec = true);
//检查程序是否已经运行
static void checkRun();
//设置Qt自带样式 //设置Qt自带样式
static void setStyle(); static void setStyle();
@ -74,9 +86,24 @@ public:
//一次性设置所有包括编码样式字体等 //一次性设置所有包括编码样式字体等
static void initAll(bool utf8 = true, bool style = true, int fontSize = 13); static void initAll(bool utf8 = true, bool style = true, int fontSize = 13);
//初始化main函数最前面执行的一段代码 //初始化main函数最前面执行的一段代码
static void initMain(bool desktopSettingsAware = true, bool useOpenGLES = false); static void initMain(bool desktopSettingsAware = false, bool use96Dpi = true, bool logCritical = true);
//初始化opengl类型(1=AA_UseDesktopOpenGL 2=AA_UseOpenGLES 3=AA_UseSoftwareOpenGL)
static void initOpenGL(quint8 type = 0, bool checkCardEnable = false, bool checkVirtualSystem = false);
//读取qss文件获取样式表内容
static QString getStyle(const QString &qssFile);
//设置qss文件到全局样式
static void setStyle(const QString &qssFile);
//执行命令行返回执行结果
static QString doCmd(const QString &program, const QStringList &arguments, int timeout = 1000);
//获取显卡是否被禁用
static bool isVideoCardEnable();
//获取是否在虚拟机环境
static bool isVirtualSystem();
//插入消息 //插入消息
static bool replaceCRLF;
static QVector<int> msgTypes; static QVector<int> msgTypes;
static QVector<QString> msgKeys; static QVector<QString> msgKeys;
static QVector<QColor> msgColors; static QVector<QColor> msgColors;
@ -147,6 +174,15 @@ public:
static QString getTimeString(QElapsedTimer timer); static QString getTimeString(QElapsedTimer timer);
//文件大小转 KB MB GB TB //文件大小转 KB MB GB TB
static QString getSizeString(quint64 size); static QString getSizeString(quint64 size);
//设置系统时间
static void setSystemDateTime(const QString &year, const QString &month, const QString &day,
const QString &hour, const QString &min, const QString &sec);
//设置开机自启动
static void runWithSystem(bool autoRun = true);
static void runWithSystem(const QString &fileName, const QString &filePath, bool autoRun = true);
//启动运行程序(已经在运行则不启动)
static void runBin(const QString &path, const QString &name);
}; };
#endif // QUIHELPER2_H #endif // QTHELPER_H

View File

@ -0,0 +1,107 @@
#include "wasmhelper.h"
#include "qrect.h"
#include "emscripten.h"
#include "emscripten/html5.h"
//弹出js信息框
EM_JS(void, showMessageJs, (const char *text), {
alert(UTF8ToString(text));
})
//弹出js输入框
EM_JS(const char *, getInputJs, (const char *title, const char *defaultText), {
var result = prompt(UTF8ToString(title), UTF8ToString(defaultText));
if (!result)
{
result = "";
}
return stringToNewUTF8(result);
})
//打开iframe窗体
EM_JS(void, openIframeJs, (const char *flag, const char *url, const char *style), {
//如果存在则只移动位置
var id = UTF8ToString(flag);
var iframe = document.getElementById(id);
if (iframe)
{
iframe.style = UTF8ToString(style);
return;
}
iframe = document.createElement('iframe');
iframe.id = id;
iframe.src = UTF8ToString(url);
iframe.style = UTF8ToString(style);
iframe.scrolling = 'no';
document.body.appendChild(iframe);
})
//加载iframe窗体
EM_JS(void, reloadIframeJs, (const char *flag, const char *url), {
var iframe = document.getElementById(UTF8ToString(flag));
if (iframe)
{
iframe.src = UTF8ToString(url);
}
})
//移动iframe窗体
EM_JS(void, moveIframeJs, (const char *flag, const char *style), {
var iframe = document.getElementById(UTF8ToString(flag));
if (iframe)
{
iframe.style = UTF8ToString(style);
}
})
//隐藏iframe窗体
EM_JS(void, hideIframeJs, (const char *flag), {
var iframe = document.getElementById(UTF8ToString(flag));
if (iframe)
{
iframe.style = "display:none";
}
})
void WasmHelper::showMessage(const QString &text)
{
showMessageJs(text.toUtf8().constData());
}
QString WasmHelper::getInput(const QString &title, const QString &text)
{
return getInputJs(title.toUtf8().constData(), text.toUtf8().constData());
}
QString WasmHelper::getIframeStyle(const QRect &rect)
{
QString style = QString("border:0px;position:absolute;margin:0px;padding:0px;z-index:10000;opacity:1.0;");
style += QString("left:%1px;").arg(rect.x());
style += QString("top:%1px;").arg(rect.y());
style += QString("width:%1px;").arg(rect.width());
style += QString("height:%1px;").arg(rect.height());
return style;
}
void WasmHelper::openIframe(const QString &flag, const QString &url, const QRect &rect)
{
QString style = getIframeStyle(rect);
openIframeJs(flag.toUtf8().constData(), url.toUtf8().constData(), style.toUtf8().constData());
}
void WasmHelper::reloadIframe(const QString &flag, const QString &url)
{
reloadIframeJs(flag.toUtf8().constData(), url.toUtf8().constData());
}
void WasmHelper::moveIframe(const QString &flag, const QRect &rect)
{
QString style = getIframeStyle(rect);
moveIframeJs(flag.toUtf8().constData(), style.toUtf8().constData());
}
void WasmHelper::hideIframe(const QString &flag)
{
hideIframeJs(flag.toUtf8().constData());
}

View File

@ -0,0 +1,26 @@
#ifndef WASMHELPER_H
#define WASMHELPER_H
#include <QObject>
class WasmHelper
{
public:
//弹出js信息框
static void showMessage(const QString &text);
//弹出js输入框
static QString getInput(const QString &title, const QString &text);
//获取iframe样式
static QString getIframeStyle(const QRect &rect);
//打开iframe窗体
static void openIframe(const QString &flag, const QString &url, const QRect &rect);
//重新加载iframe窗体
static void reloadIframe(const QString &flag, const QString &url);
//移动iframe窗体
static void moveIframe(const QString &flag, const QRect &rect);
//隐藏iframe窗体
static void hideIframe(const QString &flag);
};
#endif // WASMHELPER_H

View File

@ -1,7 +1,7 @@
#include "frmmain.h" #include "frmmain.h"
#include "ui_frmmain.h" #include "ui_frmmain.h"
#include "iconhelper.h" #include "iconhelper.h"
#include "quihelper.h" #include "qthelper.h"
frmMain::frmMain(QWidget *parent) : QDialog(parent), ui(new Ui::frmMain) frmMain::frmMain(QWidget *parent) : QDialog(parent), ui(new Ui::frmMain)
{ {
@ -29,7 +29,7 @@ bool frmMain::eventFilter(QObject *watched, QEvent *event)
void frmMain::initForm() void frmMain::initForm()
{ {
//设置无边框 //设置无边框
QUIHelper::setFramelessForm(this); QtHelper::setFramelessForm(this);
//设置图标 //设置图标
IconHelper::setIcon(ui->labIco, 0xf099, 35); IconHelper::setIcon(ui->labIco, 0xf099, 35);
IconHelper::setIcon(ui->btnMenu_Min, 0xf068); IconHelper::setIcon(ui->btnMenu_Min, 0xf068);
@ -125,7 +125,7 @@ void frmMain::on_btnMenu_Max_clicked()
this->setGeometry(location); this->setGeometry(location);
} else { } else {
location = this->geometry(); location = this->geometry();
this->setGeometry(QUIHelper::getScreenRect()); this->setGeometry(QtHelper::getScreenRect());
} }
this->setProperty("canMove", max); this->setProperty("canMove", max);

View File

@ -1,29 +1,21 @@
#include "frmmain.h" #include "frmmain.h"
#include "appinit.h" #include "appinit.h"
#include "quihelper.h" #include "qthelper.h"
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
QUIHelper::initMain(); QtHelper::initMain();
QApplication a(argc, argv); QApplication a(argc, argv);
AppInit::Instance()->start(); AppInit::Instance()->start();
QUIHelper::setFont(); QtHelper::setFont();
QUIHelper::setCode(); QtHelper::setCode();
//加载样式表 //加载样式表
QFile file(":/qss/blacksoft.css"); QtHelper::setStyle(":/qss/blacksoft.css");
if (file.open(QFile::ReadOnly)) {
QString qss = QLatin1String(file.readAll());
QString paletteColor = qss.mid(20, 7);
qApp->setPalette(QPalette(QColor(paletteColor)));
qApp->setStyleSheet(qss);
file.close();
}
frmMain w; frmMain w;
w.resize(800, 600); w.resize(800, 600);
QUIHelper::setFormInCenter(&w); QtHelper::setFormInCenter(&w);
w.show(); w.show();
return a.exec(); return a.exec();

View File

@ -13,6 +13,4 @@ RESOURCES += $$PWD/../core_qss/qss.qrc
INCLUDEPATH += $$PWD INCLUDEPATH += $$PWD
INCLUDEPATH += $$PWD/form INCLUDEPATH += $$PWD/form
include ($$PWD/form/form.pri) include ($$PWD/form/form.pri)
include ($$PWD/../core_helper/core_helper.pri)
INCLUDEPATH += $$PWD/../core_base
include ($$PWD/../core_base/core_base.pri)

View File

@ -3,7 +3,7 @@
#include "frmmain.h" #include "frmmain.h"
#include "ui_frmmain.h" #include "ui_frmmain.h"
#include "iconhelper.h" #include "iconhelper.h"
#include "quihelper.h" #include "qthelper.h"
frmMain::frmMain(QWidget *parent) : QWidget(parent), ui(new Ui::frmMain) frmMain::frmMain(QWidget *parent) : QWidget(parent), ui(new Ui::frmMain)
{ {
@ -55,7 +55,7 @@ void frmMain::getQssColor(const QString &qss, QString &textColor, QString &panel
void frmMain::initForm() void frmMain::initForm()
{ {
//设置无边框 //设置无边框
QUIHelper::setFramelessForm(this); QtHelper::setFramelessForm(this);
//设置图标 //设置图标
IconHelper::setIcon(ui->labIco, 0xf073, 30); IconHelper::setIcon(ui->labIco, 0xf073, 30);
IconHelper::setIcon(ui->btnMenu_Min, 0xf068); IconHelper::setIcon(ui->btnMenu_Min, 0xf068);
@ -99,14 +99,11 @@ void frmMain::initForm()
void frmMain::initStyle() void frmMain::initStyle()
{ {
//加载样式表 //加载样式表
QString qss; QString qss = QtHelper::getStyle(":/qss/blacksoft.css");
QFile file(":/qss/blacksoft.css"); if (!qss.isEmpty()) {
if (file.open(QFile::ReadOnly)) {
qss = QLatin1String(file.readAll());
QString paletteColor = qss.mid(20, 7); QString paletteColor = qss.mid(20, 7);
qApp->setPalette(QPalette(paletteColor)); qApp->setPalette(QPalette(QColor(paletteColor)));
qApp->setStyleSheet(qss); qApp->setStyleSheet(qss);
file.close();
} }
//先从样式表中取出对应的颜色 //先从样式表中取出对应的颜色
@ -149,8 +146,7 @@ void frmMain::initLeftMain()
iconsMain << 0xf030 << 0xf03e << 0xf247; iconsMain << 0xf030 << 0xf03e << 0xf247;
btnsMain << ui->tbtnMain1 << ui->tbtnMain2 << ui->tbtnMain3; btnsMain << ui->tbtnMain1 << ui->tbtnMain2 << ui->tbtnMain3;
int count = btnsMain.count(); for (int i = 0; i < btnsMain.count(); ++i) {
for (int i = 0; i < count; ++i) {
QToolButton *btn = (QToolButton *)btnsMain.at(i); QToolButton *btn = (QToolButton *)btnsMain.at(i);
btn->setCheckable(true); btn->setCheckable(true);
btn->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); btn->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
@ -174,8 +170,7 @@ void frmMain::initLeftConfig()
iconsConfig << 0xf031 << 0xf036 << 0xf249 << 0xf055 << 0xf05a << 0xf249; iconsConfig << 0xf031 << 0xf036 << 0xf249 << 0xf055 << 0xf05a << 0xf249;
btnsConfig << ui->tbtnConfig1 << ui->tbtnConfig2 << ui->tbtnConfig3 << ui->tbtnConfig4 << ui->tbtnConfig5 << ui->tbtnConfig6; btnsConfig << ui->tbtnConfig1 << ui->tbtnConfig2 << ui->tbtnConfig3 << ui->tbtnConfig4 << ui->tbtnConfig5 << ui->tbtnConfig6;
int count = btnsConfig.count(); for (int i = 0; i < btnsConfig.count(); ++i) {
for (int i = 0; i < count; ++i) {
QToolButton *btn = (QToolButton *)btnsConfig.at(i); QToolButton *btn = (QToolButton *)btnsConfig.at(i);
btn->setCheckable(true); btn->setCheckable(true);
btn->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); btn->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
@ -198,9 +193,7 @@ void frmMain::leftMainClick()
{ {
QAbstractButton *b = (QAbstractButton *)sender(); QAbstractButton *b = (QAbstractButton *)sender();
QString name = b->text(); QString name = b->text();
for (int i = 0; i < btnsMain.count(); ++i) {
int count = btnsMain.count();
for (int i = 0; i < count; ++i) {
QAbstractButton *btn = btnsMain.at(i); QAbstractButton *btn = btnsMain.at(i);
btn->setChecked(btn == b); btn->setChecked(btn == b);
} }
@ -212,9 +205,7 @@ void frmMain::leftConfigClick()
{ {
QToolButton *b = (QToolButton *)sender(); QToolButton *b = (QToolButton *)sender();
QString name = b->text(); QString name = b->text();
for (int i = 0; i < btnsConfig.count(); ++i) {
int count = btnsConfig.count();
for (int i = 0; i < count; ++i) {
QAbstractButton *btn = btnsConfig.at(i); QAbstractButton *btn = btnsConfig.at(i);
btn->setChecked(btn == b); btn->setChecked(btn == b);
} }
@ -236,7 +227,7 @@ void frmMain::on_btnMenu_Max_clicked()
this->setGeometry(location); this->setGeometry(location);
} else { } else {
location = this->geometry(); location = this->geometry();
this->setGeometry(QUIHelper::getScreenRect()); this->setGeometry(QtHelper::getScreenRect());
} }
this->setProperty("canMove", max); this->setProperty("canMove", max);

View File

@ -1,18 +1,18 @@
#include "frmmain.h" #include "frmmain.h"
#include "appinit.h" #include "appinit.h"
#include "quihelper.h" #include "qthelper.h"
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
QUIHelper::initMain(); QtHelper::initMain();
QApplication a(argc, argv); QApplication a(argc, argv);
AppInit::Instance()->start(); AppInit::Instance()->start();
QUIHelper::setFont(); QtHelper::setFont();
QUIHelper::setCode(); QtHelper::setCode();
frmMain w; frmMain w;
QUIHelper::setFormInCenter(&w); QtHelper::setFormInCenter(&w);
w.show(); w.show();
return a.exec(); return a.exec();

View File

@ -13,6 +13,4 @@ RESOURCES += $$PWD/../core_qss/qss.qrc
INCLUDEPATH += $$PWD INCLUDEPATH += $$PWD
INCLUDEPATH += $$PWD/form INCLUDEPATH += $$PWD/form
include ($$PWD/form/form.pri) include ($$PWD/form/form.pri)
include ($$PWD/../core_helper/core_helper.pri)
INCLUDEPATH += $$PWD/../core_base
include ($$PWD/../core_base/core_base.pri)

View File

@ -1,28 +1,20 @@
#include "frmmain.h" #include "frmmain.h"
#include "appinit.h" #include "appinit.h"
#include "quihelper.h" #include "qthelper.h"
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
QUIHelper::initMain(); QtHelper::initMain();
QApplication a(argc, argv); QApplication a(argc, argv);
AppInit::Instance()->start(); AppInit::Instance()->start();
QUIHelper::setFont(); QtHelper::setFont();
QUIHelper::setCode(); QtHelper::setCode();
//加载样式表 //加载样式表
QFile file(":/qss/blacksoft.css"); QtHelper::setStyle(":/qss/blacksoft.css");
if (file.open(QFile::ReadOnly)) {
QString qss = QLatin1String(file.readAll());
QString paletteColor = qss.mid(20, 7);
qApp->setPalette(QPalette(paletteColor));
qApp->setStyleSheet(qss);
file.close();
}
frmMain w; frmMain w;
QUIHelper::setFormInCenter(&w); QtHelper::setFormInCenter(&w);
w.show(); w.show();
return a.exec(); return a.exec();

View File

@ -13,6 +13,4 @@ RESOURCES += $$PWD/../core_qss/qss.qrc
INCLUDEPATH += $$PWD INCLUDEPATH += $$PWD
INCLUDEPATH += $$PWD/form INCLUDEPATH += $$PWD/form
include ($$PWD/form/form.pri) include ($$PWD/form/form.pri)
include ($$PWD/../core_helper/core_helper.pri)
INCLUDEPATH += $$PWD/../core_base
include ($$PWD/../core_base/core_base.pri)

View File

@ -1,19 +1,19 @@
#include "frmmain.h" #include "frmmain.h"
#include "appinit.h" #include "appinit.h"
#include "quihelper.h" #include "qthelper.h"
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
QUIHelper::initMain(); QtHelper::initMain();
QApplication a(argc, argv); QApplication a(argc, argv);
AppInit::Instance()->start(); AppInit::Instance()->start();
QUIHelper::setFont(); QtHelper::setFont();
QUIHelper::setCode(); QtHelper::setCode();
frmMain w; frmMain w;
w.setWindowTitle("metro风格主界面 (QQ: 517216493 WX: feiyangqingyun)"); w.setWindowTitle("metro风格主界面 (QQ: 517216493 WX: feiyangqingyun)");
QUIHelper::setFormInCenter(&w); QtHelper::setFormInCenter(&w);
w.show(); w.show();
return a.exec(); return a.exec();

View File

@ -11,6 +11,4 @@ SOURCES += main.cpp
INCLUDEPATH += $$PWD INCLUDEPATH += $$PWD
INCLUDEPATH += $$PWD/form INCLUDEPATH += $$PWD/form
include ($$PWD/form/form.pri) include ($$PWD/form/form.pri)
include ($$PWD/../core_helper/core_helper.pri)
INCLUDEPATH += $$PWD/../core_base
include ($$PWD/../core_base/core_base.pri)