Re: Veto QT slot execution
A slot invocation is a method call, not an event.
If you don't want the signal to be emitted, override the view's mouse event handling.
Cheers,
_
Re: Veto QT slot execution
If you do not want clicking an item in the view to select anything then call the view's QAbstractItemView::setSelectionMode() with QAbstractItemView::NoSelection
Re: Veto QT slot execution
Hi
@anda_skoa:
QTreeView has mouseEvent as non-virtual. So I cannot override the mouse-events of treeview.
@ChrisW67:
I guess that will be applicable for entire item. Not for a particular column of an item. Isn't it?
Re: Veto QT slot execution
Quote:
Originally Posted by
rakeshthp
QTreeView has mouseEvent as non-virtual. So I cannot override the mouse-events of treeview.
Not sure what method you are referring to. I can see lots of specialized mouse*Event() methods, but no generic mouseEvent(). They all seem inherited from QWidget, and virtual.
Re: Veto QT slot execution
Quote:
Originally Posted by
rakeshthp
@ChrisW67:
I guess that will be applicable for entire item. Not for a particular column of an item. Isn't it?
The selection behaviour is for the entire view (anything using the same selectionModel(), usually just the one view)
You complain that when the user clicks on an item in column 2 the entire row is selected, implying you want selection but you definitely do not want a selectionBehavior() of QAbstractItemView::SelectRows. You then say you do not want the item they clicked on to be selected either, so QAbstractItemView::SelectItems is not appropriate. It seems you want nothing at all selected by clicking in the view and therefore a selectionMode() of QAbtractItemView::NoSelection seems a good option.
If you want particular items scattered through a model to not be selectable then have the model return a flags() value for the affected indexes that does not contain Qt::ItemIsSelectable (or use a proxy to filter flags()).
Re: Veto QT slot execution
@ChrisW67:
Item should be selected if column 1 is clicked, and it should not get selected if column 2 is clicked. Is it possible?