Hello to all,
i have a question. I have a QTreeWidget and i have some items which can be right-clicked and then i show a contextmenu. My problem is when i click in an empyt space in this widget the last clicked item isn't unselected - it still has focus. How can i fix this?
I was thinking about ckecking for mouseclickevent and then to check if there is an item or not and if it is not unselect item but that doesn't seem a very good solution because i can have a lot of items in my TreeWidget.
this are the settings for my QTreeWidget:
m_TransfersTree->setSelectionBehavior( QAbstractItemView::SelectRows );
m_TransfersTree->setSelectionMode( QAbstractItemView::SingleSelection );
m_TransfersTree->setFocusPolicy(Qt::ClickFocus);
Thank you all.
regards,
Borut


Reply With Quote
I will try to do this although i thought that there should be an easier way to do this (i though that this is a default behaviour - when you click in an empty space or in another widget previously selected item that had focus now item looses focus).
Bookmarks