OpenTwin 0.1
OpenTwin
 
Loading...
Searching...
No Matches
FilePathEdit.h
Go to the documentation of this file.
1
4// ###########################################################################################################################################################################################################################################################################################################################
5
6#pragma once
7
8// OpenTwin header
12
13// Qt header
14#include <QtCore/qobject.h>
15
16class QWidget;
17
18namespace ot {
19
20 class LineEdit;
21 class PushButton;
22
23 class OT_WIDGETS_API_EXPORT FilePathEdit : public QObject, public QWidgetInterface {
24 Q_OBJECT
27 public:
28 enum FileMode {
30 SaveFileMode
31 };
32
33 FilePathEdit(FileMode _mode, QWidget* _parent = (QWidget*)nullptr);
34 FilePathEdit(const QString& _filePath, FileMode _mode, QWidget* _parent = (QWidget*)nullptr);
35 virtual ~FilePathEdit();
36
37 virtual QWidget* getQWidget(void) override { return m_root; };
38 virtual const QWidget* getQWidget(void) const override { return m_root; };
39
40 void setFilePath(const QString& _file);
41 const QString& getFilePath(void) const { return m_file; };
42
43 void setBrowseTitle(const QString& _title) { m_browseTitle = _title; };
44 const QString& getBrowseTitle(void) const { return m_browseTitle; };
45
46 void setFileFilter(const QString& _filter) { m_fileFilter = _filter; };
47 const QString& getFileFilter(void) const { return m_fileFilter; };
48
49 LineEdit* getLineEdit(void) { return m_edit; };
50 PushButton* getPushButton(void) { return m_button; };
51
52 Q_SIGNALS:
53 void fileChanged(void);
54
55 public Q_SLOTS:
56 void slotBrowse(void);
57
58 private Q_SLOTS:
59 void slotEditChanged(void);
60
61 private:
62 void ini(QWidget* _parent);
63
64 QString m_file;
65
66 FileMode m_mode;
67 QWidget* m_root;
68 LineEdit* m_edit;
69 PushButton* m_button;
70
71 QString m_browseTitle;
72 QString m_fileFilter;
73 };
74
75}
This file contains defines that may be used simplyfy class creation.
#define OT_DECL_NODEFAULT(___class)
Removes the default copy constructor and assignment operator.
Definition OTClassHelper.h:22
#define OT_DECL_NOCOPY(___class)
Removes the default copy constructor and assignment operator.
Definition OTClassHelper.h:14
#define OT_WIDGETS_API_EXPORT
Definition OTWidgetsAPIExport.h:12
Definition FilePathEdit.h:23
void setBrowseTitle(const QString &_title)
Definition FilePathEdit.h:43
PushButton * getPushButton(void)
Definition FilePathEdit.h:50
const QString & getFileFilter(void) const
Definition FilePathEdit.h:47
void fileChanged(void)
const QString & getFilePath(void) const
Definition FilePathEdit.h:41
FileMode
Definition FilePathEdit.h:28
@ OpenFileMode
Definition FilePathEdit.h:29
const QString & getBrowseTitle(void) const
Definition FilePathEdit.h:44
void setFileFilter(const QString &_filter)
Definition FilePathEdit.h:46
LineEdit * getLineEdit(void)
Definition FilePathEdit.h:49
virtual QWidget * getQWidget(void) override
Returns a pointer to the root widget of this object.
Definition FilePathEdit.h:37
virtual const QWidget * getQWidget(void) const override
Definition FilePathEdit.h:38
Definition LineEdit.h:17
Definition PushButton.h:17
Definition QWidgetInterface.h:18
Definition Connector.h:8