From 20e7c1443e2edede48e397e15e900a041b326bab Mon Sep 17 00:00:00 2001 From: Tasuku Suzuki Date: Wed, 14 Aug 2019 21:29:02 +0900 Subject: [PATCH] ResourceEditor: save and restore state of splitter Change-Id: Ief14ef729e5c559e77991e00b22cb25673609a4c Reviewed-by: Eike Ziller --- src/plugins/resourceeditor/resourceeditorw.cpp | 18 ++++++++++++++++++ src/plugins/resourceeditor/resourceeditorw.h | 2 ++ 2 files changed, 20 insertions(+) diff --git a/src/plugins/resourceeditor/resourceeditorw.cpp b/src/plugins/resourceeditor/resourceeditorw.cpp index 1dff313993e..2255810bb92 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 14c9c12394a..8ac4e8d9b22 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: