Copy should only copy selected text if there is any

This commit is contained in:
Kovid Goyal 2020-08-25 18:43:10 +05:30
parent 35f770955e
commit 69a9ffadf5
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -580,7 +580,8 @@ class DateTimeEdit(QDateTimeEdit):
@property @property
def mime_data_for_copy(self): def mime_data_for_copy(self):
md = QMimeData() md = QMimeData()
md.setText(self.dateTime().toString()) text = self.lineEdit().selectedText()
md.setText(text or self.dateTime().toString())
md.setData(self.MIME_TYPE, self.dateTime().toString(Qt.ISODate).encode('ascii')) md.setData(self.MIME_TYPE, self.dateTime().toString(Qt.ISODate).encode('ascii'))
return md return md