main.cpp 1010 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #include <QApplication>
  2. #include "mainWindow.h"
  3. int main(int argc, char **argv) {
  4. #ifndef UNITY_BUILD
  5. Q_INIT_RESOURCE(stuff);
  6. Q_INIT_RESOURCE(stuff2);
  7. #endif
  8. QApplication app(argc, argv);
  9. MainWindow *win = new MainWindow();
  10. QImage qi(":/thing.png");
  11. if(qi.width() != 640) {
  12. return 1;
  13. }
  14. QImage qi2(":/thing2.png");
  15. if(qi2.width() != 640) {
  16. return 1;
  17. }
  18. win->setWindowTitle("Meson Qt5 build test");
  19. QLabel *label_stuff = win->findChild<QLabel *>("label_stuff");
  20. if(label_stuff == nullptr) {
  21. return 1;
  22. }
  23. int w = label_stuff->width();
  24. int h = label_stuff->height();
  25. label_stuff->setPixmap(QPixmap::fromImage(qi).scaled(w,h,Qt::KeepAspectRatio));
  26. QLabel *label_stuff2 = win->findChild<QLabel *>("label_stuff2");
  27. if(label_stuff2 == nullptr) {
  28. return 1;
  29. }
  30. w = label_stuff2->width();
  31. h = label_stuff2->height();
  32. label_stuff2->setPixmap(QPixmap::fromImage(qi2).scaled(w,h,Qt::KeepAspectRatio));
  33. win->show();
  34. return app.exec();
  35. return 0;
  36. }