summaryrefslogtreecommitdiffstats
path: root/test cases/frameworks/4 qt/main.cpp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-29 04:41:38 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-29 04:41:38 +0000
commit7b6e527f440cd7e6f8be2b07cee320ee6ca18786 (patch)
tree4a2738d69fa2814659fdadddf5826282e73d81f4 /test cases/frameworks/4 qt/main.cpp
parentInitial commit. (diff)
downloadmeson-7b6e527f440cd7e6f8be2b07cee320ee6ca18786.tar.xz
meson-7b6e527f440cd7e6f8be2b07cee320ee6ca18786.zip
Adding upstream version 1.0.1.upstream/1.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test cases/frameworks/4 qt/main.cpp')
-rw-r--r--test cases/frameworks/4 qt/main.cpp55
1 files changed, 55 insertions, 0 deletions
diff --git a/test cases/frameworks/4 qt/main.cpp b/test cases/frameworks/4 qt/main.cpp
new file mode 100644
index 0000000..3c141b9
--- /dev/null
+++ b/test cases/frameworks/4 qt/main.cpp
@@ -0,0 +1,55 @@
+#include <QApplication>
+#include <QTranslator>
+#include <QDebug>
+#include "mainWindow.h"
+
+#if QT_VERSION > 0x050000
+// include some random private headers
+// As you're not supposed to use it, your system may miss
+// qobject_p.h. To locate it try one of these commands:
+// - dnf provides */private/qobject_p.h
+// - apt-file search qobject_p.h
+ #include <private/qobject_p.h>
+#endif
+
+int main(int argc, char **argv) {
+ #ifndef UNITY_BUILD
+ Q_INIT_RESOURCE(stuff);
+ Q_INIT_RESOURCE(stuff2);
+ #endif
+ QApplication app(argc, argv);
+
+ auto *translator = new QTranslator;
+ if (translator->load(QLocale(), QT "embedded", "_", ":/lang"))
+ qApp->installTranslator(translator);
+
+ qDebug() << QObject::tr("Translate me!");
+
+ MainWindow *win = new MainWindow();
+ QImage qi(":/thing.png");
+ if(qi.width() != 640) {
+ return 1;
+ }
+ QImage qi2(":/thing2.png");
+ if(qi2.width() != 640) {
+ return 1;
+ }
+ win->setWindowTitle("Meson Qt5 build test");
+ QLabel *label_stuff = win->findChild<QLabel *>("label_stuff");
+ if(label_stuff == nullptr) {
+ return 1;
+ }
+ int w = label_stuff->width();
+ int h = label_stuff->height();
+ label_stuff->setPixmap(QPixmap::fromImage(qi).scaled(w,h,Qt::KeepAspectRatio));
+ QLabel *label_stuff2 = win->findChild<QLabel *>("label_stuff2");
+ if(label_stuff2 == nullptr) {
+ return 1;
+ }
+ w = label_stuff2->width();
+ h = label_stuff2->height();
+ label_stuff2->setPixmap(QPixmap::fromImage(qi2).scaled(w,h,Qt::KeepAspectRatio));
+ win->show();
+ return app.exec();
+ return 0;
+}