From 1061acbe6bbeefcad092a51ad1e7043f837e9775 Mon Sep 17 00:00:00 2001 From: Toast Date: Thu, 5 Jun 2025 21:32:41 +0200 Subject: [PATCH] QModListModel: turn into singleton --- src/leek/mod_list.py | 3 ++- src/leek/qml/Main.qml | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/leek/mod_list.py b/src/leek/mod_list.py index ee12488..96a98d4 100644 --- a/src/leek/mod_list.py +++ b/src/leek/mod_list.py @@ -1,4 +1,4 @@ -from PySide6.QtQml import QmlElement +from PySide6.QtQml import QmlElement, QmlSingleton from PySide6.QtCore import QAbstractListModel, QModelIndex from leek.mod import InvalidModError from leek.qmod import QMod @@ -12,6 +12,7 @@ QML_IMPORT_MAJOR_VERSION = 1 # Qt follows C++ naming conventions # ruff: noqa: N802 @QmlElement +@QmlSingleton class QModListModel(QAbstractListModel): def __init__(self, parent=None) -> None: super().__init__(parent=parent) diff --git a/src/leek/qml/Main.qml b/src/leek/qml/Main.qml index a7650ee..da54ba4 100644 --- a/src/leek/qml/Main.qml +++ b/src/leek/qml/Main.qml @@ -29,7 +29,7 @@ Kirigami.ApplicationWindow { id: modsView delegate: ModCardDelegate {} - model: QModListModel {} + model: QModListModel } }