TreeView: fix selection sync problem

This commit is contained in:
Zheng, Lei
2019-08-12 08:03:10 +08:00
committed by wmayer
parent 4ba326fae0
commit d4f066f4e9

View File

@@ -2633,14 +2633,14 @@ void TreeWidget::onItemSelectionChanged ()
_LastSelectedTreeWidget = this;
// block tmp. the connection to avoid to notify us ourself
bool lock = this->blockConnection(true);
if(selectTimer->isActive())
onSelectTimer();
else
_updateStatus(false);
// block tmp. the connection to avoid to notify us ourself
bool lock = this->blockConnection(true);
auto selItems = selectedItems();
// do not allow document item multi-selection
@@ -4120,6 +4120,7 @@ void DocumentItem::selectItems(bool sync) {
item->setSelected(false);
}else if(item->selected) {
if(item->selected == 2) {
// This means newly selected
if(!first)
first = item;
if(sync)
@@ -4134,10 +4135,10 @@ void DocumentItem::selectItems(bool sync) {
if(sync) {
if(!first)
first = last;
if(first) {
getTree()->scrollToItem(first);
else
getTree()->syncView(first->object());
}
if(first)
getTree()->scrollToItem(first);
}
}