itom
Loading...
Searching...
No Matches
widgetWrapper.h
1/* ********************************************************************
2 itom software
3 URL: http://www.uni-stuttgart.de/ito
4 Copyright (C) 2020, Institut für Technische Optik (ITO),
5 Universität 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// a bunch of forward declarations
34class QListWidget;
35class QComboBox;
36class QTabWidget;
37class QTableView;
38class QSplitter;
39class QStatusBar;
40class QMainWindow;
41class QWidget;
42class QTableWidget;
43class QToolBar;
44class QAction;
45class QLayout;
46class QFormLayout;
47class QGridLayout;
48class QBoxLayout;
49
50namespace ito
51{
52
53class UiOrganizer; // forward declaration
54
56{
57public:
58 WidgetWrapper(UiOrganizer *uiOrganizer); //constructor
59 ~WidgetWrapper(); //destructor
60
61 MethodDescriptionList getMethodList(QObject *object);
62 ito::RetVal call(QObject *object, int methodIndex, void **_a);
63
64 QMetaProperty fakeProperty(const QObject *baseObject, const QString &fakePropertyName, QObject **destinationObject);
65
66private:
67 void initMethodHash();
68 MethodDescription buildMethodDescription(QByteArray signature, QString retType, int methodIndex, bool &ok);
69
70 ito::RetVal callObject(QObject *object, int methodIndex, void **_a);
71 ito::RetVal callListWidget(QListWidget *listWidget, int methodIndex, void **_a);
72 ito::RetVal callComboBox(QComboBox *comboBox, int methodIndex, void **_a);
73 ito::RetVal callTabWidget(QTabWidget *tabWidget, int methodIndex, void **_a);
74 ito::RetVal callTableView(QTableView *tableView, int methodIndex, void **_a);
75 ito::RetVal callSplitter(QSplitter *splitter, int methodIndex, void **_a);
76 ito::RetVal callStatusBar(QStatusBar *statusBar, int methodIndex, void **_a);
77 ito::RetVal callMainWindow(QMainWindow *mainWindow, int methodIndex, void **_a);
78 ito::RetVal callWidget(QWidget *widget, int methodIndex, void **_a);
79 ito::RetVal callTableWidget(QTableWidget *tableWidget, int methodIndex, void **_a);
80 ito::RetVal callToolBar(QToolBar *toolbar, int methodIndex, void **_a);
81 ito::RetVal callAction(QAction *action, int methodIndex, void **_a);
82 ito::RetVal callLayout(QLayout *layout, int methodIndex, void **_a);
83 ito::RetVal callFormLayout(QFormLayout *layout, int methodIndex, void **_a);
84 ito::RetVal callGridLayout(QGridLayout *layout, int methodIndex, void **_a);
85 ito::RetVal callBoxLayout(QBoxLayout *layout, int methodIndex, void **_a);
86
87 QHash<QString, MethodDescriptionList> m_methodHash;
91 UiOrganizer *m_pUiOrganizer;
92};
93
94} //end namespace ito
95
96#endif
Small wrapper class with all necessary information for any method, signal or slot of class which shou...
Definition pythonItomMetaObject.h:64
Class for managing status values (like errors or warning)
Definition retVal.h:54
The UiOrganizer is started as singleton instance within itom and organizes all main windows,...
Definition uiOrganizer.h:303
One instance of this class acts as wrapper for several import public methods of classes,...
Definition widgetWrapper.h:56
~WidgetWrapper()
destructor
Definition widgetWrapper.cpp:79
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:2000
bool m_initialized
Definition widgetWrapper.h:88
ito::RetVal call(QObject *object, int methodIndex, void **_a)
call method which calls a wrapped method of any class derived from QObject at runtime....
Definition widgetWrapper.cpp:377
int m_methodIndexNotFound
Definition widgetWrapper.h:89
QHash< QString, MethodDescriptionList > m_methodHash
Definition widgetWrapper.h:87
WidgetWrapper(UiOrganizer *uiOrganizer)
constructor
Definition widgetWrapper.cpp:69
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:299
MethodDescriptionList getMethodList(QObject *object)
returns a list of MethodDescription, which contains all wrapped methods of the given object and all i...
Definition widgetWrapper.cpp:268
void initMethodHash()
initializes the hash table containing information about all methods which should be wrapped.
Definition widgetWrapper.cpp:101
Definition apiFunctionsGraph.cpp:40