Hello,

I have a problem with disabling button. I will be very grateful if you give me any advice.

Let’s assume that we have a dialog which displays item’s list. Dialog has Ok and Cancel buttons. I want when user clicks one of the items of the list (selecting the item) the OK button will be enabled otherwise (deselecting the item) OK button will be disabled.

I could enable Ok button. To do this I connect void QAbstractItemView::clicked(const QModelIndex & index) signal with the slot which enables Ok button. But this signal emitted when index is valid.

How can I disable Ok button? How I can be known that user clicks outside the item?