I use a QTreeWidget that shows a file listing so that a user can copy files to a directory.
I want to disallow the user to copy the files to the same directory.
Thus, I want to disable just one line in my QTreeWidget so that it is not selectable. I tried to use the setDisable(bool)
method of the QTreeWidgetItem object but the problem is it disables the whole subtree.
How to get just one line disabled in a QTreeWidget ?
I would try to disable the Qt::ItemIsDropEnabled flag with QTreeWidgetItem::setFlags, ie.e. setFlags(Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled)
I did not test this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With