Skip to content

Commit

Permalink
Merge pull request #4075 from dmitrio95/bugfix/score_browser_single_c…
Browse files Browse the repository at this point in the history
…lick_crash-2

fix #272995: avoid handling single clicks twice in ScoreBrowser
  • Loading branch information
anatoly-os committed Oct 29, 2018
1 parent 7c594ca commit 1b29bd2
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions mscore/scoreBrowser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,11 @@ ScoreListWidget* ScoreBrowser::createScoreList()
if (!_showPreview)
sl->setSelectionMode(QAbstractItemView::NoSelection);

connect(sl, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(scoreClicked(QListWidgetItem*)), Qt::QueuedConnection);
if (!style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick)) {
// Set our handler for item clicks only if Qt
// doesn't treat a click as an item activation.
connect(sl, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(scoreClicked(QListWidgetItem*)), Qt::QueuedConnection);
}
connect(sl, SIGNAL(itemActivated(QListWidgetItem*)), SLOT(setScoreActivated(QListWidgetItem*)));
scoreLists.append(sl);
return sl;
Expand Down Expand Up @@ -328,12 +332,6 @@ void ScoreBrowser::scoreClicked(QListWidgetItem* current)
if (!current)
return;

if (style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick)) {
// Qt will consider this click an item activation.
// Just let it happen.
return;
}

ScoreItem* item = static_cast<ScoreItem*>(current);
if (!_showPreview)
emit scoreActivated(item->info().filePath());
Expand Down

0 comments on commit 1b29bd2

Please sign in to comment.