QTreeView: checking if item to be dropped is already present and avoid it on dropEvent()
问题 I have a QTreeView with implemented dropEvent()-handler. If the item to be dropped is already existing under the target-root, how could I avoid the dropping at all? E.g. drag "user_b" from the "Master Data" Node on the node "Security Model"/"client_c"/"stakeholder_d" which already exists. Full working code example: #!/usr/bin/env python3 # coding = utf-8 from PyQt5 import QtWidgets, QtCore, QtGui TXT_CLIENT = "Clients" TXT_STAKEHLD = "Stakeholders" TXT_USER = "Users" TXT_SYSTEM = "Master Data