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
14{
15public:
16 TParamFollower()
17 {
18 TQObject::Connect("TEveParamList", "ParamChanged(char*)",
19 "TParamFollower", this, "OnParamChanged(char*)");
20 }
21 virtual ~TParamFollower()
22 {
23 TQObject::Disconnect("TParamFollower", "ParamChanged(char*)",
24 this, "OnParamChanged(char*)");
25 }
26
27 void OnParamChanged(const char* parameter)
28 {
29 auto pl = dynamic_cast<TEveParamList*> (reinterpret_cast<TQObject*>(gTQSender));
30
31 printf("Change in param-list '%s', parameter '%s'.\n", pl->GetElementName(), parameter);
32 }
33
34 ClassDef(TParamFollower, 0);
35};
36
37ClassImp(TParamFollower)
38
39void paramlist()
40{
42
43 TEveParamList* x = nullptr;
44
45 x = new TEveParamList("Top config");
46 gEve->AddToListTree(x, false);
47
48 x->AddParameter(TEveParamList::FloatConfig_t("Pepe", 20, 0, 110));
49 x->AddParameter(TEveParamList::IntConfig_t("Dima", 100, 0, 110));
50 x->AddParameter(TEveParamList::BoolConfig_t("Chris", true));
51
52 x = new TEveParamList("Another config");
53 gEve->AddToListTree(x, false);
54
55 x->AddParameter(TEveParamList::FloatConfig_t("MagneticField", 4, -4, 4));
56 x->AddParameter(TEveParamList::FloatConfig_t("Temperature", 16, -20, 40));
57
58 new TParamFollower;
59}
#define ClassDef(name, id)
Definition Rtypes.h:337
#define ClassImp(name)
Definition Rtypes.h:377
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