summaryrefslogtreecommitdiffstats
path: root/tools/designer/examples/filechooser/widget/filechooser.h
blob: 23272c0bf7ee9b7d093ae6fc3c65bd63ed7f8f72 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#ifndef FILECHOOSER_H
#define FILECHOOSER_H

#include <qwidget.h>
#include <qwidgetplugin.h>

class QLineEdit;
class QPushButton;

#ifdef FILECHOOSER_IS_WIDGET
#undef QT_WIDGET_PLUGIN_EXPORT
#define QT_WIDGET_PLUGIN_EXPORT
#endif

class QT_WIDGET_PLUGIN_EXPORT FileChooser : public QWidget
{
    Q_OBJECT

    Q_ENUMS( Mode )
    Q_PROPERTY( Mode mode READ mode WRITE setMode )
    Q_PROPERTY( QString fileName READ fileName WRITE setFileName )

public:
    FileChooser( QWidget *parent = 0, const char *name = 0);

    enum Mode { File, Directory };

    QString fileName() const;
    Mode mode() const;

public slots:
    void setFileName( const QString &fn );
    void setMode( Mode m );

signals:
    void fileNameChanged( const QString & );

private slots:
    void chooseFile();

private:
    QLineEdit *lineEdit;
    QPushButton *button;
    Mode md;

};

#endif