Scanframe Modular Application 0.1.0
Loading...
Searching...
No Matches
LayoutEditor.h
Go to the documentation of this file.
1#pragma once
2#include <QDir>
3#include <QMenu>
4#include <QScrollArea>
5#include <QSettings>
6#include <QWidget>
9
10namespace sf
11{
12
14 : public QWidget
15 , public MultiDocInterface
16{
17 Q_OBJECT
18
19 public:
20 explicit LayoutEditor(QWidget* parent);
21
22 void newFile() override;
23
24 bool loadFile(const QString& fileName) override;
25
26 bool save() override;
27
28 bool saveAs() override;
29
30 bool saveFile(const QString& fileName, bool keep_name = false);
31
32 [[nodiscard]] bool isModified() const override;
33
34 [[nodiscard]] QString userFriendlyCurrentFile() const override;
35
36 [[nodiscard]] QString currentFile() const override;
37
38 [[nodiscard]] bool hasSelection() const override;
39
40 [[nodiscard]] bool isUndoRedoEnabled() const override;
41
42 [[nodiscard]] bool isUndoAvailable() const override;
43
44 [[nodiscard]] bool isRedoAvailable() const override;
45
46 void cut() override;
47
48 void copy() override;
49
50 void paste() override;
51
52 void undo() override;
53
54 void redo() override;
55
56 void develop() override;
57
58 bool eventFilter(QObject* watched, QEvent* event) override;
59
61
62 [[nodiscard]] QDir getDirectory() const;
63
64 void popupContextMenu(QObject* target, const QPoint& pos);
65
66 void openPropertyEditor(QObject* target);
67
68 void setReadOnly(bool readOnly);
69
70 public Q_SLOTS:
71
76
81
82 public:
83 // ReSharper disable once CppFunctionIsNotImplemented
84 Q_SIGNAL void objectSelected(QObject* obj);
85
86 protected:
87 void closeEvent(QCloseEvent* event) override;
88
89 void resizeEvent(QResizeEvent* event) override;
90
91 private:
92 struct Data;
93 Data* _layoutEditorData;
94
95 void setCurrentFile(const QString& fileName);
96
97 [[nodiscard]] QString strippedName(const QString& fullFileName) const;
98
99 QString _curFile;
100 bool _isUntitled;
101 QScrollArea* _scrollArea{nullptr};
102 QWidget* _widget{nullptr};
103 QString _rootName;
104 bool _modified{false};
105 QObject* _currentTarget{nullptr};
106 QMenu* _targetContextMenu{nullptr};
107 ObjectHierarchyModel* _model{nullptr};
108 QAction* _actionEdit{nullptr};
109};
110
111}// namespace sf
Definition LayoutEditor.h:16
QString currentFile() const override
Pure virtual needs to be implemented.
void resizeEvent(QResizeEvent *event) override
bool saveFile(const QString &fileName, bool keep_name=false)
void setReadOnly(bool readOnly)
void documentModified()
Sets the modified flag and calls documentWasModified().
bool isUndoAvailable() const override
Pure virtual needs to be implemented.
bool isRedoAvailable() const override
Pure virtual needs to be implemented.
bool hasSelection() const override
Pure virtual needs to be implemented.
void undo() override
Pure virtual needs to be implemented.
void copy() override
Pure virtual needs to be implemented.
Q_SIGNAL void objectSelected(QObject *obj)
void popupContextMenu(QObject *target, const QPoint &pos)
LayoutEditor(QWidget *parent)
void newFile() override
Pure virtual needs to be implemented.
bool eventFilter(QObject *watched, QEvent *event) override
void openPropertyEditor(QObject *target)
void develop() override
Virtual function which is called during development only fro an action.
QString userFriendlyCurrentFile() const override
Pure virtual needs to be implemented.
bool isUndoRedoEnabled() const override
Pure virtual needs to be implemented.
bool saveAs() override
Pure virtual needs to be implemented.
void documentWasModified()
Send MDI signals on modification of the document.
void closeEvent(QCloseEvent *event) override
void cut() override
Pure virtual needs to be implemented.
void paste() override
Pure virtual needs to be implemented.
void redo() override
Pure virtual needs to be implemented.
bool loadFile(const QString &fileName) override
Pure virtual needs to be implemented.
bool save() override
Pure virtual needs to be implemented.
ObjectHierarchyModel * getHierarchyModel()
QDir getDirectory() const
bool isModified() const override
Pure virtual needs to be implemented.
Interface for MDI document widgets handling files.
Definition MultiDocInterface.h:41
Item model for viewing Variables in a tree view.
Definition ObjectHierarchyModel.h:14
Definition Application.h:10