Faster timeline selection updates.

This commit is contained in:
leo 2015-11-28 22:12:47 +00:00
parent 434ace6862
commit 8fab83f2f0

View file

@ -231,7 +231,7 @@ void lcTimelineWidget::UpdateSelection()
if (mIgnoreUpdates)
return;
bool Blocked = blockSignals(true);
QItemSelection ItemSelection;
for (int TopLevelItemIdx = 0; TopLevelItemIdx < topLevelItemCount(); TopLevelItemIdx++)
{
@ -242,10 +242,18 @@ void lcTimelineWidget::UpdateSelection()
QTreeWidgetItem* PieceItem = StepItem->child(PieceItemIdx);
lcPiece* Piece = (lcPiece*)PieceItem->data(0, Qt::UserRole).value<uintptr_t>();
PieceItem->setSelected(Piece->IsSelected());
if (Piece->IsSelected())
{
QModelIndex Index = indexFromItem(PieceItem);
ItemSelection.select(Index, Index);
}
}
}
bool Blocked = blockSignals(true);
selectionModel()->select(ItemSelection, QItemSelectionModel::ClearAndSelect);
blockSignals(Blocked);
}