GSI Object Oriented Online Offline (Go4)  GO4-5.3.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
QFitWidget.cpp
Go to the documentation of this file.
1 // $Id: QFitWidget.cpp 1149 2014-01-29 17:00:48Z linev $
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 für 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 "QFitWidget.h"
15 
16 #include <QContextMenuEvent>
17 #include <QCloseEvent>
18 #include <QtCore/QSignalMapper>
19 #include <QMenu>
20 
21 #include "QFitItem.h"
22 
23 #include "TObject.h"
24 #include "TGo4FitPanel.h"
25 
26 QFitWidget::QFitWidget( QWidget* parent, const char* name, Qt::WindowFlags fl ) :
27  QWidget( parent, fl )
28 {
29  setObjectName(name ? name : "QFitWidget");
30  resize( QSize(533, 405).expandedTo(minimumSizeHint()) );
31 
32  fxPanel = 0;
33  fxItem = 0;
34  fbFillWidget = false;
35 }
36 
38 {
39 }
40 
42 {
43  fxPanel = panel;
44  fxItem = item;
45  FillWidget();
46 }
47 
49 {
50  return fxItem;
51 }
52 
54 {
55  if(GetItem()) return GetItem()->Object();
56  else return 0;
57 }
58 
60 {
61  return fxPanel==0 ? 0 : fxPanel->GetFitter();
62 }
63 
65 {
66  fbFillWidget = true;
68  fbFillWidget = false;
69 }
70 
72 {
73 }
74 
75 void QFitWidget::contextMenuEvent(QContextMenuEvent* ev)
76 {
77  if ((GetItem()==0) || (fxPanel==0)) return;
78 
79  QSignalMapper map(this);
80  connect(&map, SIGNAL(mapped(int)), fxPanel, SLOT(ItemMenuItemSelected(int)));
81 
82  QMenu menu(this);
83 
84  if (fxPanel->FillPopupForItem(GetItem(),&menu, &map)) {
86  menu.exec(ev->globalPos());
87  fxPanel->CurrFitItem = 0;
88  }
89 }
90 
92 {
93  if (fxPanel!=0)
94  fxPanel->UpdateItem(GetItem(), trace);
95 }
96 
98 {
99  if (fxPanel!=0)
100  fxPanel->SetItemText(GetItem(), trace);
101 }
102 
103 void QFitWidget::UpdateItemsOfType(int typ, bool allitems)
104 {
105  if (fxPanel!=0)
106  fxPanel->UpdateItemsOfType(typ, allitems ? 0 : GetItem());
107 }
virtual void FillSpecificData()
Definition: QFitWidget.cpp:71
QFitWidget(QWidget *parent=0, const char *name=0, Qt::WindowFlags fl=0)
Definition: QFitWidget.cpp:26
virtual void SetItem(TGo4FitPanel *panel, QFitItem *iItem)
Definition: QFitWidget.cpp:41
TObject * Object() const
Definition: QFitItem.h:27
virtual bool FillPopupForItem(QFitItem *item, QMenu *menu, QSignalMapper *map)
QFitItem * fxItem
Definition: QFitWidget.h:63
virtual void SetItemText(QFitItem *item, bool trace)
virtual void UpdateItemsOfType(int typ, QFitItem *parent)
virtual TGo4Fitter * GetFitter()
bool fbFillWidget
Definition: QFitWidget.h:64
virtual void SetWidgetItemText(bool trace)
Definition: QFitWidget.cpp:97
virtual void FillWidget()
Definition: QFitWidget.cpp:64
virtual void contextMenuEvent(QContextMenuEvent *e)
Definition: QFitWidget.cpp:75
virtual void UpdateItem(QFitItem *item, bool trace)
virtual TObject * GetObject()
Definition: QFitWidget.cpp:53
QFitItem * CurrFitItem
Definition: TGo4FitPanel.h:338
virtual QFitItem * GetItem()
Definition: QFitWidget.cpp:48
virtual TGo4Fitter * GetFitter()
Definition: QFitWidget.cpp:59
virtual void UpdateItemsOfType(int typ, bool allitems)
Definition: QFitWidget.cpp:103
TGo4FitPanel * fxPanel
Definition: QFitWidget.h:62
virtual void UpdateWidgetItem(bool trace)
Definition: QFitWidget.cpp:91