@@ -39,6 +39,7 @@ ExampleWidget::ExampleWidget(QWidget *parent, const char *name) : QWidget(parent
3939 QObject::connect (GeoCanvasBtn, &QPushButton::clicked, this , &ExampleWidget::GeoCanvasButton_clicked);
4040 QObject::connect (StandaloneBtn, &QPushButton::clicked, this , &ExampleWidget::StandaloneBtn_clicked);
4141 QObject::connect (ExitBtn, &QPushButton::clicked, this , &ExampleWidget::ExitButton_clicked);
42+ QObject::connect (fxUpdateChk, &QCheckBox::toggled, this , &ExampleWidget::UpdateChk_toggled);
4243
4344 setAttribute (Qt::WA_DeleteOnClose);
4445
@@ -51,7 +52,7 @@ ExampleWidget::ExampleWidget(QWidget *parent, const char *name) : QWidget(parent
5152 fHisto ->SetDirectory (nullptr );
5253
5354 gPad = fxTCanvasWidget->getCanvas ();
54- fHisto ->Draw ();
55+ fHisto ->Draw (" hist " );
5556
5657 static constexpr int nth2points = 40 ;
5758 fHisto2 = std::make_shared<TH2I>(" gaus2" , " Example of TH2 drawing in RCanvas" , nth2points, -5 , 5 , nth2points, -5 , 5 );
@@ -71,6 +72,23 @@ ExampleWidget::ExampleWidget(QWidget *parent, const char *name) : QWidget(parent
7172
7273ExampleWidget::~ExampleWidget () {}
7374
75+ void ExampleWidget::UpdateChk_toggled (bool on)
76+ {
77+ if (on) {
78+ // enable modify of canvas every 100 ms
79+ QObject::connect (&fTimer , &QTimer::timeout, [&]() {
80+ fHisto ->FillRandom (" gaus" , 1000 );
81+ fxTCanvasWidget->getCanvas ()->Modified ();
82+ fxTCanvasWidget->getCanvas ()->Update ();
83+ });
84+ fTimer .setSingleShot (false );
85+ fTimer .start (100 );
86+ } else {
87+ fTimer .stop ();
88+ }
89+ }
90+
91+
7492void ExampleWidget::CreateDummyGeometry ()
7593{
7694 auto viewer = fxGeomViewerWidget->getGeomViewer ();
0 commit comments