mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
added helper method for conversion of data to bytes
This commit is contained in:
parent
f346fb8cfd
commit
ef515039a0
1 changed files with 11 additions and 5 deletions
|
|
@ -41,6 +41,13 @@ def convert_bytes_to_json(bytes_value):
|
|||
return None
|
||||
|
||||
|
||||
def convert_data_to_bytes(data):
|
||||
bytes_value = QtCore.QByteArray()
|
||||
stream = QtCore.QDataStream(bytes_value, QtCore.QIODevice.WriteOnly)
|
||||
stream.writeQString(json.dumps(data))
|
||||
return bytes_value
|
||||
|
||||
|
||||
class SupportLabel(QtWidgets.QLabel):
|
||||
pass
|
||||
|
||||
|
|
@ -306,11 +313,10 @@ class FilesModel(QtGui.QStandardItemModel):
|
|||
index.data(ITEM_ID_ROLE)
|
||||
for index in indexes
|
||||
]
|
||||
encoded_data = QtCore.QByteArray()
|
||||
stream = QtCore.QDataStream(encoded_data, QtCore.QIODevice.WriteOnly)
|
||||
stream.writeQString(json.dumps(item_ids))
|
||||
mime_data = super(FilesModel, self).mimeData(indexes)
|
||||
mime_data.setData("files_widget/internal_move", encoded_data)
|
||||
|
||||
item_ids_data = convert_data_to_bytes(item_ids)
|
||||
mime_data = QtCore.QMimeData()
|
||||
mime_data.setData("files_widget/internal_move", item_ids_data)
|
||||
return mime_data
|
||||
|
||||
def dropMimeData(self, mime_data, action, row, col, index):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue