Fraxinus  2023.01.05-dev+develop.0da12
An IGT application
cxFileSelectWidget.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 /*
14  * sscFileSelectWidget.h
15  *
16  * Created on: May 6, 2011
17  * Author: christiana
18  */
19 
20 #ifndef CXFILESELECTWIDGET_H_
21 #define CXFILESELECTWIDGET_H_
22 
23 #include "cxResourceWidgetsExport.h"
24 
25 #include <QWidget>
26 #include <QStringList>
27 
28 class QComboBox;
29 class QToolButton;
30 class QAction;
31 
32 namespace cx
33 {
34 
45 class cxResourceWidgets_EXPORT FileSelectWidget: public QWidget
46 {
47 Q_OBJECT
48 
49 public:
50  FileSelectWidget(QWidget* parent);
51  QString getFilename() const;
52  void setFilename(QString name);
53  void setNameFilter(QStringList filter);
54  void setPaths(QStringList paths);
55  void setPath(QString path);
56  void setFolderDepth(int depth);
57 
58  QStringList getAllFiles();
59 
60 public slots:
61  void refresh();
62 
63 signals:
64  void fileSelected(QString name);
65 
66 private slots:
67  void selectData();
68  void currentDataComboIndexChanged(int);
69  void updateComboBox();
70 
71 private:
72  QStringList getAllFiles(QString folder, int depth = 5);
73 
74  QComboBox* mDataComboBox;
75  QToolButton* mSelectDataButton;
76  QAction* mSelectDataAction;
77 
78  QString mFilename;
79  QStringList mRootPaths;
80  QStringList mNameFilters;
81  int mFolderDepth;
82 };
83 
84 }
85 
86 #endif /* CXFILESELECTWIDGET_H_ */
Widget for displaying and selecting a single file.
Namespace for all CustusX production code.