bkastel1
15th November 2007, 10:39
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
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