forked from qt-creator/qt-creator
FancyMainWindow: Use "Store" type for settings instead of custom QHash
Change-Id: Id0735af2ee9b138c9a53525a236fde2a0310c695 Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
@@ -563,23 +563,23 @@ void FancyMainWindow::handleVisibilityChanged(bool visible)
|
||||
|
||||
void FancyMainWindow::saveSettings(QtcSettings *settings) const
|
||||
{
|
||||
const QHash<Key, QVariant> hash = saveSettings();
|
||||
const Store hash = saveSettings();
|
||||
for (auto it = hash.cbegin(), end = hash.cend(); it != end; ++it)
|
||||
settings->setValue(it.key(), it.value());
|
||||
}
|
||||
|
||||
void FancyMainWindow::restoreSettings(const QtcSettings *settings)
|
||||
{
|
||||
QHash<Key, QVariant> hash;
|
||||
Store hash;
|
||||
const KeyList childKeys = settings->childKeys();
|
||||
for (const Key &key : childKeys)
|
||||
hash.insert(key, settings->value(key));
|
||||
restoreSettings(hash);
|
||||
}
|
||||
|
||||
QHash<Key, QVariant> FancyMainWindow::saveSettings() const
|
||||
Store FancyMainWindow::saveSettings() const
|
||||
{
|
||||
QHash<Key, QVariant> settings;
|
||||
Store settings;
|
||||
settings.insert(StateKey, saveState(settingsVersion));
|
||||
settings.insert(ShowCentralWidgetKey, d->m_showCentralWidget.isChecked());
|
||||
for (QDockWidget *dockWidget : dockWidgets()) {
|
||||
@@ -590,7 +590,7 @@ QHash<Key, QVariant> FancyMainWindow::saveSettings() const
|
||||
return settings;
|
||||
}
|
||||
|
||||
void FancyMainWindow::restoreSettings(const QHash<Key, QVariant> &settings)
|
||||
void FancyMainWindow::restoreSettings(const Store &settings)
|
||||
{
|
||||
QByteArray ba = settings.value(StateKey, QByteArray()).toByteArray();
|
||||
if (!ba.isEmpty()) {
|
||||
|
@@ -5,7 +5,7 @@
|
||||
|
||||
#include "utils_global.h"
|
||||
|
||||
#include "storekey.h"
|
||||
#include "store.h"
|
||||
|
||||
#include <QMainWindow>
|
||||
|
||||
@@ -32,8 +32,8 @@ public:
|
||||
|
||||
void saveSettings(QtcSettings *settings) const;
|
||||
void restoreSettings(const QtcSettings *settings);
|
||||
QHash<Key, QVariant> saveSettings() const;
|
||||
void restoreSettings(const QHash<Key, QVariant> &settings);
|
||||
Store saveSettings() const;
|
||||
void restoreSettings(const Store &settings);
|
||||
bool restoreFancyState(const QByteArray &state, int version = 0);
|
||||
|
||||
// Additional context menu actions
|
||||
|
@@ -672,7 +672,7 @@ void EditorWidget::recreateEditors()
|
||||
Store windowState = m_document->settings()->windowState.value();
|
||||
|
||||
if (!windowState.isEmpty()) {
|
||||
QHash<Key, QVariant> hashMap;
|
||||
Store hashMap;
|
||||
for (const auto &key : windowState.keys()) {
|
||||
if (key.view() != "State")
|
||||
hashMap.insert(key, windowState.value(key));
|
||||
|
Reference in New Issue
Block a user