main.cpp 709 B

123456789101112131415161718192021222324252627
  1. #include "Almond.h"
  2. #include <QtWidgets/QApplication>
  3. #include <QPixmap>
  4. #include <QScreen>
  5. #include <QSplashScreen>
  6. #include <cmath>
  7. int main(int argc, char *argv[])
  8. {
  9. QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
  10. QApplication a(argc, argv);
  11. QSize screenDim = QGuiApplication::screens()[0]->size();
  12. int splashW = screenDim.width() * 2 / 11;
  13. QPixmap splashImg(":/splash/splash");
  14. QPixmap splashScaled = splashImg.scaled(splashW, splashW * splashImg.height() / splashImg.width());
  15. QSplashScreen splash{ splashScaled };
  16. a.processEvents();
  17. splash.show();
  18. Almond w;
  19. splash.finish(&w);
  20. a.processEvents();
  21. w.showMaximized();
  22. return a.exec();
  23. }