review cpp-lib example

This commit is contained in:
pls.153 2022-01-22 21:12:15 +01:00
parent eb54b6fd41
commit 2e67185cd2
3 changed files with 18 additions and 21 deletions

View file

@ -1,4 +1,6 @@
#include "lib.h"
#include <QApplication>
#include <QMessageBox>
#include <QtDebug>
QT_BEGIN_NAMESPACE
@ -8,18 +10,21 @@ QObject* ini() {
static QObject* cpp = 0;
if(!cpp) {
cpp = new CPP;
// needed for QMessageBox
static int argc = 1;
static char* argv[] = {"cpp"};
new QApplication(argc, argv);
}
return cpp;
}
// insert here your function implementations
QVariant CPP::hello(const QVariant& arg) {
QString msg;
QDebug debug(&msg);
debug << arg;
qDebug() << "hello" << arg;
QMessageBox::information(nullptr, "hello", msg);
return arg;
}