aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/scxmleditor
diff options
context:
space:
mode:
authorhjk <hjk@qt.io>2023-08-30 07:39:54 +0200
committerhjk <hjk@qt.io>2023-08-30 07:38:02 +0000
commitc7710acadd781e082f66ba389facaef3f5dce41b (patch)
tree4df503f115d7899d8883453c7090a6bff0e09722 /src/plugins/scxmleditor
parent922da1fbb3d0480e78080c53a87550a694b9664e (diff)
Utils: Use Key more widely in QtcSettings
And adapt user code. Change-Id: I6efe4ebe6823de4cc862f304a57e041b02c40eac Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Diffstat (limited to 'src/plugins/scxmleditor')
-rw-r--r--src/plugins/scxmleditor/common/colorpicker.cpp12
-rw-r--r--src/plugins/scxmleditor/common/colorpicker.h7
2 files changed, 10 insertions, 9 deletions
diff --git a/src/plugins/scxmleditor/common/colorpicker.cpp b/src/plugins/scxmleditor/common/colorpicker.cpp
index 88f4d6d22a7..a367ebbd7d0 100644
--- a/src/plugins/scxmleditor/common/colorpicker.cpp
+++ b/src/plugins/scxmleditor/common/colorpicker.cpp
@@ -12,7 +12,9 @@
#include <QHBoxLayout>
#include <QToolButton>
-using namespace ScxmlEditor::Common;
+using namespace Utils;
+
+namespace ScxmlEditor::Common {
const char C_SETTINGS_COLORPICKER_LASTUSEDCOLORS[] = "ScxmlEditor/ColorPickerLastUsedColors_%1";
constexpr int C_BUTTON_COLUMNS_COUNT = 5;
@@ -55,15 +57,15 @@ ColorPicker::ColorPicker(const QString &key, QWidget *parent)
}.attachTo(this);
const QStringList lastColors = Core::ICore::settings()->value(
- QString::fromLatin1(C_SETTINGS_COLORPICKER_LASTUSEDCOLORS).arg(m_key), QStringList()).toStringList();
+ C_SETTINGS_COLORPICKER_LASTUSEDCOLORS + keyFromString(m_key), QStringList()).toStringList();
for (int i = lastColors.count(); i--;)
setLastUsedColor(lastColors[i]);
}
ColorPicker::~ColorPicker()
{
- Core::ICore::settings()->setValue(QString::fromLatin1(C_SETTINGS_COLORPICKER_LASTUSEDCOLORS).arg(m_key),
- m_lastUsedColorNames);
+ Core::ICore::settings()->setValue(
+ C_SETTINGS_COLORPICKER_LASTUSEDCOLORS + keyFromString(m_key), m_lastUsedColorNames);
}
void ColorPicker::setLastUsedColor(const QString &colorName)
@@ -99,3 +101,5 @@ QToolButton *ColorPicker::createButton(const QColor &color)
return button;
}
+
+} // ScxmlEditor::Common
diff --git a/src/plugins/scxmleditor/common/colorpicker.h b/src/plugins/scxmleditor/common/colorpicker.h
index 1576e8a9116..73399068904 100644
--- a/src/plugins/scxmleditor/common/colorpicker.h
+++ b/src/plugins/scxmleditor/common/colorpicker.h
@@ -10,9 +10,7 @@ class QHBoxLayout;
class QToolButton;
QT_END_NAMESPACE
-namespace ScxmlEditor {
-
-namespace Common {
+namespace ScxmlEditor::Common {
class ColorPicker : public QFrame
{
@@ -37,5 +35,4 @@ private:
QHBoxLayout *m_lastUsedColorContainer;
};
-} // namespace Common
-} // namespace ScxmlEditor
+} // namespace ScxmlEditor::Common