From 6a92e7a13568b85486214f5fbbf98ec5bcab5695 Mon Sep 17 00:00:00 2001 From: Mathias Hasselmann Date: Sun, 23 Jun 2024 10:32:13 +0200 Subject: [PATCH] Register abstract types as uncreatable types Qt now detects missuse of qmlRegisterType() at compile time. --- apps/lmrstudio/automationview.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/apps/lmrstudio/automationview.cpp b/apps/lmrstudio/automationview.cpp index c4cfb9f..1e55b5d 100644 --- a/apps/lmrstudio/automationview.cpp +++ b/apps/lmrstudio/automationview.cpp @@ -50,9 +50,12 @@ class AutomationCanvas : public QQuickWidget explicit AutomationCanvas(QWidget *parent = nullptr) : QQuickWidget{parent} { - qmlRegisterType("Lmrs.Core.Automation", 1, 0, "Action"); - qmlRegisterType("Lmrs.Core.Automation", 1, 0, "Event"); - qmlRegisterType("Lmrs.Core.Automation", 1, 0, "Item"); + qmlRegisterUncreatableType("Lmrs.Core.Automation", 1, 0, "Action", + "Cannot create instances of an abstract type"_L1); + qmlRegisterUncreatableType("Lmrs.Core.Automation", 1, 0, "Event", + "Cannot create instances of an abstract type"_L1); + qmlRegisterUncreatableType("Lmrs.Core.Automation", 1, 0, "Item", + "Cannot create instances of an abstract type"_L1); qmlRegisterType("Lmrs.Core.Automation", 1, 0, "parameter");