QMod: make enable property writable
This commit is contained in:
parent
999cf68655
commit
af77bc105d
2 changed files with 11 additions and 1 deletions
|
|
@ -78,6 +78,8 @@ Kirigami.ApplicationWindow {
|
|||
Controls.Switch {
|
||||
checked: mod.enabled
|
||||
text: "Enabled"
|
||||
|
||||
onClicked: mod.enabled = checked
|
||||
}
|
||||
Controls.Button {
|
||||
text: "Delete"
|
||||
|
|
|
|||
|
|
@ -34,6 +34,14 @@ class QMod(QObject):
|
|||
def description(self) -> str | None:
|
||||
return self.__mod.description
|
||||
|
||||
@Property(bool, constant=True)
|
||||
mod_enabled = Signal(name="enabled")
|
||||
|
||||
@Property(bool, notify=mod_enabled)
|
||||
def enabled(self) -> bool:
|
||||
return self.__mod.enabled
|
||||
|
||||
@enabled.setter # type: ignore[no-redef]
|
||||
def enabled(self, value: bool) -> None:
|
||||
print(f"Set mod to {value}")
|
||||
self.__mod.enabled = value
|
||||
self.mod_enabled.emit()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue