main.cpp 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. /*auto list = QStyleFactory::keys();
  20. for (auto& str : list)
  21. printf("key: %s\n", str.toStdString().c_str());
  22. a.setStyle(QStyleFactory::create("Windows"));*/
  23. /*QPalette p = qApp->palette();
  24. p.setColor(QPalette::Window, QColor(53,53,53));
  25. p.setColor(QPalette::Button, QColor(53,53,53));
  26. p.setColor(QPalette::Base, QColor(53,53,53));
  27. p.setColor(QPalette::Background, QColor(53,53,53));
  28. p.setColor(QPalette::Highlight, QColor(142,45,197));
  29. p.setColor(QPalette::ButtonText, QColor(255,255,255));
  30. p.setColor(QPalette::WindowText, QColor(255,255,255));
  31. qApp->setPalette(p);*/
  32. Almond w;
  33. splash.finish(&w);
  34. a.processEvents();
  35. w.showMaximized();
  36. return a.exec();
  37. }