PythonWidgetState
PythonWidgetState
#include <PythonWidgetState.hpp>
Inherits from EditorState, QObject
Public Signals
| Name | |
|---|---|
| void | lastScriptPathChanged(QString const & path) |
| void | autoScrollChanged(bool enabled) |
| void | fontSizeChanged(int size) |
| void | showLineNumbersChanged(bool show) |
| void | scriptArgumentsChanged(QString const & args) |
| void | preludeChanged(QString const & prelude) |
| void | preludeEnabledChanged(bool enabled) |
| void | workingDirectoryChanged(QString const & dir) |
| void | venvPathChanged(QString const & path) |
Public Functions
| Name | |
|---|---|
| PythonWidgetState(QObject * parent =[nullptr]) | |
| ~PythonWidgetState() override =default | |
| virtual QString | getTypeName() const override Get unique type name for this editor state. |
| virtual QString | getDisplayName() const override Get display name for UI. |
| virtual void | setDisplayName(QString const & name) override Set display name. |
| virtual std::string | toJson() const override Serialize state to JSON string. |
| virtual bool | fromJson(std::string const & json) override Restore state from JSON string. |
| PythonWidgetStateData const & | data() const |
| QString | lastScriptPath() const |
| void | setLastScriptPath(QString const & path) |
| bool | autoScroll() const |
| void | setAutoScroll(bool enabled) |
| int | fontSize() const |
| void | setFontSize(int size) |
| std::vector< QString > | commandHistory() const |
| void | setCommandHistory(std::vector< QString > const & history) |
| std::vector< QString > | recentScripts() const |
| void | addRecentScript(QString const & path) |
| bool | showLineNumbers() const |
| void | setShowLineNumbers(bool show) |
| QString | editorContent() const |
| void | setEditorContent(QString const & content) |
| QString | scriptArguments() const |
| void | setScriptArguments(QString const & args) |
| QString | autoImportPrelude() const |
| void | setAutoImportPrelude(QString const & prelude) |
| bool | preludeEnabled() const |
| void | setPreludeEnabled(bool enabled) |
| QString | lastWorkingDirectory() const |
| void | setLastWorkingDirectory(QString const & dir) |
| QString | venvPath() const |
| void | setVenvPath(QString const & path) |
Additional inherited members
Public Signals inherited from EditorState
| Name | |
|---|---|
| void | stateChanged() Emitted when any state property changes. |
| void | displayNameChanged(QString const & newName) Emitted when display name changes. |
| void | dirtyChanged(bool isDirty) Emitted when dirty state changes. |
Public Functions inherited from EditorState
| Name | |
|---|---|
| EditorState(QObject * parent =[nullptr]) Construct a new EditorState. |
|
| ~EditorState() override =default Virtual destructor. |
|
| QString | getInstanceId() const Get unique instance ID. |
| bool | isDirty() const Check if state has unsaved changes. |
| void | markClean() Mark state as clean (after save). |
Protected Functions inherited from EditorState
| Name | |
|---|---|
| void | markDirty() Mark state as modified. |
| void | setInstanceId(QString const & id) Set instance ID (for deserialization). |
| QString | generateInstanceId() Generate a new unique instance ID. |
Public Signals Documentation
signal lastScriptPathChanged
void lastScriptPathChanged(
QString const & path
)signal autoScrollChanged
void autoScrollChanged(
bool enabled
)signal fontSizeChanged
void fontSizeChanged(
int size
)signal showLineNumbersChanged
void showLineNumbersChanged(
bool show
)signal scriptArgumentsChanged
void scriptArgumentsChanged(
QString const & args
)signal preludeChanged
void preludeChanged(
QString const & prelude
)signal preludeEnabledChanged
void preludeEnabledChanged(
bool enabled
)signal workingDirectoryChanged
void workingDirectoryChanged(
QString const & dir
)signal venvPathChanged
void venvPathChanged(
QString const & path
)Public Functions Documentation
function PythonWidgetState
explicit PythonWidgetState(
QObject * parent =nullptr
)function ~PythonWidgetState
~PythonWidgetState() override =defaultfunction getTypeName
inline virtual QString getTypeName() const overrideGet unique type name for this editor state.
Return: Type name, e.g., “MediaWidget”, “DataViewerWidget”
Reimplements: EditorState::getTypeName
This is used for:
- Factory registration
- Serialization type field
- Properties panel routing
function getDisplayName
virtual QString getDisplayName() const overrideGet display name for UI.
Return: Display name, e.g., “Media Viewer 1”
Reimplements: EditorState::getDisplayName
This is the user-visible name shown in tabs, window titles, etc. It may be customized by the user.
function setDisplayName
virtual void setDisplayName(
QString const & name
) overrideSet display name.
Parameters:
- name New display name
Reimplements: EditorState::setDisplayName
function toJson
virtual std::string toJson() const overrideSerialize state to JSON string.
Return: JSON string representation of state
Reimplements: EditorState::toJson
Subclasses should use reflect-cpp for serialization: ```cpp
std::string toJson() const override { return rfl::json::write(_data); }
### function fromJson
```cpp
virtual bool fromJson(
std::string const & json
) override
Restore state from JSON string.
Parameters:
- json JSON string to parse
Return: true if parsing succeeded, false on error
Reimplements: EditorState::fromJson
Subclasses should use reflect-cpp for deserialization: ```cpp
bool fromJson(std::string const& json) override { auto result = rfl::json::read
### function data
```cpp
inline PythonWidgetStateData const & data() const
function lastScriptPath
inline QString lastScriptPath() constfunction setLastScriptPath
void setLastScriptPath(
QString const & path
)function autoScroll
inline bool autoScroll() constfunction setAutoScroll
void setAutoScroll(
bool enabled
)function fontSize
inline int fontSize() constfunction setFontSize
void setFontSize(
int size
)function commandHistory
std::vector< QString > commandHistory() constfunction setCommandHistory
void setCommandHistory(
std::vector< QString > const & history
)function recentScripts
std::vector< QString > recentScripts() constfunction addRecentScript
void addRecentScript(
QString const & path
)function showLineNumbers
inline bool showLineNumbers() constfunction setShowLineNumbers
void setShowLineNumbers(
bool show
)function editorContent
inline QString editorContent() constfunction setEditorContent
void setEditorContent(
QString const & content
)function scriptArguments
inline QString scriptArguments() constfunction setScriptArguments
void setScriptArguments(
QString const & args
)function autoImportPrelude
inline QString autoImportPrelude() constfunction setAutoImportPrelude
void setAutoImportPrelude(
QString const & prelude
)function preludeEnabled
inline bool preludeEnabled() constfunction setPreludeEnabled
void setPreludeEnabled(
bool enabled
)function lastWorkingDirectory
inline QString lastWorkingDirectory() constfunction setLastWorkingDirectory
void setLastWorkingDirectory(
QString const & dir
)function venvPath
inline QString venvPath() constfunction setVenvPath
void setVenvPath(
QString const & path
)Updated on 2026-11-13 at 20:25:40 +0000