SWMMVis  6.0.0-alpha.4
Qt6/C++ GIS-based graphical user interface for the SWMMVis engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
rulecodeeditor.h
Go to the documentation of this file.
1
23#ifndef OPENSWMMVIS_UI_WIDGETS_RULECODEEDITOR_H
24#define OPENSWMMVIS_UI_WIDGETS_RULECODEEDITOR_H
25
26#include <QPointer>
27#include <QTextEdit>
28
29class QCompleter;
30class QStringListModel;
31class SWMMModelLayer;
32
33namespace openswmmvis::controls { class RuleSyntaxHighlighter; }
34
35namespace openswmmvis::ui {
36
37class RuleCodeEditor : public QTextEdit
38{
39 Q_OBJECT
40
41public:
42 explicit RuleCodeEditor(QWidget *parent = nullptr);
43 ~RuleCodeEditor() override;
44
47 void setModelLayer(SWMMModelLayer *layer);
48
50 { return m_highlighter; }
51
52 QCompleter *completer() const noexcept { return m_completer; }
53
54protected:
55 void keyPressEvent(QKeyEvent *e) override;
56 void focusInEvent(QFocusEvent *e) override;
57
58private slots:
59 void insertCompletion_(const QString &completion);
60
61private:
65 QString textUnderCursor_() const;
66
70 void rebuildCompletions_();
71
73 void showCompleter_(const QString &prefix);
74
75 QPointer<SWMMModelLayer> m_layer;
76 openswmmvis::controls::RuleSyntaxHighlighter *m_highlighter = nullptr;
77 QCompleter *m_completer = nullptr;
78 QStringListModel *m_complModel = nullptr;
79};
80
81} // namespace openswmmvis::ui
82
83#endif // OPENSWMMVIS_UI_WIDGETS_RULECODEEDITOR_H
Renders the SWMM network elements (nodes, links, subcatchments, rain gages) for one OpenSWMMEngine mo...
Definition swmmmodellayer.h:133
Definition rulesyntaxhighlighter.h:46
Definition rulecodeeditor.h:38
QCompleter * completer() const noexcept
Definition rulecodeeditor.h:52
void keyPressEvent(QKeyEvent *e) override
Definition rulecodeeditor.cpp:116
void focusInEvent(QFocusEvent *e) override
Definition rulecodeeditor.cpp:58
void setModelLayer(SWMMModelLayer *layer)
Bind a model layer so the completer can resolve live node / link / subcatchment names....
Definition rulecodeeditor.cpp:52
openswmmvis::controls::RuleSyntaxHighlighter * highlighter() const noexcept
Definition rulecodeeditor.h:49
int e
Definition inpmeshreader.cpp:41
Definition controlruleprovider.h:34
Definition openswmmvislayer.h:43
QVector< int > parent
union-find
Definition pslgminsize.cpp:176