BatteryMonitor/main.cpp

28 lines
1.0 KiB
C++

#include "dialoglogin.h"
#include <QApplication>
#include <QTranslator>
#include <QPersistentModelIndex>
int main(int argc, char *argv[])
{
// 设置高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
QApplication a(argc, argv);
a.setStyleSheet("QToolTip { font-size: 18px; font-family: 'SimHei'; }");
DialogLogin loginWidget;
loginWidget.setStyleSheet("background-color: #FFFFFF;");
qRegisterMetaType<QList<QPersistentModelIndex>>("QList<QPersistentModelIndex>");
qRegisterMetaType<QAbstractItemModel::LayoutChangeHint>("QAbstractItemModel::LayoutChangeHint");
qRegisterMetaType<QVector<int>>("QVector<int>");
loginWidget.show();
return a.exec();
}