Fix remaining context menus for Wayland

This commit is contained in:
Martchus 2019-07-20 18:49:32 +02:00
parent 46637093db
commit 864fd1c901
6 changed files with 12 additions and 12 deletions

View File

@ -739,7 +739,7 @@ void PicturePreviewSelection::updatePreview(int index)
m_rectItem->setRect(0, 0, m_ui->previewGraphicsView->width(), m_ui->previewGraphicsView->height());
}
void PicturePreviewSelection::showContextMenu()
void PicturePreviewSelection::showContextMenu(const QPoint &position)
{
QMenu menu;
auto *const addAction = menu.addAction(m_ui->addButton->text());
@ -786,7 +786,7 @@ void PicturePreviewSelection::showContextMenu()
displayAction->setIcon(QIcon::fromTheme(QStringLiteral("image-x-generic")));
connect(displayAction, &QAction::triggered, this, &PicturePreviewSelection::displaySelected);
}
menu.exec(QCursor::pos());
menu.exec(m_ui->previewGraphicsView->viewport()->mapToGlobal(position));
}
} // namespace QtGui

View File

@ -76,7 +76,7 @@ private slots:
void updateDescription(int newIndex);
void updateDescription(int lastIndex, int newIndex);
void updatePreview(int index);
void showContextMenu();
void showContextMenu(const QPoint &position);
private:
bool setup(PreviousValueHandling previousValueHandling = PreviousValueHandling::Clear);

View File

@ -359,13 +359,13 @@ void RenameFilesDialog::pasteDefaultExampleScript()
pasteScriptFromFile(QStringLiteral(":/scripts/renamefiles/example1"));
}
void RenameFilesDialog::showTreeViewContextMenu()
void RenameFilesDialog::showTreeViewContextMenu(const QPoint &position)
{
if (const QTreeView *sender = qobject_cast<const QTreeView *>(QObject::sender())) {
QMenu menu;
menu.addAction(tr("Expand all"), sender, &QTreeView::expandAll);
menu.addAction(tr("Collapse all"), sender, &QTreeView::collapseAll);
menu.exec(QCursor::pos());
menu.exec(sender->viewport()->mapToGlobal(position));
}
}

View File

@ -46,7 +46,7 @@ private slots:
void pasteScriptFromFile(const QString &fileName);
void pasteScriptFromClipboard();
void pasteDefaultExampleScript();
void showTreeViewContextMenu();
void showTreeViewContextMenu(const QPoint &position);
void showSelectScriptFileDlg();
void abortClose();
void toggleScriptSource();

View File

@ -718,7 +718,7 @@ void TagEditorWidget::updateInfoView()
}
}
void TagEditorWidget::showInfoTreeViewContextMenu(const QPoint &)
void TagEditorWidget::showInfoTreeViewContextMenu(const QPoint &position)
{
QAction copyAction(QIcon::fromTheme(QStringLiteral("edit-copy")), tr("Copy"), nullptr);
copyAction.setDisabled(m_infoTreeView->selectionModel()->selectedIndexes().isEmpty());
@ -743,14 +743,14 @@ void TagEditorWidget::showInfoTreeViewContextMenu(const QPoint &)
menu.addSeparator();
menu.addAction(&expandAllAction);
menu.addAction(&collapseAllAction);
menu.exec(QCursor::pos());
menu.exec(m_infoTreeView->viewport()->mapToGlobal(position));
}
#ifndef TAGEDITOR_NO_WEBVIEW
/*!
* \brief Shows the context menu for the info web view.
*/
void TagEditorWidget::showInfoWebViewContextMenu(const QPoint &)
void TagEditorWidget::showInfoWebViewContextMenu(const QPoint &position)
{
QAction copyAction(QIcon::fromTheme(QStringLiteral("edit-copy")), tr("Copy"), nullptr);
copyAction.setDisabled(m_infoWebView->selectedText().isEmpty());
@ -765,7 +765,7 @@ void TagEditorWidget::showInfoWebViewContextMenu(const QPoint &)
menu.addAction(&copyAction);
menu.addAction(&saveAction);
menu.addAction(&openAction);
menu.exec(QCursor::pos());
menu.exec(m_infoWebView->mapToGlobal(position));
}
#endif

View File

@ -114,9 +114,9 @@ private slots:
// info (web) view
void initInfoView();
void updateInfoView();
void showInfoTreeViewContextMenu(const QPoint &);
void showInfoTreeViewContextMenu(const QPoint &position);
#ifndef TAGEDITOR_NO_WEBVIEW
void showInfoWebViewContextMenu(const QPoint &);
void showInfoWebViewContextMenu(const QPoint &position);
#endif
bool handleFileInfoUnavailable();
bool writeFileInfoToFile(QFile &file);