diff --git a/plugins/quick_note/quick_note_plugin.cpp b/plugins/quick_note/quick_note_plugin.cpp index 613c922..87b8d45 100644 --- a/plugins/quick_note/quick_note_plugin.cpp +++ b/plugins/quick_note/quick_note_plugin.cpp @@ -39,6 +39,12 @@ void DoubleClickWidget::mouseDoubleClickEvent(QMouseEvent* event) } +void QuickNotePlugin::initState(StateClient* st) +{ + _state = st; + loadState(*st); +} + void QuickNotePlugin::saveState(StateClient& st) const { st.setValue("last_text", _last_text); @@ -80,6 +86,7 @@ void QuickNotePlugin::onWidgetClicked() QLineEdit::Normal, _last_text, &ok); if (ok && !str.isEmpty()) { _last_text = str; + _state->setValue("last_text", str); _widget->setText(std::move(str)); } } diff --git a/plugins/quick_note/quick_note_plugin.hpp b/plugins/quick_note/quick_note_plugin.hpp index d8dff2b..1f9f357 100644 --- a/plugins/quick_note/quick_note_plugin.hpp +++ b/plugins/quick_note/quick_note_plugin.hpp @@ -13,6 +13,7 @@ class QuickNotePlugin : public WidgetPluginBase Q_OBJECT public: + void initState(StateClient* st) override; void saveState(StateClient& st) const override; void loadState(const StateClient& st) override; @@ -27,6 +28,7 @@ private slots: private: QString _last_text; + StateClient* _state = nullptr; std::shared_ptr _widget; };