| 1 |
#include <QApplication> |
| 2 |
#include <QTranslator> |
| 3 |
#include <QDebug> |
| 4 |
#include "mainWindow.h" |
| 5 |
|
| 6 |
#if QT_VERSION > 0x050000 |
| 7 |
// include some random private headers |
| 8 |
// As you're not supposed to use it, your system may miss |
| 9 |
// qobject_p.h. To locate it try one of these commands: |
| 10 |
// - dnf provides */private/qobject_p.h |
| 11 |
// - apt-file search qobject_p.h |
| 12 |
#include <private/qobject_p.h> |
| 13 |
#endif |
| 14 |
|
| 15 |
int main(int argc, char **argv) { |
| 16 |
#ifndef UNITY_BUILD |
| 17 |
Q_INIT_RESOURCE(stuff); |
| 18 |
Q_INIT_RESOURCE(stuff2); |
| 19 |
#endif |
| 20 |
QApplication app(argc, argv); |
| 21 |
|
| 22 |
auto *translator = new QTranslator; |
| 23 |
if (translator->load(QLocale(), QT "embedded", "_", ":/lang")) |
| 24 |
qApp->installTranslator(translator); |
| 25 |
|
| 26 |
qDebug() << QObject::tr("Translate me!"); |
| 27 |
|
| 28 |
MainWindow *win = new MainWindow(); |
| 29 |
QImage qi(":/thing.png"); |
| 30 |
if(qi.width() != 640) { |
| 31 |
return 1; |
| 32 |
} |
| 33 |
QImage qi2(":/thing2.png"); |
| 34 |
if(qi2.width() != 640) { |
| 35 |
return 1; |
| 36 |
} |
| 37 |
win->setWindowTitle("Meson Qt5 build test"); |
| 38 |
QLabel *label_stuff = win->findChild<QLabel *>("label_stuff"); |
| 39 |
if(label_stuff == nullptr) { |
| 40 |
return 1; |
| 41 |
} |
| 42 |
int w = label_stuff->width(); |
| 43 |
int h = label_stuff->height(); |
| 44 |
label_stuff->setPixmap(QPixmap::fromImage(qi).scaled(w,h,Qt::KeepAspectRatio)); |
| 45 |
QLabel *label_stuff2 = win->findChild<QLabel *>("label_stuff2"); |
| 46 |
if(label_stuff2 == nullptr) { |
| 47 |
return 1; |
| 48 |
} |
| 49 |
w = label_stuff2->width(); |
| 50 |
h = label_stuff2->height(); |
| 51 |
label_stuff2->setPixmap(QPixmap::fromImage(qi2).scaled(w,h,Qt::KeepAspectRatio)); |
| 52 |
win->show(); |
| 53 |
return app.exec(); |
| 54 |
return 0; |
| 55 |
} |