23 auto *mainLayout =
new QHBoxLayout(
this);
26 auto *leftPanel =
new QWidget(
this);
27 leftPanel->setFixedWidth(160);
28 auto *leftLayout =
new QVBoxLayout(leftPanel);
29 leftLayout->setContentsMargins(0, 0, 0, 0);
31 const char *btns[8] = {
"TLatex",
"TH1",
"TH2",
"TGraph",
"Toggle menu",
"Toggle toobar",
"Toggle statusbar",
"Exit"};
33 for (
int i = 0; i < 8; ++i) {
34 auto *btn =
new QPushButton(tr(
"%1").arg(btns[i]), leftPanel);
35 btn->setMinimumHeight(25);
36 leftLayout->addWidget(btn);
37 connect(btn, &QPushButton::clicked,
this, [
this, i] {
42 auto box1 =
new QCheckBox(
"Update", leftPanel);
43 leftLayout->addWidget(box1);
44 connect(box1, &QCheckBox::toggled,
this, [
this](
bool on) {
toggle_timer(
on); });
45 leftLayout->addStretch();
54 mainLayout->addWidget(leftPanel);
84 while (obj = iter()) {
92 if (
auto ltx =
dynamic_cast<TLatex *
>(obj))
94 ltx->SetTextAlign(12);
101 if (
auto h1 =
dynamic_cast<TH1 *
>(obj)) {
104 for (
int n = 0;
n < 300; ++
n) {
113 if (
auto h2 =
dynamic_cast<TH2 *
>(obj)) {
117 for (
int n = 0;
n < 300; ++
n) {
127 if (
auto gr =
dynamic_cast<TGraph *
>(obj)) {
128 for (
int i = 0; i < 100; ++i)
149 }
else if (
index == 5) {
152 }
else if (
index == 6) {
165 auto ltx =
new TLatex(0.5, 0.5,
"TLatex");
166 ltx->SetTextAlign(22);
167 ltx->SetTextSize(0.2);
174 auto h1 =
new TH1I(
"h1",
"Example of TH1I", 100, -5, 5);
181 auto h2 =
new TH2I(
"h2",
"Example of TH2I", 40, -5, 5, 40, -5, 5);
182 h2->SetDirectory(
nullptr);
197 default: QApplication::quit();
return;
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void on
R__EXTERN TRandom * gRandom
QVBoxLayout * m_placeholderLayout
void button_clicked(int index)
MainWidget(QWidget *parent=nullptr)
void fill_canvas_object()
void toggle_timer(bool on)
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
virtual void SetLineColor(Color_t lcolor)
Set the line color.
virtual void ShowMenuBar(Bool_t show=kTRUE)
void Clear(Option_t *option="") override
Remove all primitives from the canvas.
virtual void ToggleEventStatus()
Toggle event statusbar.
TCanvasImp * GetCanvasImp() const override
virtual void Resize(Option_t *option="")
Recompute canvas parameters following a X11 Resize.
void Update() override
Update canvas pad buffers.
virtual void ToggleToolBar()
Toggle toolbar.
A TGraph is an object made of two arrays X and Y with npoints each.
virtual void SetPoint(Int_t i, Double_t x, Double_t y)
Set x and y values for point number i.
void SetName(const char *name="") override
Set graph name.
void SetTitle(const char *title="") override
Change (i.e.
void Reset(Option_t *option="") override
Reset.
1-D histogram with an int per channel (see TH1 documentation)
TH1 is the base class of all histogram classes in ROOT.
virtual void SetDirectory(TDirectory *dir)
By default, when a histogram is created, it is added to the list of histogram objects in the current ...
void SetTitle(const char *title) override
Change/set the title.
virtual Int_t Fill(Double_t x)
Increment bin with abscissa X by 1.
2-D histogram with an int per channel (see TH1 documentation)
Service class for 2-D histogram classes.
To draw Mathematical Formula.
Mother of all ROOT objects.
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
TList * GetListOfPrimitives() const override
void Range(Double_t x1, Double_t y1, Double_t x2, Double_t y2) override
Set world coordinate system for the pad.
void Add(TObject *obj, Option_t *opt="", Bool_t modified=kTRUE) override
Add an object to list of primitives with specified draw option When.
virtual Double_t Gaus(Double_t mean=0, Double_t sigma=1)
Samples a random number from the standard Normal (Gaussian) Distribution with the given mean and sigm...
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Namespace for ROOT features in testing.
Double_t Sin(Double_t)
Returns the sine of an angle of x radians.