NorMIT-nav  22.09
An IGT application
cxMetricWidget.h
Go to the documentation of this file.
1 /*=========================================================================
2 This file is part of CustusX, an Image Guided Therapy Application.
3 
4 Copyright (c) SINTEF Department of Medical Technology.
5 All rights reserved.
6 
7 CustusX is released under a BSD 3-Clause license.
8 
9 See Lisence.txt (https://github.com/SINTEFMedtek/CustusX/blob/master/License.txt) for details.
10 =========================================================================*/
11 
12 /*
13  * cxMetricWidget.h
14  *
15  * \date Jul 5, 2011
16  * \author christiana
17  */
18 
19 #ifndef CXMETRICWIDGET_H_
20 #define CXMETRICWIDGET_H_
21 
22 #include "cxGuiExport.h"
23 
24 #include "cxBaseWidget.h"
25 
26 #include <vector>
27 #include <QtWidgets>
28 
29 #include "cxForwardDeclarations.h"
30 #include "cxLandmark.h"
31 #include "cxPointMetric.h"
32 #include "cxDistanceMetric.h"
33 #include "cxAngleMetric.h"
34 #include "cxPlaneMetric.h"
35 #include "cxStringProperty.h"
36 #include "cxVector3DProperty.h"
37 #include "cxDataMetricWrappers.h"
38 #include "cxFrameMetric.h"
39 
40 class QVBoxLayout;
41 class QTableWidget;
42 class QPushButton;
43 
49 class cxGui_EXPORT CXNoBorderToolButton : public QToolButton
50 {
51  Q_OBJECT
52 public:
53  CXNoBorderToolButton(QWidget* parent=0) : QToolButton(parent) {}
54 };
55 
56 namespace cx
57 {
58 typedef boost::shared_ptr<class MetricManager> MetricManagerPtr;
59 
60 
65 class cxGui_EXPORT MetricWidget : public BaseWidget
66 {
67  Q_OBJECT
68 
69 public:
70  MetricWidget(VisServicesPtr services, QWidget* parent);
71  virtual ~MetricWidget();
72 
73 signals:
74 
75  public slots:
76  virtual void setModified();
77 
78 protected slots:
79  void itemSelectionChanged();
80 
81  void removeButtonClickedSlot();
82 
83  void loadReferencePointsSlot();
84  void addPointButtonClickedSlot();
85  void addFrameButtonClickedSlot();
86  void addToolButtonClickedSlot();
87  void addPlaneButtonClickedSlot();
88  void addAngleButtonClickedSlot();
89  void addDistanceButtonClickedSlot();
90  void addROIButtonClickedSlot();
91  void addSphereButtonClickedSlot();
92  void addDonutButtonClickedSlot();
93  void addCustomButtonClickedSlot();
94 
95  void cellChangedSlot(int row, int col);
96  virtual void cellClickedSlot(int row, int column);
97  void exportMetricsButtonClickedSlot();
98  void importMetricsButtonClickedSlot();
99  void delayedUpdate();
100 
101 protected:
108 
109 private:
110  virtual void showEvent(QShowEvent* event);
111  virtual void hideEvent(QHideEvent* event);
112  void enablebuttons();
113  virtual void prePaintEvent();
114  std::set<QString> getSelectedUids();
115  void createActions(QActionGroup* group);
116  bool checkEqual(const std::vector<MetricBasePtr>& a, const std::vector<MetricBasePtr>& b) const;
117  void resetWrappersAndEditWidgets(std::vector<MetricBasePtr> wrappers);
118  void initializeTable();
119  void updateTableContents();
120  void expensizeColumnResize();
121  void updateMetricWrappers();
122 
123  QAction* createAction(QActionGroup* group, QString iconName, QString text, QString tip, const char* slot);
124 
125  QVBoxLayout* mVerticalLayout;
126  QTableWidget* mTable;
127 
128  std::vector<MetricBasePtr> mMetrics;
129 
130  QAction* mRemoveAction;
131  QAction* mLoadReferencePointsAction;
132  QStackedWidget* mEditWidgets;
133  MetricManagerPtr mMetricManager;
134  int mModifiedCount;
135  int mPaintCount;
136  QTimer* mDelayedUpdateTimer;
137  bool mLocalModified;
138 };
139 
140 }//end namespace cx
141 
142 #endif /* CXMETRICWIDGET_H_ */
cx::MetricManagerPtr
boost::shared_ptr< class MetricManager > MetricManagerPtr
Definition: cxMetricManager.h:27
cxBaseWidget.h
cx
Namespace for all CustusX production code.
Definition: cx_dev_group_definitions.h:13
cxFrameMetric.h
cx::BaseWidget
Interface for QWidget which handles widgets uniformly for the system.
Definition: cxBaseWidget.h:88
cxForwardDeclarations.h
cx::VisServicesPtr
boost::shared_ptr< class VisServices > VisServicesPtr
Definition: cxMainWindow.h:40
cxDistanceMetric.h
cxPlaneMetric.h
cx::MetricWidget
Definition: cxMetricWidget.h:65
CXNoBorderToolButton
Definition: cxMetricWidget.h:49
cx::MetricWidget::mServices
VisServicesPtr mServices
Definition: cxMetricWidget.h:107
cx::MetricWidget::mImportFramesAction
QAction * mImportFramesAction
Definition: cxMetricWidget.h:106
cxPointMetric.h
cxVector3DProperty.h
cx::MetricWidget::mExportFramesAction
QAction * mExportFramesAction
Definition: cxMetricWidget.h:105
cxAngleMetric.h
cxStringProperty.h
cxDataMetricWrappers.h
cx::MetricWidget::mFrameMetricAction
QAction * mFrameMetricAction
Definition: cxMetricWidget.h:103
cx::MetricWidget::mToolMetricAction
QAction * mToolMetricAction
Definition: cxMetricWidget.h:104
CXNoBorderToolButton::CXNoBorderToolButton
CXNoBorderToolButton(QWidget *parent=0)
Definition: cxMetricWidget.h:53
cx::MetricWidget::mPointMetricAction
QAction * mPointMetricAction
Definition: cxMetricWidget.h:102
cxLandmark.h