1
0

main.cpp 824 B

1234567891011121314151617181920212223242526272829
  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::setAttribute(Qt::AA_UseHighDpiPixmaps);
  11. QApplication::setAttribute(Qt::AA_UseDesktopOpenGL);
  12. QApplication a(argc, argv);
  13. QSize screenDim = QGuiApplication::screens()[0]->size();
  14. int splashW = screenDim.width() * 2 / 11;
  15. QPixmap splashImg(":/splash/splash");
  16. QPixmap splashScaled = splashImg.scaled(splashW, splashW * splashImg.height() / splashImg.width());
  17. QSplashScreen splash{ splashScaled };
  18. a.processEvents();
  19. splash.show();
  20. Almond w;
  21. splash.finish(&w);
  22. a.processEvents();
  23. w.showMaximized();
  24. return a.exec();
  25. }