Line | |
---|
1 |
|
---|
2 | #ifndef QTFILECHOOSER
|
---|
3 | #define QTFILECHOOSER
|
---|
4 |
|
---|
5 | #include <QtGui>
|
---|
6 |
|
---|
7 | class qtFileChooser : public QWidget {
|
---|
8 | Q_OBJECT
|
---|
9 |
|
---|
10 | Q_ENUMS( Mode )
|
---|
11 | Q_PROPERTY( Mode mode READ mode WRITE setMode )
|
---|
12 | Q_PROPERTY( QString fileName READ fileName WRITE setFileName )
|
---|
13 |
|
---|
14 | public:
|
---|
15 | enum Mode {File, Files, Directory};
|
---|
16 |
|
---|
17 | qtFileChooser(QWidget* parent = 0, qtFileChooser::Mode mode = File);
|
---|
18 | ~qtFileChooser();
|
---|
19 |
|
---|
20 | QString fileName() const;
|
---|
21 | Mode mode() const {return _mode;}
|
---|
22 |
|
---|
23 | public slots:
|
---|
24 | void setFileName(const QString& fileName);
|
---|
25 | void setMode(Mode mode) {_mode = mode;}
|
---|
26 |
|
---|
27 | signals:
|
---|
28 | void fileNameChanged(const QString&);
|
---|
29 |
|
---|
30 | private slots:
|
---|
31 | void chooseFile();
|
---|
32 |
|
---|
33 | private:
|
---|
34 | QLineEdit* _lineEdit;
|
---|
35 | QPushButton* _button;
|
---|
36 | Mode _mode;
|
---|
37 |
|
---|
38 | };
|
---|
39 | #endif
|
---|
Note:
See
TracBrowser
for help on using the repository browser.