From ed7467b75e19dce6228f1cfb53d989a989e92203 Mon Sep 17 00:00:00 2001 From: Manuel Nickschas Date: Wed, 7 Mar 2018 01:38:53 +0100 Subject: [PATCH] uistyle: Fix weird way of registering Qt types Well, maybe it didn't seem so weird a decade ago, but these days we can do type registration in a nicer way. --- src/uisupport/uistyle.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/uisupport/uistyle.cpp b/src/uisupport/uistyle.cpp index 714fe91f..d839aef5 100644 --- a/src/uisupport/uistyle.cpp +++ b/src/uisupport/uistyle.cpp @@ -72,13 +72,12 @@ UiStyle::UiStyle(QObject *parent) _opIconLimit(UserCategoryItem::categoryFromModes("o")), _voiceIconLimit(UserCategoryItem::categoryFromModes("v")) { - // register FormatList if that hasn't happened yet - // FIXME I don't think this actually avoids double registration... then again... does it hurt? - if (QVariant::nameToType("UiStyle::FormatList") == QVariant::Invalid) { - qRegisterMetaType("UiStyle::FormatList"); - qRegisterMetaTypeStreamOperators("UiStyle::FormatList"); - Q_ASSERT(QVariant::nameToType("UiStyle::FormatList") != QVariant::Invalid); - } + static bool registered = []() { + qRegisterMetaType(); + qRegisterMetaTypeStreamOperators(); + return true; + }(); + Q_UNUSED(registered) _uiStylePalette = QVector(static_cast(ColorRole::NumRoles), QBrush()); -- 2.20.1