Move button text inside QML element

cura 8587
This commit is contained in:
casper 2021-12-06 17:50:18 +01:00
parent 119b86b957
commit 49a6a83fe9
2 changed files with 4 additions and 25 deletions

View File

@ -5,32 +5,15 @@ catalog = i18nCatalog("cura")
# Model for the LicenseDialog
class LicenseModel(QObject):
DEFAULT_DECLINE_BUTTON_TEXT = catalog.i18nc("@button", "Decline")
ACCEPT_BUTTON_TEXT = catalog.i18nc("@button", "Agree")
dialogTitleChanged = pyqtSignal()
packageNameChanged = pyqtSignal()
licenseTextChanged = pyqtSignal()
def __init__(self, decline_button_text: str = DEFAULT_DECLINE_BUTTON_TEXT) -> None:
def __init__(self, licence_text: str, package_name: str) -> None:
super().__init__()
self._dialogTitle = ""
self._license_text = ""
self._package_name = ""
self._decline_button_text = decline_button_text
@pyqtProperty(str, constant = True)
def acceptButtonText(self):
return self.ACCEPT_BUTTON_TEXT
@pyqtProperty(str, constant = True)
def declineButtonText(self):
return self._decline_button_text
@pyqtProperty(str, notify=dialogTitleChanged)
def dialogTitle(self) -> str:
return self._dialogTitle
@pyqtProperty(str, notify=packageNameChanged)
def packageName(self) -> str:
@ -48,7 +31,3 @@ class LicenseModel(QObject):
if self._license_text != license_text:
self._license_text = license_text
self.licenseTextChanged.emit()
def _updateDialogTitle(self):
self._dialogTitle = catalog.i18nc("@title:window", "Plugin License Agreement")
self.dialogTitleChanged.emit()

View File

@ -14,7 +14,7 @@ import Cura 1.6 as Cura
UM.Dialog
{
id: licenseDialog
title: licenseModel.dialogTitle
title: catalog.i18nc("@button", "Plugin license agreement")
minimumWidth: UM.Theme.getSize("license_window_minimum").width
minimumHeight: UM.Theme.getSize("license_window_minimum").height
width: minimumWidth
@ -72,7 +72,7 @@ UM.Dialog
[
Cura.PrimaryButton
{
text: licenseModel.acceptButtonText
text: catalog.i18nc("@button", "Accept")
onClicked: { handler.onLicenseAccepted() }
}
]
@ -81,7 +81,7 @@ UM.Dialog
[
Cura.SecondaryButton
{
text: licenseModel.declineButtonText
text: catalog.i18nc("@button", "Decline")
onClicked: { handler.onLicenseDeclined() }
}
]