Commit af7d5cd4 authored by Christoph Cullmann's avatar Christoph Cullmann 🍨
Browse files

avoid QPair, try to fix FreeBSD Qt6 compile

parent d4bb7dc7
Pipeline #223275 failed with stage
in 3 minutes and 10 seconds
......@@ -6,6 +6,8 @@
#ifndef KEYBOARDMACROSPLUGIN_KEYCOMBINATION_H
#define KEYBOARDMACROSPLUGIN_KEYCOMBINATION_H
#include <utility>
#include <QDebug>
#include <QJsonArray>
#include <QJsonValue>
......@@ -34,12 +36,12 @@ public:
, m_modifiers(keyEvent->modifiers())
, m_text(keyEvent->text()){};
static const QPair<const KeyCombination, bool> fromJson(const QJsonArray &json)
static const std::pair<const KeyCombination, bool> fromJson(const QJsonArray &json)
{
if (json.size() != 3 || json[0].type() != QJsonValue::Double || json[1].type() != QJsonValue::Double || json[2].type() != QJsonValue::String) {
return QPair(KeyCombination(), false);
return std::pair(KeyCombination(), false);
}
return QPair(KeyCombination(json[0].toInt(0), static_cast<Qt::KeyboardModifiers>(json[1].toInt(0)), json[2].toString()), true);
return std::pair(KeyCombination(json[0].toInt(0), static_cast<Qt::KeyboardModifiers>(json[1].toInt(0)), json[2].toString()), true);
};
const QKeyEvent keyPress() const
......
......@@ -6,6 +6,8 @@
#ifndef KEYBOARDMACROSPLUGIN_MACRO_H
#define KEYBOARDMACROSPLUGIN_MACRO_H
#include <utility>
#include <QDebug>
#include <QJsonArray>
#include <QJsonValue>
......@@ -21,23 +23,23 @@ public:
explicit Macro()
: QList<KeyCombination>(){};
static const QPair<const Macro, bool> fromJson(const QJsonValue &json)
static const std::pair<const Macro, bool> fromJson(const QJsonValue &json)
{
if (json.type() != QJsonValue::Array) {
QPair(Macro(), false);
std::pair(Macro(), false);
}
Macro macro;
for (const auto &jsonKeyCombination : json.toArray()) {
if (jsonKeyCombination.type() != QJsonValue::Array) {
return QPair(Macro(), false);
return std::pair(Macro(), false);
}
auto maybeKeyCombination = KeyCombination::fromJson(jsonKeyCombination.toArray());
if (!maybeKeyCombination.second) {
return QPair(Macro(), false);
return std::pair(Macro(), false);
}
macro.append(maybeKeyCombination.first);
}
return QPair(macro, true);
return std::pair(macro, true);
};
const QJsonArray toJson() const
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment