Resize a QListWidgetItem with a custom QAbstractItemDelegate when it's clicked
-
Hello people,
I created a custom delegate for my QListWidgetItems and it's working how it should be. But I'm looking for some additional tweaks on my code.
Within the paint method of my custom delegate I was able to create a different style when the item is clicked within the QListWidget, but I want the whole item within the list to become "bigger", making me able to place a little QLineEdit and a QPushButton at the bottom of the item withing the list.
I tried to put some if-statements within the sizeHint method of the delegation, but QStyleOptionViewItem seems to be unset when it's called by the program. I looked into the documentation but I've seen that there isn't even a "clicked()" signal. Is there a way to do it anyway, or is my solution just going in the wrong direction? I've also seen that I'm able to implement my own signals.
So I guess I have to implement the clicked() signal into my delegation to call a function which would resize my item and add the additional content? Maybe someone with the same problem could provide me some code.
I'm pretty new to Qt but so far very satisfied and I hope an more experienced Qt-user might be able to help me.
Greetings
-
Hi and welcome to devnet,
Do you mean you want the QLineEdit and QPushButton visible also when only selecting an item ?
-
Then you should also implement the sizeHint method of your delegate