CustusX  15.8
An IGT application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
cxDataViewSelectionWidget.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) 2008-2014, SINTEF Department of Medical Technology
5 All rights reserved.
6 
7 Redistribution and use in source and binary forms, with or without
8 modification, are permitted provided that the following conditions are met:
9 
10 1. Redistributions of source code must retain the above copyright notice,
11  this list of conditions and the following disclaimer.
12 
13 2. Redistributions in binary form must reproduce the above copyright notice,
14  this list of conditions and the following disclaimer in the documentation
15  and/or other materials provided with the distribution.
16 
17 3. Neither the name of the copyright holder nor the names of its contributors
18  may be used to endorse or promote products derived from this software
19  without specific prior written permission.
20 
21 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
25 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 =========================================================================*/
32 #ifndef CXDATAVIEWSELECTIONWIDGET_H_
33 #define CXDATAVIEWSELECTIONWIDGET_H_
34 
35 #include "cxGuiExport.h"
36 
37 #include <QListWidget>
38 #include "cxForwardDeclarations.h"
39 class QLabel;
40 
41 namespace cx
42 {
52 class cxGui_EXPORT DataListWidget : public QListWidget
53 {
54  Q_OBJECT
55 
56 public:
57  DataListWidget(QWidget* parent = NULL);
58  virtual ~DataListWidget();
59  virtual QSize sizeHint() const;
60 
61 signals:
62  void userChangedList();
63  void listSizeChanged();
64 
65 protected:
66  void populate(QStringList dataUids);
67  void populateData(QString uid, bool indent=false, QListWidgetItem* after = NULL);
68 
69 private slots:
70  void itemSelectionChangedSlot();
71 };
72 
73 //---------------------------------------------------------------------------------------------------------------------
74 
75 class cxGui_EXPORT AllDataListWidget : public DataListWidget
76 {
77  Q_OBJECT
78 
79 public:
80  AllDataListWidget(QWidget* parent = NULL);
81  virtual ~AllDataListWidget();
82 
83 protected:
84  void mousePressEvent(QMouseEvent *event);
85  void mouseMoveEvent(QMouseEvent *event);
86 
87 private slots:
88  void populateAllDataList();
89 
90 private:
91  QPoint startPos;
92 };
93 
94 //---------------------------------------------------------------------------------------------------------------------
95 
96 class cxGui_EXPORT SelectedDataListWidget : public DataListWidget
97 {
98  Q_OBJECT
99 
100 public:
101  SelectedDataListWidget(QWidget* parent = NULL);
102  virtual ~SelectedDataListWidget();
103  void setViewGroupData(ViewGroupDataPtr viewGroupData);
104 
105  virtual void dropEvent(QDropEvent* event);
106  QStringList getData();
107 
108 public slots:
109  void populateList();
110  void userChangedListSlot();
111 
112 private slots:
113  void deleteSlot();
114  void deleteItemSlot(QListWidgetItem* item);
115  void contextMenuSlot(const QPoint & point);
116  void keyPressEvent(QKeyEvent* event);
117 
118 protected:
119  QMap<int, QVariant> convertFromCustomQtMimeFormat(const QMimeData* mimeData) const;
120 
121 private:
122  QListWidgetItem* mItemToDelete;
123  ViewGroupDataPtr mViewGroupData;
124  QPoint startPos;
125 };
126 
131 class cxGui_EXPORT DataViewSelectionWidget : public QWidget
132 {
133  Q_OBJECT
134 public:
135  DataViewSelectionWidget(QWidget* parent = NULL);
136  virtual ~DataViewSelectionWidget();
137 
138 private slots:
139  void viewGroupChangedSlot();
140 
141 private:
142  SelectedDataListWidget* mSelectedDataListWidget;
143  AllDataListWidget* mAllDataListWidget;
144  QLabel* mVisibleLabel;
145 };
146 
150 }
151 
152 #endif /* CXDATAVIEWSELECTIONWIDGET_H_ */
boost::shared_ptr< class ViewGroupData > ViewGroupDataPtr
Definition: cxViewGroup.h:50