main.cpp 736 B

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