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