diff --git a/sources/PropertiesEditor/propertieseditorwidget.cpp b/sources/PropertiesEditor/propertieseditorwidget.cpp index 9a0c8aebd..e3fc47ba3 100644 --- a/sources/PropertiesEditor/propertieseditorwidget.cpp +++ b/sources/PropertiesEditor/propertieseditorwidget.cpp @@ -24,7 +24,8 @@ * @param parent : parent widget */ PropertiesEditorWidget::PropertiesEditorWidget(QWidget *parent) : - QWidget(parent) + QWidget(parent), + m_live_edit(false) {} /** @@ -40,7 +41,30 @@ QUndoCommand *PropertiesEditorWidget::associatedUndo() const{ * @brief PropertiesEditorWidget::title * @return the title of this editor */ -QString PropertiesEditorWidget::title() const -{ +QString PropertiesEditorWidget::title() const { return QString(); } + +/** + * @brief PropertiesEditorWidget::setLiveEdit + * Set the editor in live edit mode. + * When an editor is in live edit mode, every change is applied immediately (no need to call apply). + * If live edit can be enable, return true, else false. + * By default this method do nothing and return false (live edit is disable). + * Herited class of PropertiesEditorWidget must reimplemente this methode to manage the live edit mode. + * @param live_edit true to enable live edit + * @return true if live edit is enable, else false. + */ +bool PropertiesEditorWidget::setLiveEdit(bool live_edit) { + Q_UNUSED(live_edit); + return false; +} + +/** + * @brief PropertiesEditorWidget::isLiveEdit + * @return true if this editor is in live edit mode + * else return fasle. + */ +bool PropertiesEditorWidget::isLiveEdit() const { + return m_live_edit; +} diff --git a/sources/PropertiesEditor/propertieseditorwidget.h b/sources/PropertiesEditor/propertieseditorwidget.h index c17ef3654..64237a9b5 100644 --- a/sources/PropertiesEditor/propertieseditorwidget.h +++ b/sources/PropertiesEditor/propertieseditorwidget.h @@ -38,6 +38,16 @@ class PropertiesEditorWidget : public QWidget virtual QUndoCommand *associatedUndo () const; virtual QString title() const; virtual void updateUi() {} + + virtual bool setLiveEdit (bool live_edit); + bool isLiveEdit() const; + + private: + virtual void enableLiveEdit() {} + virtual void disableLiveEdit() {} + + protected: + bool m_live_edit; }; #endif // PROPERTIESEDITORWIDGET_H