Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
paramlist.C
Go to the documentation of this file.
1/// \file
2/// \ingroup tutorial_eve
3/// Demonstrates usage of simple configuration via TEveParamList class.
4///
5/// \macro_code
6///
7/// \author Matevz Tadel
8
9#include "TEveManager.h"
10#include "TEveParamList.h"
11#include "TQObject.h"
12
13class TParamFollower {
14public:
15 TParamFollower()
16 {
17 TQObject::Connect("TEveParamList", "ParamChanged(char*)", "TParamFollower", this, "OnParamChanged(char*)");
18 }
19 virtual ~TParamFollower()
20 {
21 TQObject::Disconnect("TParamFollower", "ParamChanged(char*)", this, "OnParamChanged(char*)");
22 }
23
24 void OnParamChanged(const char *parameter)
25 {
26 auto pl = dynamic_cast<TEveParamList *>(reinterpret_cast<TQObject *>(gTQSender));
27
28 printf("Change in param-list '%s', parameter '%s'.\n", pl->GetElementName(), parameter);
29 }
30
31 ClassDef(TParamFollower, 0);
32};
33
34ClassImp(TParamFollower)
35
36 void paramlist()
37{
39
40 TEveParamList *x = nullptr;
41
42 x = new TEveParamList("Top config");
43 gEve->AddToListTree(x, false);
44
45 x->AddParameter(TEveParamList::FloatConfig_t("Pepe", 20, 0, 110));
46 x->AddParameter(TEveParamList::IntConfig_t("Dima", 100, 0, 110));
47 x->AddParameter(TEveParamList::BoolConfig_t("Chris", true));
48
49 x = new TEveParamList("Another config");
50 gEve->AddToListTree(x, false);
51
52 x->AddParameter(TEveParamList::FloatConfig_t("MagneticField", 4, -4, 4));
53 x->AddParameter(TEveParamList::FloatConfig_t("Temperature", 16, -20, 40));
54
55 new TParamFollower;
56}
#define ClassDef(name, id)
Definition Rtypes.h:342
#define ClassImp(name)
Definition Rtypes.h:382
R__EXTERN TEveManager * gEve
R__EXTERN void * gTQSender
Definition TQObject.h:46
static TEveManager * Create(Bool_t map_window=kTRUE, Option_t *opt="FIV")
If global TEveManager* gEve is not set initialize it.
TGListTreeItem * AddToListTree(TEveElement *re, Bool_t open, TGListTree *lt=nullptr)
Collection of named parameters.
This is the ROOT implementation of the Qt object communication mechanism (see also http://www....
Definition TQObject.h:48
Bool_t Connect(const char *signal, const char *receiver_class, void *receiver, const char *slot)
Non-static method is used to connect from the signal of this object to the receiver slot.
Definition TQObject.cxx:869
Bool_t Disconnect(const char *signal=nullptr, void *receiver=nullptr, const char *slot=nullptr)
Disconnects signal of this object from slot of receiver.
Double_t x[n]
Definition legend1.C:17