Editor: Do not add to history twice for double clicking bookmarks

Activating a bookmark via a double click resulted in both signals
getting emitted doubleClicked as well as activated, and both were
connected to BookmarkView::gotoBookmark. So the goto code was executed
twice resulting in adding the position to the navigation history twice.
Fix this by only connecting to activated since this is always emitted
alongside the doubleClicked signal as well as when the item is activated
by keyboard.

Fixes: QTCREATORBUG-30842
Change-Id: I48ea50afa105f81a2be8ac94096dd29164fce5fe
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
David Schulz
2024-06-20 13:58:56 +02:00
parent 987d292414
commit 6b1e7eff93

View File

@@ -218,7 +218,6 @@ BookmarkView::BookmarkView()
setDragEnabled(true); setDragEnabled(true);
setDragDropMode(QAbstractItemView::DragDrop); setDragDropMode(QAbstractItemView::DragDrop);
connect(this, &QAbstractItemView::doubleClicked, this, &BookmarkView::gotoBookmark);
connect(this, &QAbstractItemView::activated, this, &BookmarkView::gotoBookmark); connect(this, &QAbstractItemView::activated, this, &BookmarkView::gotoBookmark);
} }