Don't use QCursor::pos() for context menu position

It might now work under Wayland.
This commit is contained in:
Martchus 2019-07-20 18:42:32 +02:00
parent 7e83f7a919
commit 6c3a230962
2 changed files with 3 additions and 3 deletions

View File

@ -453,7 +453,7 @@ void DbQueryWidget::insertSearchTermsFromActiveTagEdit()
insertSearchTermsFromTagEdit(m_tagEditorWidget->activeTagEdit());
}
void DbQueryWidget::showResultsContextMenu()
void DbQueryWidget::showResultsContextMenu(const QPoint &pos)
{
const auto *const selectionModel = m_ui->resultsTreeView->selectionModel();
if (!selectionModel) {
@ -482,7 +482,7 @@ void DbQueryWidget::showResultsContextMenu()
contextMenu.addAction(
QIcon::fromTheme(QStringLiteral("internet-web-browser")), tr("Show in browser"), this, &DbQueryWidget::openSelectionInBrowser);
}
m_contextMenuPos = QCursor::pos();
m_contextMenuPos = m_ui->resultsTreeView->viewport()->mapToGlobal(pos);
contextMenu.exec(m_contextMenuPos);
}

View File

@ -50,7 +50,7 @@ private slots:
void showResults();
void setStatus(bool aborted);
void fileStatusChanged(bool opened, bool hasTags);
void showResultsContextMenu();
void showResultsContextMenu(const QPoint &pos);
#ifndef QT_NO_CLIPBOARD
void copySelectedResult();
#endif