VPTissue Reference Manual
|
Small editor widget for a Boost Property Tree object. More...
#include <PTreeEditorWindow.h>
Public Slots | |
void | Apply () |
Write changes to ptree object. Clean state is achieved as a side effect. | |
bool | OpenPath (const QString &edit_path) |
Set subtree to show in editor. More... | |
bool | OpenPTree (const boost::property_tree::ptree &, QString const &edit_path="") |
Set ptree to show in editor. More... | |
Signals | |
void | ApplyTriggered (const boost::property_tree::ptree &pt) |
Emitted when changes are applied to ptree. | |
void | StatusChanged (const QString &) |
Emitted when the window has information available, for e.g. a statusbar. | |
Public Member Functions | |
PTreeEditorWindow (QWidget *parent=nullptr) | |
virtual | ~PTreeEditorWindow () |
Virtual destructor. | |
std::string | GetEditPath () const |
Get the current edit path. More... | |
virtual boost::property_tree::ptree | GetPTreeState () const |
bool | IsOnlyEditData () const |
Test whether the "only edit data" option is set. More... | |
virtual bool | IsOpened () const |
void | Redo () |
Redo last manipulation by the user. | |
void | SetOnlyEditData (bool) |
Set the "only edit values" option. More... | |
virtual void | SetPTreeState (const boost::property_tree::ptree &) |
virtual QSize | sizeHint () const |
Reimplemented from QWidget. | |
void | Undo () |
Undo last manipulation by the user. | |
Public Member Functions inherited from SimShell::Gui::HasUnsavedChanges | |
HasUnsavedChanges (std::string &&title) | |
virtual | ~HasUnsavedChanges () |
Virtual destructor. | |
ChildrenType::iterator | begin () |
Get iterator to first child. | |
ChildrenType::const_iterator | begin () const |
Get iterator to first child. | |
ChildrenType::iterator | end () |
Get iterator to one position after last child. | |
ChildrenType::const_iterator | end () const |
Get iterator to one position after last child. | |
void | ForceClose () |
Force this object and its children to go back to unopened state so it can be safely deleted. | |
const std::string & | GetTitle () |
Get title of this object. | |
bool | IsClean () const |
bool | Save () |
Try to save this widget's (and its children's) changes. More... | |
bool | SaveAndClose () |
Try to save this object (and its children) and, if successful, close them all. | |
Protected Member Functions | |
virtual void | InternalForceClose () |
virtual bool | InternalIsClean () const |
virtual bool | InternalSave () |
Protected Member Functions inherited from SimShell::Gui::HasUnsavedChanges | |
void | AddChild (ChildrenType::value_type &&v) |
Add child. | |
virtual void | InternalPreForceClose () |
Additional things to do before closing children of this widget. | |
void | SetChildren (ChildrenType &&c) |
Set children. | |
Additional Inherited Members | |
Public Types inherited from SimShell::Gui::HasUnsavedChanges | |
typedef std::vector< HasUnsavedChanges * > | ChildrenType |
Small editor widget for a Boost Property Tree object.
Each manipulation by the user immediately results in an Apply() signal.
Definition at line 43 of file PTreeEditorWindow.h.
SimShell::Gui::PTreeEditorWindow::PTreeEditorWindow | ( | QWidget * | parent = nullptr | ) |
parent | Parent widget. |
Definition at line 40 of file PTreeEditorWindow.cpp.
std::string SimShell::Gui::PTreeEditorWindow::GetEditPath | ( | ) | const |
Get the current edit path.
The edit path is the subtree that is shown in the editor. The rest of the ptree is hidden. If this value is empty, the entire ptree is shown.
Definition at line 103 of file PTreeEditorWindow.cpp.
|
virtual |
Implements SimShell::Gui::IHasPTreeState.
Definition at line 107 of file PTreeEditorWindow.cpp.
References SimShell::Gui::MyTreeView::GetPTreeState().
|
protectedvirtual |
Implements SimShell::Gui::HasUnsavedChanges.
Definition at line 115 of file PTreeEditorWindow.cpp.
References SimShell::Gui::PTreeView::setModel().
|
protectedvirtual |
Implements SimShell::Gui::HasUnsavedChanges.
Definition at line 126 of file PTreeEditorWindow.cpp.
References SimShell::Gui::PTreeView::IsClean().
|
protectedvirtual |
Implements SimShell::Gui::HasUnsavedChanges.
Definition at line 131 of file PTreeEditorWindow.cpp.
References Apply(), and SimShell::Gui::PTreeView::IsClean().
bool SimShell::Gui::PTreeEditorWindow::IsOnlyEditData | ( | ) | const |
Test whether the "only edit data" option is set.
If true, the user can only edit values in the 'data' column. The user cannot add/move/remove/rename keys.
Definition at line 138 of file PTreeEditorWindow.cpp.
|
virtual |
Implements SimShell::Gui::HasUnsavedChanges.
Definition at line 143 of file PTreeEditorWindow.cpp.
|
slot |
Set subtree to show in editor.
If the edit path is different from the current one, a dialog asking to apply unapplied changes will be shown.
Definition at line 148 of file PTreeEditorWindow.cpp.
References Apply(), SimShell::Gui::PTreeView::IsClean(), SimShell::Gui::PTreeView::setModel(), and SimShell::Gui::PTreeModel::SetOnlyEditData().
Referenced by SetPTreeState().
|
slot |
Set ptree to show in editor.
A confirmation dialog is shown if there are unapplied changes.
Definition at line 175 of file PTreeEditorWindow.cpp.
References SimShell::Gui::HasUnsavedChanges::SaveAndClose(), SimShell::Gui::PTreeView::setModel(), and SimShell::Gui::PTreeModel::SetOnlyEditData().
void SimShell::Gui::PTreeEditorWindow::SetOnlyEditData | ( | bool | b | ) |
Set the "only edit values" option.
Definition at line 195 of file PTreeEditorWindow.cpp.
References SimShell::Gui::PTreeModel::SetOnlyEditData().
|
virtual |
Implements SimShell::Gui::IHasPTreeState.
Definition at line 205 of file PTreeEditorWindow.cpp.
References OpenPath(), and SimShell::Gui::MyTreeView::SetPTreeState().