GSI Object Oriented Online Offline (Go4) GO4-6.4.0
Loading...
Searching...
No Matches
ExampleWidget.cpp
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#include "ExampleWidget.h"
15
16#include "QRootCanvas.h"
17#include "TCanvas.h"
18#include "TH1.h"
19
20#include <QMessageBox>
21
22ExampleWidget::ExampleWidget(QWidget *parent, const char *name) :
23 QWidget(parent)
24{
25 setupUi(this);
26
27 // TODO: viewpanel does not closed when press close button
28 setAttribute(Qt::WA_DeleteOnClose);
29
30 setObjectName(name);
31
32 fxQCanvas->setObjectName("example");
33 fxQCanvas->getCanvas()->SetName("example");
34 fxQCanvas->setEditorFrame(EditorFrame);
35 fxQCanvas->buildEditorWindow();
36
37 fHisto = new TH1F("h1","title", 100, -5, 5);
38 fHisto->FillRandom("gaus", 10000);
39 fHisto->SetDirectory(nullptr);
40
41 fxQCanvas->getCanvas()->cd();
42 fHisto->Draw("colz");
43}
44
48
49
51{
52 QMessageBox::information(this,"QtRoot standalone example","Demo how QRootCanvas can be inserted into the QWidget");
53}
54
56{
57 fxQCanvas->toggleEditor();
58
59 // actiavte in ged some object
60 if (fxQCanvas->isEditorVisible()) {
61 fxQCanvas->activateEditor(fxQCanvas->getCanvas(), fHisto);
62 fxQCanvas->resizeEditor();
63 }
64}
65
66void ExampleWidget::resizeEvent(QResizeEvent * e)
67{
68 fxQCanvas->resizeEditor();
69}
70
72{
73 // when widget closed, application automatically exit
74 close();
75}
76
77
void resizeEvent(QResizeEvent *e) override
void InfoButton_clicked()
void ExitButton_clicked()
ExampleWidget(QWidget *parent=nullptr, const char *name=nullptr)
virtual ~ExampleWidget()
void EditorButton_clicked()