Qt4 can't serialize lists of things out of the box, in this case
lists of shortcuts. Rather than declaring a new metatype, we just
go back to storing a single shortcut for Qt4 - it's all we internally
support anyway.
{
Q_ASSERT(type);
if (type == DefaultShortcut) {
{
Q_ASSERT(type);
if (type == DefaultShortcut) {
+#if QT_VERSION < 0x050000
+ return property("defaultShortcut").value<QKeySequence>();
+#else
auto sequence = property("defaultShortcuts").value<QList<QKeySequence>>();
return sequence.isEmpty() ? QKeySequence() : sequence.first();
auto sequence = property("defaultShortcuts").value<QList<QKeySequence>>();
return sequence.isEmpty() ? QKeySequence() : sequence.first();
}
return shortcuts().isEmpty() ? QKeySequence() : shortcuts().first();
}
return shortcuts().isEmpty() ? QKeySequence() : shortcuts().first();
- if (type & DefaultShortcut)
+ if (type & DefaultShortcut) {
+#if QT_VERSION < 0x050000
+ setProperty("defaultShortcut", key);
+#else
setProperty("defaultShortcuts", QVariant::fromValue(QList<QKeySequence>() << key));
setProperty("defaultShortcuts", QVariant::fromValue(QList<QKeySequence>() << key));
if (type & ActiveShortcut)
QAction::setShortcut(key);
}
if (type & ActiveShortcut)
QAction::setShortcut(key);
}