QModListModel: turn into singleton

This commit is contained in:
Toast 2025-06-05 21:32:41 +02:00
parent 631cdb4938
commit 1061acbe6b
2 changed files with 3 additions and 2 deletions

View file

@ -1,4 +1,4 @@
from PySide6.QtQml import QmlElement from PySide6.QtQml import QmlElement, QmlSingleton
from PySide6.QtCore import QAbstractListModel, QModelIndex from PySide6.QtCore import QAbstractListModel, QModelIndex
from leek.mod import InvalidModError from leek.mod import InvalidModError
from leek.qmod import QMod from leek.qmod import QMod
@ -12,6 +12,7 @@ QML_IMPORT_MAJOR_VERSION = 1
# Qt follows C++ naming conventions # Qt follows C++ naming conventions
# ruff: noqa: N802 # ruff: noqa: N802
@QmlElement @QmlElement
@QmlSingleton
class QModListModel(QAbstractListModel): class QModListModel(QAbstractListModel):
def __init__(self, parent=None) -> None: def __init__(self, parent=None) -> None:
super().__init__(parent=parent) super().__init__(parent=parent)

View file

@ -29,7 +29,7 @@ Kirigami.ApplicationWindow {
id: modsView id: modsView
delegate: ModCardDelegate {} delegate: ModCardDelegate {}
model: QModListModel {} model: QModListModel
} }
} }