BatteryMonitor/main.cpp

28 lines
1.0 KiB
C++
Raw Permalink Normal View History

2024-10-31 16:48:38 +08:00
#include "dialoglogin.h"
#include <QApplication>
#include <QTranslator>
2024-11-09 17:25:09 +08:00
#include <QPersistentModelIndex>
2024-10-31 16:48:38 +08:00
int main(int argc, char *argv[])
{
2024-11-07 18:07:10 +08:00
// 设置高DPI
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QGuiApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
QGuiApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
QGuiApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough);
#endif
#endif
2024-10-31 16:48:38 +08:00
QApplication a(argc, argv);
a.setStyleSheet("QToolTip { font-size: 18px; font-family: 'SimHei'; }");
DialogLogin loginWidget;
loginWidget.setStyleSheet("background-color: #FFFFFF;");
2024-11-09 17:25:09 +08:00
qRegisterMetaType<QList<QPersistentModelIndex>>("QList<QPersistentModelIndex>");
qRegisterMetaType<QAbstractItemModel::LayoutChangeHint>("QAbstractItemModel::LayoutChangeHint");
qRegisterMetaType<QVector<int>>("QVector<int>");
2024-10-31 16:48:38 +08:00
loginWidget.show();
return a.exec();
}