diff options
author | Tasuku Suzuki <tasuku.suzuki@qbc.io> | 2019-08-14 21:29:02 +0900 |
---|---|---|
committer | Tasuku Suzuki <tasuku.suzuki@qbc.io> | 2019-08-15 07:08:56 +0000 |
commit | 20e7c1443e2edede48e397e15e900a041b326bab (patch) | |
tree | 7ac10b8a150f59337e8cd05739ae6afe7ffad8e5 /src/plugins/resourceeditor | |
parent | 8201d49ea07fe83eecf6694d690c49ea314d52ca (diff) |
ResourceEditor: save and restore state of splitter
Change-Id: Ief14ef729e5c559e77991e00b22cb25673609a4c
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Diffstat (limited to 'src/plugins/resourceeditor')
-rw-r--r-- | src/plugins/resourceeditor/resourceeditorw.cpp | 18 | ||||
-rw-r--r-- | src/plugins/resourceeditor/resourceeditorw.h | 2 |
2 files changed, 20 insertions, 0 deletions
diff --git a/src/plugins/resourceeditor/resourceeditorw.cpp b/src/plugins/resourceeditor/resourceeditorw.cpp index 1dff313993..2255810bb9 100644 --- a/src/plugins/resourceeditor/resourceeditorw.cpp +++ b/src/plugins/resourceeditor/resourceeditorw.cpp @@ -229,6 +229,24 @@ void ResourceEditorDocument::setShouldAutoSave(bool save) m_shouldAutoSave = save; } +QByteArray ResourceEditorW::saveState() const +{ + QByteArray bytes; + QDataStream stream(&bytes, QIODevice::WriteOnly); + stream << m_resourceEditor->saveState(); + return bytes; +} + +bool ResourceEditorW::restoreState(const QByteArray &state) +{ + QDataStream stream(state); + QByteArray splitterState; + stream >> splitterState; + if (!m_resourceEditor->restoreState(splitterState)) + return false; + return true; +} + QWidget *ResourceEditorW::toolBar() { return m_toolBar; diff --git a/src/plugins/resourceeditor/resourceeditorw.h b/src/plugins/resourceeditor/resourceeditorw.h index 14c9c12394..8ac4e8d9b2 100644 --- a/src/plugins/resourceeditor/resourceeditorw.h +++ b/src/plugins/resourceeditor/resourceeditorw.h @@ -90,6 +90,8 @@ public: // IEditor Core::IDocument *document() const override { return m_resourceDocument; } + QByteArray saveState() const override; + bool restoreState(const QByteArray &state) override; QWidget *toolBar() override; private: |