main.cpp 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #include "mainwindow.h"
  2. #include "loginwindow.h"
  3. #include "logger.h"
  4. #include "fireWidget/firingwidget.h"
  5. #include <QApplication>
  6. #include <QFile>
  7. #include <QTextStream>
  8. #include <QQuickWindow> // 关键头文件
  9. int main(int argc, char *argv[])
  10. {
  11. QApplication a(argc, argv);
  12. //TODO: 确认硬件配置,是否需要使用GPU及设备是否安装驱动
  13. //QCoreApplication::setAttribute(Qt::AA_UseOpenGLES); // 强制使用 ANGLE (OpenGL ES over DirectX/Vulkan)
  14. QQuickWindow::setSceneGraphBackend("software"); // 兼容性: 禁用GPU
  15. // 加载 QSS 文件
  16. QFile styleFile(":/qss/qss/tableview.qss");
  17. if (styleFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
  18. QTextStream stream(&styleFile);
  19. QString styleSheet = stream.readAll();
  20. a.setStyleSheet(styleSheet);
  21. styleFile.close();
  22. }
  23. // // 获取屏幕信息
  24. // QScreen *screen = QGuiApplication::primaryScreen();
  25. // QRect screenGeometry = screen->geometry();
  26. // int screenWidth = screenGeometry.width();
  27. // int screenHeight = screenGeometry.height();
  28. // logger
  29. Logger::getInstance("application.log");
  30. // Optional: Set logger configurations
  31. Logger::getInstance().setMaxFileSize(2 * 1024 * 1024); // 2 MB
  32. Logger::getInstance().setMaxBackupFiles(3); // Keep 3 backup files
  33. Logger::getInstance().info("Application started from main.");
  34. //MainWindow w;
  35. // Page w;
  36. // pageTest w;
  37. LoginWindow w;
  38. //loginWindow.show();
  39. // 设置应用程序图标
  40. a.setWindowIcon(QIcon(":/icons/icons/l634z-aceaj-001.ico"));
  41. // w.resize(screenWidth * 1, screenHeight * 0.95);
  42. // firingWidget w;
  43. w.show();
  44. return a.exec();
  45. }