iCub-main
icub-main
src
tools
iCubSkinGui
src
main.cpp
Go to the documentation of this file.
1
#include <QApplication>
2
#include <QQmlApplicationEngine>
3
#include <QVariant>
4
#include <QQuickWindow>
5
#include <QDir>
6
#include "config.h"
7
8
int
main
(
int
argc
,
char
*argv[])
9
{
10
QApplication
app
(
argc
, argv);
11
QVariant retVal;
12
13
// De-comment this to trace all imports
14
// QByteArray data = "1";
15
// qputenv("QML_IMPORT_TRACE", data);
16
17
QQmlApplicationEngine engine;
18
engine.addImportPath(QDir::cleanPath(QCoreApplication::applicationDirPath() + QDir::separator() +
19
PLUGINS_RELATIVE_PATH));
20
#ifdef CMAKE_INTDIR
21
engine.addImportPath(QDir::cleanPath(QCoreApplication::applicationDirPath() + QDir::separator() +
22
".."
+ QDir::separator() +
23
PLUGINS_RELATIVE_PATH + QDir::separator() +
24
CMAKE_INTDIR));
25
#endif
26
27
engine.load(QUrl(QStringLiteral(
"qrc:/main.qml"
)));
28
29
QObject *topLevel = engine.rootObjects().value(0);
30
QQuickWindow *window = qobject_cast<QQuickWindow *>(topLevel);
31
32
// Pack the argc and argv to a QStrinList so we can pass them easily to the plugin
33
QStringList params;
34
for
(
int
i=0;i<
argc
;i++){
35
params.append(argv[i]);
36
}
37
// Call the parseParameters of the toplevel object
38
QMetaObject::invokeMethod(topLevel,
"parseParameters"
,
39
Qt::DirectConnection,
40
Q_RETURN_ARG(QVariant, retVal),
41
Q_ARG(QVariant,params));
42
if
(!retVal.toBool()){
43
return
1;
44
}
45
46
if
(window){
47
window->show();
48
}
49
50
return
(
app
.exec()!=0?1:0);
51
}
main
int main(int argc, char *argv[])
Definition:
main.cpp:31
scripting.app
app
Definition:
scripting.py:196
scripting.argc
argc
Definition:
scripting.py:184
Generated on Wed Nov 13 2024 21:11:40 for iCub-main by
1.9.1