CTK  0.1.0
The Common Toolkit is a community effort to provide support code for medical image analysis, surgical navigation, and related projects.
ctkFileDialog.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Library: CTK
4 
5  Copyright (c) Kitware Inc.
6 
7  Licensed under the Apache License, Version 2.0 (the "License");
8  you may not use this file except in compliance with the License.
9  You may obtain a copy of the License at
10 
11  http://www.apache.org/licenses/LICENSE-2.0.txt
12 
13  Unless required by applicable law or agreed to in writing, software
14  distributed under the License is distributed on an "AS IS" BASIS,
15  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  See the License for the specific language governing permissions and
17  limitations under the License.
18 
19 =========================================================================*/
20 
21 #ifndef __ctkFileDialog_h
22 #define __ctkFileDialog_h
23 
24 // Qt includes
25 #include <QAbstractItemView>
26 #include <QFileDialog>
27 
28 // CTK includes
29 #include <ctkPimpl.h>
30 #include "ctkWidgetsExport.h"
31 
32 class ctkFileDialogPrivate;
33 
42 class CTK_WIDGETS_EXPORT ctkFileDialog : public QFileDialog
43 {
44  Q_OBJECT
45  Q_PROPERTY(QAbstractItemView::SelectionMode SelectionMode READ selectionMode WRITE setSelectionMode)
46 
47 public:
48  // Superclass typedef
49  typedef QFileDialog Superclass;
53  explicit ctkFileDialog(QWidget *parent = 0,
54  const QString &caption = QString(),
55  const QString &directory = QString(),
56  const QString &filter = QString());
57  virtual ~ctkFileDialog();
58 
62  Q_INVOKABLE void setBottomWidget(QWidget* widget, const QString& label=QString());
63 
65  Q_INVOKABLE QWidget* bottomWidget()const;
66 
75  void setSelectionMode(QAbstractItemView::SelectionMode mode);
76 
80  QAbstractItemView::SelectionMode selectionMode() const;
81 
83  bool eventFilter(QObject *obj, QEvent *event);
84 
85 public Q_SLOTS:
89  void setAcceptButtonEnable(bool enable);
90 
93 
94 Q_SIGNALS:
98  void fileSelectionChanged(const QStringList& selected);
99 
100 protected Q_SLOTS:
102 
103 protected:
104  QScopedPointer<ctkFileDialogPrivate> d_ptr;
105 
107  virtual void accept();
108 
109 private:
110  Q_DECLARE_PRIVATE(ctkFileDialog);
111  Q_DISABLE_COPY(ctkFileDialog);
112 };
113 
114 #endif
void onSelectionChanged()
virtual void accept()
Reimplemented to override the return key behavior.
ctkFileDialog(QWidget *parent=0, const QString &caption=QString(), const QString &directory=QString(), const QString &filter=QString())
Q_INVOKABLE void setBottomWidget(QWidget *widget, const QString &label=QString())
QAbstractItemView::SelectionMode selectionMode() const
void clearSelection()
Deselect all selected directories or files.
Q_INVOKABLE QWidget * bottomWidget() const
Return the extra widget if any.
void fileSelectionChanged(const QStringList &selected)
QScopedPointer< ctkFileDialogPrivate > d_ptr
void setSelectionMode(QAbstractItemView::SelectionMode mode)
bool eventFilter(QObject *obj, QEvent *event)
Internally used.
void setAcceptButtonEnable(bool enable)
QFileDialog Superclass
Definition: ctkFileDialog.h:49
virtual ~ctkFileDialog()