Fix context menu in db query widget

This commit is contained in:
Martchus 2017-01-06 21:20:36 +01:00
parent ef4eba3728
commit e3202b7fc5
2 changed files with 5 additions and 4 deletions

View File

@ -11,7 +11,7 @@ set(META_APP_DESCRIPTION "A tageditor with Qt GUI and command line interface. Su
set(META_GUI_OPTIONAL true)
set(META_VERSION_MAJOR 2)
set(META_VERSION_MINOR 1)
set(META_VERSION_PATCH 1)
set(META_VERSION_PATCH 2)
# add project files
set(HEADER_FILES

View File

@ -430,11 +430,12 @@ void DbQueryWidget::showResultsContextMenu()
if(!selection.isEmpty()) {
QMenu contextMenu;
if(m_ui->applyPushButton->isEnabled()) {
contextMenu.addAction(m_ui->applyPushButton->icon(), tr("Use selected row"), this, SLOT(applyResults()));
connect(contextMenu.addAction(m_ui->applyPushButton->icon(), tr("Use selected row")), &QAction::trigger, this, static_cast<void(DbQueryWidget::*)(void)>(&DbQueryWidget::applySelectedResults));
// NOTE: available in Qt 5.6 or later: contextMenu.addAction(m_ui->applyPushButton->icon(), tr("Use selected row"), this, static_cast<void(DbQueryWidget::*)(void)>(&DbQueryWidget::applySelectedResults));
}
if(m_model && m_model->areResultsAvailable()) {
contextMenu.addAction(QIcon::fromTheme(QStringLiteral("view-preview")), tr("Show cover"), this, SLOT(fetchAndShowCoverForSelection()));
contextMenu.addAction(QIcon::fromTheme(QStringLiteral("view-media-lyrics")), tr("Show lyrics"), this, SLOT(fetchAndShowLyricsForSelection()));
connect(contextMenu.addAction(QIcon::fromTheme(QStringLiteral("view-preview")), tr("Show cover")), &QAction::trigger, this, &DbQueryWidget::fetchAndShowCoverForSelection);
connect(contextMenu.addAction(QIcon::fromTheme(QStringLiteral("view-media-lyrics")), tr("Show lyrics")), &QAction::trigger, this, &DbQueryWidget::fetchAndShowLyricsForSelection);
}
contextMenu.exec(QCursor::pos());
}