itom  3.0.0
widgetWrapper.h
1 /* ********************************************************************
2  itom software
3  URL: http://www.uni-stuttgart.de/ito
4  Copyright (C) 2016, Institut fuer Technische Optik (ITO),
5  Universitaet Stuttgart, Germany
6 
7  This file is part of itom.
8 
9  itom is free software; you can redistribute it and/or modify it
10  under the terms of the GNU Library General Public Licence as published by
11  the Free Software Foundation; either version 2 of the Licence, or (at
12  your option) any later version.
13 
14  itom is distributed in the hope that it will be useful, but
15  WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library
17  General Public Licence for more details.
18 
19  You should have received a copy of the GNU Library General Public License
20  along with itom. If not, see <http://www.gnu.org/licenses/>.
21 *********************************************************************** */
22 
23 #ifndef WIDGETWRAPPER_H
24 #define WIDGETWRAPPER_H
25 
26 #include "../python/pythonItomMetaObject.h"
27 
28 #include <qobject.h>
29 #include <qhash.h>
30 #include <qmetaobject.h>
31 #include "../global.h"
32 
33 namespace ito
34 {
35 
37 {
38 public:
39  WidgetWrapper(); //constructor
40  ~WidgetWrapper(); //destructor
41 
42  MethodDescriptionList getMethodList(QObject *object);
43  ito::RetVal call(QObject *object, int methodIndex, void **_a);
44 
45  QMetaProperty fakeProperty(const QObject *baseObject, const QString &fakePropertyName, QObject **destinationObject);
46 
47 private:
48  void initMethodHash();
49  MethodDescription buildMethodDescription(QByteArray signature, QString retType, int methodIndex, bool &ok);
50 
51  QHash<QString, MethodDescriptionList> methodHash;
52  bool initialized;
53 };
54 
55 } //end namespace ito
56 
57 #endif
58 
MethodDescription buildMethodDescription(QByteArray signature, QString retType, int methodIndex, bool &ok)
creates an instance of MethodDescription which contains all necessary information in order to call th...
Definition: widgetWrapper.cpp:192
Class for managing status values (like errors or warning)
Definition: retVal.h:54
~WidgetWrapper()
destructor
Definition: widgetWrapper.cpp:66
Definition: apiFunctionsGraph.cpp:39
Small wrapper class with all necessary information for any method, signal or slot of class which shou...
Definition: pythonItomMetaObject.h:49
MethodDescriptionList getMethodList(QObject *object)
returns a list of MethodDescription, which contains all wrapped methods of the given object and all i...
Definition: widgetWrapper.cpp:161
One instance of this class acts as wrapper for several import public methods of classes, derived from QObject, which should be made available by the call-method in python.
Definition: widgetWrapper.h:36
bool initialized
Definition: widgetWrapper.h:52
QHash< QString, MethodDescriptionList > methodHash
Definition: widgetWrapper.h:51
QMetaProperty fakeProperty(const QObject *baseObject, const QString &fakePropertyName, QObject **destinationObject)
Method is able to handle unexisting properties and map them to existing ones (compatibility to QtDesi...
Definition: widgetWrapper.cpp:556
ito::RetVal call(QObject *object, int methodIndex, void **_a)
call method which calls a wrapped method of any class derived from QObject at runtime. This call is for exampled executed by UiOrganizer::callMethod.
Definition: widgetWrapper.cpp:261
void initMethodHash()
initializes the hash table containing information about all methods which should be wrapped...
Definition: widgetWrapper.cpp:88
WidgetWrapper()
constructor
Definition: widgetWrapper.cpp:59