-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFileChooser.h
More file actions
44 lines (37 loc) · 815 Bytes
/
FileChooser.h
File metadata and controls
44 lines (37 loc) · 815 Bytes
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
#ifndef FILECHOOSER_H
#define FILECHOOSER_H
#include "cppGUI_global.h"
#include <QWidget>
#include <QContextMenuEvent>
#include <QLineEdit>
#include <QPushButton>
///A file selector for loading/storing with drag-and-drop support.
class CPPGUISHARED_EXPORT FileChooser
: public QWidget
{
Q_OBJECT
public:
///The type.
enum Type
{
LOAD,
STORE
};
///Constructor.
FileChooser(Type type, QWidget* parent = 0);
///Returns the selected file.
QString file();
///Sets the selected file.
void setFile(QString file);
protected:
virtual void dragEnterEvent(QDragEnterEvent* e);
virtual void dropEvent(QDropEvent* e);
protected slots:
void browseFile();
virtual void contextMenuEvent(QContextMenuEvent* e);
private:
QLineEdit* text_;
QPushButton* button_;
Type type_;
};
#endif // FILECHOOSER_H