Only do the fake item hack if there are items in the list

This commit is contained in:
Micah Lee 2018-02-04 20:50:24 -08:00
parent d892213db1
commit e17dbd4fdd
No known key found for this signature in database
GPG Key ID: 403C2657CD994F73

View File

@ -62,7 +62,7 @@ class DropCountLabel(QtWidgets.QLabel):
self.setStyleSheet('color: #ffffff; background-color: #f44449; font-weight: bold; padding: 5px 10px; border-radius: 10px;')
self.hide()
def dragLeaveEvent(self, event):
def dragEnterEvent(self, event):
self.hide()
event.accept()
@ -109,12 +109,13 @@ class FileList(QtWidgets.QListWidget):
self.drop_here_image.setGeometry(0, 0, self.width(), self.height() - offset)
self.drop_here_text.setGeometry(0, offset, self.width(), self.height() - offset)
# Add and delete an empty item, to force all items to get redrawn
# This is ugly, but the only way I could figure out how to proceed
item = QtWidgets.QListWidgetItem('fake item')
self.addItem(item)
self.takeItem(self.row(item))
self.update()
if self.count() > 0:
# Add and delete an empty item, to force all items to get redrawn
# This is ugly, but the only way I could figure out how to proceed
item = QtWidgets.QListWidgetItem('fake item')
self.addItem(item)
self.takeItem(self.row(item))
self.update()
def dragEnterEvent(self, event):
"""