Commit df01142f authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[widgets][description] Made short_description a Q_PROPERTY

parent 56b8cb11
...@@ -79,7 +79,7 @@ class MockAssetEditor(AbstractAssetEditor): ...@@ -79,7 +79,7 @@ class MockAssetEditor(AbstractAssetEditor):
json_data["field"] = {} json_data["field"] = {}
for field in field_list: for field in field_list:
json_data["field"][field.format_name] = field.format_type json_data["field"][field.format_name] = field.format_type
json_data["description"] = self.description.short_description() json_data["description"] = self.description.short_description
return json_data return json_data
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
############################################################################### ###############################################################################
from PyQt5.QtCore import pyqtSignal from PyQt5.QtCore import pyqtSignal
from PyQt5.QtCore import pyqtProperty
from PyQt5.QtWidgets import QLineEdit from PyQt5.QtWidgets import QLineEdit
from PyQt5.QtWidgets import QWidget from PyQt5.QtWidgets import QWidget
...@@ -34,9 +35,13 @@ class DescriptionWidget(QWidget): ...@@ -34,9 +35,13 @@ class DescriptionWidget(QWidget):
"""Class representing the short description of a beat object""" """Class representing the short description of a beat object"""
dataChanged = pyqtSignal() dataChanged = pyqtSignal()
shortDescriptionChanged = pyqtSignal(str)
def __init__(self, parent=None): def __init__(self, parent=None):
"""Constructor""" """Constructor
:param parent QWidget: parent widget
"""
super(DescriptionWidget, self).__init__(parent) super(DescriptionWidget, self).__init__(parent)
...@@ -47,7 +52,22 @@ class DescriptionWidget(QWidget): ...@@ -47,7 +52,22 @@ class DescriptionWidget(QWidget):
self.form_description.textChanged.connect(self.dataChanged) self.form_description.textChanged.connect(self.dataChanged)
def short_description(self): def shortDescription(self):
"""Short description text""" """Short description text"""
return self.form_description.text() return self.form_description.text()
def setShortDescription(self, description):
"""Set short description text
:param description str: Description
"""
self.form_description.setText(description)
short_description = pyqtProperty(
str,
fget=shortDescription,
fset=setShortDescription,
notify=shortDescriptionChanged,
)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment