VAPOR3 3.9.4
VFileSelector.h
Go to the documentation of this file.
1#pragma once
2
3#include <string>
4#include <QWidget>
5#include <QFileDialog>
6
7#include "VHBoxWidget.h"
8
9class VPushButton;
11
18class VFileSelector : public VHBoxWidget {
19 Q_OBJECT
20
21public:
22 std::string GetValue() const;
23 bool SetValue(const std::string &file);
24
25 void HideLineEdit(bool hide);
26
27protected:
28 VFileSelector(const std::string &buttonText, const std::string &defaultPath, const std::string &filter);
29
32
33 std::string _filePath;
34 std::string _filter;
35
36private:
37 virtual std::string _launchFileDialog() = 0;
38 virtual bool _isFileOperable(const std::string &file) const = 0;
39
40public slots:
42 void SetPathFromLineEdit(const std::string &value);
43
44signals:
45 void ValueChanged(const std::string &path);
46};
47
52class VFileReader : public VFileSelector {
53 Q_OBJECT
54
55public:
56 VFileReader(const std::string &buttonText = "Select", const std::string &defaultPath = QDir::homePath().toStdString(), const std::string &filter = "");
57
58private:
59 virtual std::string _launchFileDialog();
60 virtual bool _isFileOperable(const std::string &file) const;
61};
62
67class VFileWriter : public VFileSelector {
68 Q_OBJECT
69
70public:
71 VFileWriter(const std::string &buttonText = "Select", const std::string &defaultPath = QDir::homePath().toStdString(), const std::string &filter = "");
72
73private:
74 virtual std::string _launchFileDialog();
75 virtual bool _isFileOperable(const std::string &file) const;
76};
77
83 Q_OBJECT
84
85public:
86 VDirSelector(const std::string &buttonText = "Select", const std::string &defaultPath = QDir::homePath().toStdString());
87
88private:
89 virtual std::string _launchFileDialog();
90 virtual bool _isFileOperable(const std::string &file) const;
91};
VDirSelector(const std::string &buttonText="Select", const std::string &defaultPath=QDir::homePath().toStdString())
VFileReader(const std::string &buttonText="Select", const std::string &defaultPath=QDir::homePath().toStdString(), const std::string &filter="")
VLineEdit_Deprecated * _lineEdit
Definition: VFileSelector.h:30
std::string _filePath
Definition: VFileSelector.h:33
std::string GetValue() const
void SetPathFromLineEdit(const std::string &value)
VPushButton * _pushButton
Definition: VFileSelector.h:31
std::string _filter
Definition: VFileSelector.h:34
bool SetValue(const std::string &file)
VFileSelector(const std::string &buttonText, const std::string &defaultPath, const std::string &filter)
void ValueChanged(const std::string &path)
void HideLineEdit(bool hide)
void OpenFileDialog()
VFileWriter(const std::string &buttonText="Select", const std::string &defaultPath=QDir::homePath().toStdString(), const std::string &filter="")