#include "mainwin.h" #include #include #include #include #include #ifdef _MSC_VER //MSVC编译器 #include #include LONG WINAPI handleException(_EXCEPTION_POINTERS *excep) { auto errCode = QString::number(excep->ExceptionRecord->ExceptionCode, 16); auto errAddr = QString::number((uint)excep->ExceptionRecord->ExceptionAddress, 16); auto hDumpFile = CreateFile(L"ledset-crash.dmp", GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); if(hDumpFile == INVALID_HANDLE_VALUE) { qCritical()<<"CreateFile ledset-crash.dmp Failed! ExceptionCode"<程序出错!
请将安装目录下的 ledok-crash.dmp 文件发送到 gangphon@qq.com 邮箱, 研发人员会尽快处理."); return EXCEPTION_EXECUTE_HANDLER; //已处理异常, 让 windows 正常结束 } #endif int main(int argc, char *argv[]) { qputenv("QT_QPA_PLATFORM", "windows:darkmode=2"); QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); QApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough); QApplication::setOrganizationName("Shanghai Xixun Electronic Technology"); QApplication::setOrganizationDomain("ledok.cn"); QApplication::setApplicationName("LedSet Express"); QApplication a(argc, argv); QApplication::setStyle("Fusion"); a.setWindowIcon(QIcon(":/128.ico")); a.setStyleSheet(R"rrr( QLineEdit {border: 1px solid #777; border-radius: 2px; padding: 2px;} QAbstractScrollArea {border: 1px solid #777;} QTableView {gridline-color:#777;} QMessageBox {background: #333;} QRadioButton::indicator {border-image: url(:/imgs/radio-un.png); width: 1em; height: 1em;} QRadioButton::indicator:checked {border-image: url(:/imgs/radio-check.png);} QCheckBox::indicator {border-image: url(:/imgs/checkbox-un.png); width: 1em; height: 1em;} QCheckBox::indicator:checked {border-image: url(:/imgs/checkbox-check.png);} QPushButton:checked {border: 2px solid #0a0; border-radius: 3px; padding-top: 2px; padding-bottom: 2px; } QPushButton:disabled {color: #777;} QPushButton[ss="blue"] {background: #059;} QGroupBox {border: 1px solid #777; border-radius: 3px; margin-top: 0.5em; padding-top: 0.4em;} QGroupBox::title {color: #fff; subcontrol-origin: margin; left: 0.5em;} )rrr"); QFont font; font.setFamilies(QStringList{"Arial","Microsoft YaHei UI"}); a.setFont(font); QPalette plt = a.palette(); plt.setBrush(QPalette::Window, QColor(0x333333)); plt.setBrush(QPalette::WindowText, QColor(0xffffff)); plt.setBrush(QPalette::Base, QColor(0x222222)); plt.setBrush(QPalette::AlternateBase, QColor(0x333333)); plt.setBrush(QPalette::Text, QColor(0xffffff)); plt.setBrush(QPalette::PlaceholderText, QColor(0xaaaaaa)); plt.setBrush(QPalette::Button, QColor(0x444444)); plt.setBrush(QPalette::ButtonText, QColor(0xffffff)); plt.setBrush(QPalette::ToolTipBase, QColor(0x444466)); plt.setBrush(QPalette::ToolTipText, QColor(0xeeeeee)); plt.setBrush(QPalette::Light, QColor(0x444444)); plt.setBrush(QPalette::Midlight, QColor(0x666666)); plt.setBrush(QPalette::Mid, QColor(0x888888)); plt.setBrush(QPalette::Dark, QColor(0xaaaaaa)); plt.setBrush(QPalette::BrightText, QColor(0,0,0)); plt.setBrush(QPalette::Shadow, QColor(0xaaaaaa)); a.setPalette(plt); QTranslator translator; if(translator.load(QLocale(), "app", "_", ":/i18n")) a.installTranslator(&translator); QTranslator qtTrans; if(qtTrans.load(QLocale(), "qt", "_", "translations")) a.installTranslator(&qtTrans); MainWin w; #ifdef _MSC_VER SetUnhandledExceptionFilter(handleException); #endif return a.exec(); }