GSI Object Oriented Online Offline (Go4) GO4-6.4.0
Loading...
Searching...
No Matches
QGo4Widget.h
Go to the documentation of this file.
1// $Id$
2//-----------------------------------------------------------------------
3// The GSI Online Offline Object Oriented (Go4) Project
4// Experiment Data Processing at EE department, GSI
5//-----------------------------------------------------------------------
6// Copyright (C) 2000- GSI Helmholtzzentrum fuer Schwerionenforschung GmbH
7// Planckstr. 1, 64291 Darmstadt, Germany
8// Contact: http://go4.gsi.de
9//-----------------------------------------------------------------------
10// This software can be used under the license agreements as stated
11// in Go4License.txt file which is part of the distribution.
12//-----------------------------------------------------------------------
13
14#ifndef QGO4WIDGET_H
15#define QGO4WIDGET_H
16
17#include <QWidget>
18#include <QIcon>
19
20class TObject;
21class TClass;
22class TPad;
23class TGo4Slot;
24class TGo4ViewPanel;
26class TGo4ServerProxy;
27class QMenu;
28class QAction;
29class QSignalMapper;
30
31#ifdef __GO4DESIGNER__
32#include <QtDesigner/QDesignerExportWidget>
33#define GO4_QWIDGET_EXPORT QDESIGNER_WIDGET_EXPORT
34#else
35#define GO4_QWIDGET_EXPORT
36#endif
37
38class GO4_QWIDGET_EXPORT QGo4Widget : public QWidget {
39
40 Q_OBJECT
41
42 friend class TGo4MainWindow;
43
44private:
46 bool fCanDestroyWidget{false};
47 bool fResetWidgetShooted{false};
48 bool fBlockUpdate{false};
49
51
52 public:
96
97 QGo4Widget(QWidget *parent = nullptr, const char *name = nullptr, Qt::WindowFlags f = Qt::Widget);
98 virtual ~QGo4Widget();
99
100 virtual bool IsAcceptDrag(const char *itemname, TClass *cl, int kind);
101 virtual void DropItem(const char *itemname, TClass *cl, int kind);
102 virtual void ResetWidget();
103
104 void ObjectCreatedByWidget(const char *itemname, TClass *cl);
105
106 void ProcessSignal(const char *linkname, bool assigned, TObject *obj, TGo4Slot *slot);
107
108 static QAction* AddIdAction(QMenu* menu, QSignalMapper* map,
109 const QString& text, int id, int enabled = -1, int checked = -1);
110
111 static QAction* AddIdAction(QMenu* menu, QSignalMapper* map,
112 const QIcon& icon, const QString& text, int id, int enabled = -1, int checked = -1);
113
114 static QAction* CreateChkAction(QMenu* menu, const QString& text, bool checked, bool enabled = true);
115
116 static QAction* SetIdAction(QSignalMapper* map, int id, int enabled = -1, int checked = -1);
117
118 signals:
119 void widgetService(QGo4Widget* editor, int serviceid, const char *str, void *par);
120
121 public slots:
122 void CloseMDIParentSlot();
123
124 protected:
125 void closeEvent(QCloseEvent* e) override;
126 void dragEnterEvent(QDragEnterEvent *e) override;
127 void dragMoveEvent(QDragMoveEvent* e) override;
128 void dropEvent(QDropEvent* e) override;
129
131 void AddLink(const char *itemname, const char *linkname);
132
134 void AddLink(TGo4Slot *slot, const char *linkname);
135
137 TGo4Slot *AddLink(const char *itemname, TGo4Slot *parent);
138
140 TGo4Slot *GetTopSlot(bool force = false);
141
143 TGo4Slot *AddSlot(const char *slotname);
144
146 void SetLinkedName(TGo4Slot *slot, const char *itemname);
147
149 const char *GetLinkedName(const char *linkname);
150
152 const char *GetLinkedName(TGo4Slot *slot);
153
154 TObject *GetLinked(const char *linkname, int updatelevel = 0);
155
156 template<class T>
157 T* GetLinkedCast(const char *linkname, int updatelevel = 0) { return dynamic_cast<T *>(GetLinked(linkname, updatelevel)); }
158
159 void RemoveLink(const char *linkname, bool blockreset = true);
160 void RemoveAllLinks(bool blockreset = true);
161 void RemoveLinksMasked(const char *startedwith = nullptr, bool blockreset = true);
162
163 bool BrowserItemRemote(const char *itemname);
164 TGo4BrowserProxy *Browser();
165
166 void StatusMessage(const QString& message);
167
172 void AskToCreateObject(TClass *cl, int isremote);
173 void ShowItemInfo(const QString& itemname);
174 TGo4ViewPanel *CreateViewPanel(int ndiv = 0);
175 TGo4ViewPanel *DrawItem(const QString& itemname, TGo4ViewPanel *panel = nullptr, TPad *pad = nullptr, bool activate = true, int updatelevel = -1);
176 TGo4ViewPanel *WhereItemDrawn(const char *itemname);
177 void HelpWindow(const char *filename, const char *msg = nullptr);
178 void UndrawItem(const char *itemname);
179 TGo4ViewPanel *LastActivePanel();
180 void EditItem(const QString& itemname);
181 void EditObjectInSlot(TGo4Slot *slot);
182 QString SaveObjectInMemory(const char *foldername, TObject *obj);
183 bool SaveItemToFile(const char *itemname, const char *subfolder = nullptr);
184 bool UpdateItemInAnalysis(const char *itemname, TObject *obj = nullptr);
185 void InformThatObjectCreated(const char *itemname, TClass *cl);
186 TGo4ServerProxy *GetAnalysis(const char *itemname = nullptr);
187 void StartHotstart(const char *filename);
188
190 void ConnectPad(TPad *pad);
191
192 void CallServiceFunc(int id, const char *str = nullptr, void *par = nullptr);
193 void ServiceCall(const char *name, void *par = nullptr);
194
195 virtual void requestedObjectCreated(const char *itemname, TClass *cl);
196 virtual void linkedObjectUpdated(const char *linkname, TObject *obj);
197 virtual void linkedObjectRemoved(const char *linkname);
198 virtual void linkedUpdated(TGo4Slot *slot, TObject *obj);
199 virtual void linkedRemoved(TGo4Slot *slot, TObject *obj);
200
201 void setCanDestroyWidget(bool on = true) { fCanDestroyWidget = on; }
202
203 void CallPanelFunc(int id, TPad *pad = nullptr);
204
205 void ShootResetWidget();
206 void ShootCloseWidget(bool closeparent = false);
207
208 bool IsUpdateBlocked() const { return fBlockUpdate; }
209};
210
211#endif
#define GO4_QWIDGET_EXPORT
Definition QGo4Widget.h:35
T * GetLinkedCast(const char *linkname, int updatelevel=0)
Definition QGo4Widget.h:157
TGo4Slot * GetTopSlot(bool force=false)
return top slot of structure, corresponding to this widget
bool fBlockUpdate
indicates that reset widget timer is shoot
Definition QGo4Widget.h:48
void widgetService(QGo4Widget *editor, int serviceid, const char *str, void *par)
@ service_WhereItemDrawn
Definition QGo4Widget.h:84
@ service_UndrawItem
Definition QGo4Widget.h:85
@ service_UpdateAnalysisItem
Definition QGo4Widget.h:61
@ service_PanelTimer
Definition QGo4Widget.h:87
@ service_ShowInfo
Definition QGo4Widget.h:58
@ service_GetLinked2
Definition QGo4Widget.h:78
@ service_EditItem
Definition QGo4Widget.h:57
@ service_HotStart
Definition QGo4Widget.h:89
@ service_CreateViewPanel
Definition QGo4Widget.h:63
@ service_Browser
Definition QGo4Widget.h:65
@ service_EditInSlot
Definition QGo4Widget.h:59
@ service_General
Definition QGo4Widget.h:86
@ service_GetLinked0
Definition QGo4Widget.h:76
@ service_AddDirectLink
Definition QGo4Widget.h:69
@ service_RemoveLink
Definition QGo4Widget.h:79
@ panel_PadDeleted
Definition QGo4Widget.h:94
@ service_GetLinked1
Definition QGo4Widget.h:77
@ service_SaveToMemory
Definition QGo4Widget.h:66
@ panel_Activated
Definition QGo4Widget.h:90
@ service_HelpWindow
Definition QGo4Widget.h:88
@ service_GetTopSlot
Definition QGo4Widget.h:71
@ service_ConnectPad
Definition QGo4Widget.h:82
@ service_LastActivePanel
Definition QGo4Widget.h:83
@ service_AddLinkInSlot
Definition QGo4Widget.h:70
@ service_DropEvent
Definition QGo4Widget.h:54
@ service_SetLinkedName
Definition QGo4Widget.h:73
@ service_BrowserItemRemote
Definition QGo4Widget.h:64
@ service_CreateItem
Definition QGo4Widget.h:55
@ service_AddEditorSlot
Definition QGo4Widget.h:72
@ service_DrawItem
Definition QGo4Widget.h:56
@ service_GetLinkedName2
Definition QGo4Widget.h:75
@ service_GetAnalysis
Definition QGo4Widget.h:67
@ service_GetLinkedName
Definition QGo4Widget.h:74
@ service_SaveItem
Definition QGo4Widget.h:60
@ service_StatusMessage
Definition QGo4Widget.h:62
@ service_RemoveAllLinks
Definition QGo4Widget.h:80
@ service_AddEditorLink
Definition QGo4Widget.h:68
@ panel_ActiveUpdated
Definition QGo4Widget.h:93
@ service_ObjectCreated
Definition QGo4Widget.h:81
@ service_DragEnter
Definition QGo4Widget.h:53
void setCanDestroyWidget(bool on=true)
Definition QGo4Widget.h:201
TObject * GetLinked(const char *linkname, int updatelevel=0)
void closeEvent(QCloseEvent *e) override
void dragEnterEvent(QDragEnterEvent *e) override
const char * GetLinkedName(const char *linkname)
returns name of item, which was linked with linkname
bool IsUpdateBlocked() const
Definition QGo4Widget.h:208
TGo4Slot * AddSlot(const char *slotname)
add slot with specific name to widget top folder
void dragMoveEvent(QDragMoveEvent *e) override
QGo4Widget(QWidget *parent=nullptr, const char *name=nullptr, Qt::WindowFlags f=Qt::Widget)
void dropEvent(QDropEvent *e) override
bool fWaitsForObjectCreation
Definition QGo4Widget.h:45
void AddLink(const char *itemname, const char *linkname)
create link for item with name linkname
bool fCanDestroyWidget
Definition QGo4Widget.h:46
void CloseMDIParentSlot()
bool fResetWidgetShooted
indicate that widget can be destroyed
Definition QGo4Widget.h:47
void SetLinkedName(TGo4Slot *slot, const char *itemname)
set name of item, which was linked by this slot
friend class TGo4MainWindow
Definition QGo4Widget.h:42
TGo4BrowserProxy * fBrowserProxy
set when automatic reset must be blocked
Definition QGo4Widget.h:50
special base class for remote data servers like DABC, HTTP, hist server