Geometrize  1.0
An application for geometrizing images into geometric primitives
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Macros
scripteditorwidget.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <memory>
4 
5 #include <QGroupBox>
6 #include <QString>
7 
8 class QEvent;
9 
10 namespace geometrize
11 {
12 
13 namespace dialog
14 {
15 
19 class ScriptEditorWidget : public QGroupBox
20 {
21  Q_OBJECT
22 
23 public:
24  ScriptEditorWidget(QObject* parent);
25  ScriptEditorWidget(const std::string& title, const std::string& functionName, const std::string& defaultCode, QWidget* parent = nullptr);
26  virtual ~ScriptEditorWidget();
27 
28  std::string getFunctionName() const;
29  std::string getDefaultCode() const;
30  std::string getCurrentCode() const;
31  void setCurrentCode(const std::string& code);
32 
33  void resetCodeToDefault();
34 
36  void onScriptEvaluationFailed(const std::string& errorMessage);
37 
38 signals:
45  void signal_scriptChanged(ScriptEditorWidget* self, const std::string& functionName, const std::string& code);
46 
53  void signal_scriptReset(ScriptEditorWidget* self, const std::string& functionName, const std::string& code);
54 
55 protected:
56  void changeEvent(QEvent*) override;
57 
58 private:
60  std::unique_ptr<ScriptEditorWidgetImpl> d;
61 };
62 
63 }
64 
65 }
std::unique_ptr< ScriptEditorWidgetImpl > d
Definition: scripteditorwidget.h:59
void resetCodeToDefault()
Definition: scripteditorwidget.cpp:185
void signal_scriptChanged(ScriptEditorWidget *self, const std::string &functionName, const std::string &code)
signal_scriptChanged Signal emitted when the user change the script code of a function.
std::string getDefaultCode() const
Definition: scripteditorwidget.cpp:195
virtual ~ScriptEditorWidget()
Definition: scripteditorwidget.cpp:173
std::string getFunctionName() const
Definition: scripteditorwidget.cpp:190
The ScriptEditorWidget class implements a widget for interactively editing a Chaiscript function...
Definition: scripteditorwidget.h:19
void setCurrentCode(const std::string &code)
Definition: scripteditorwidget.cpp:205
void onScriptEvaluationFailed(const std::string &errorMessage)
Definition: scripteditorwidget.cpp:215
std::string getCurrentCode() const
Definition: scripteditorwidget.cpp:200
void changeEvent(QEvent *) override
Definition: scripteditorwidget.cpp:177
void onScriptEvaluationSucceeded()
Definition: scripteditorwidget.cpp:210
void signal_scriptReset(ScriptEditorWidget *self, const std::string &functionName, const std::string &code)
signal_scriptReset Signal emitted when the user hits the reset button, expecting the script to be res...