Commit 468d6cdc authored by Waqar Ahmed's avatar Waqar Ahmed Committed by Christoph Cullmann
Browse files

Avoid some usages of QCursor::pos

Its not wayland friendly and makes little sense to use it when the right
position is already available in the function parameter.
parent acc47c7d
Pipeline #255527 canceled with stage
......@@ -25,5 +25,5 @@ void DataOutputView::slotCustomContextMenuRequested(const QPoint &pos)
menu.addActions(actions());
menu.exec(QCursor::pos());
menu.exec(mapToGlobal(pos));
}
......@@ -281,7 +281,7 @@ void SchemaWidget::slotCustomContextMenuRequested(const QPoint &pos)
}
menu.addAction(QIcon::fromTheme(QStringLiteral("view-refresh")), i18nc("@action:inmenu Context menu", "Refresh"), this, &SchemaWidget::refresh);
menu.exec(QCursor::pos());
menu.exec(mapToGlobal(pos));
}
QString SchemaWidget::generateStatement(QSqlDriver::StatementType statementType)
......
......@@ -960,8 +960,8 @@ public:
auto menu = new QMenu(treeView);
menu->addAction(i18n("Expand All"), treeView, &QTreeView::expandAll);
menu->addAction(i18n("Collapse All"), treeView, &QTreeView::collapseAll);
auto h = [menu](const QPoint &) {
menu->popup(QCursor::pos());
auto h = [treeView, menu](const QPoint &p) {
menu->popup(treeView->viewport()->mapToGlobal(p));
};
if (m_diagnosticsTree == treeView) {
connect(treeView, &QTreeView::customContextMenuRequested, this, &self_type::onDiagnosticsMenu);
......@@ -2521,7 +2521,7 @@ public:
menu->addAction(i18n("Enable Suppression"), this, std::bind(h, true));
}
}
menu->popup(QCursor::pos());
menu->popup(treeView->viewport()->mapToGlobal(pos));
}
Q_SLOT void onMarkClicked(KTextEditor::Document *document, KTextEditor::Mark mark, bool &handled)
......
......@@ -317,9 +317,9 @@ public:
displayOptionChanged();
}
void showContextMenu(const QPoint &)
void showContextMenu(const QPoint &pos)
{
m_popup->popup(QCursor::pos(), m_treeOn);
m_popup->popup(m_symbols->viewport()->mapToGlobal(pos), m_treeOn);
}
void onViewState(KTextEditor::View *, LSPClientViewTracker::State newState)
......
......@@ -23,10 +23,13 @@ MatchExportDialog::MatchExportDialog(QWidget *parent, QAbstractItemModel *matchM
exportPatternText->addAction(QIcon::fromTheme(QStringLiteral("code-context")), QLineEdit::TrailingPosition);
connect(exportPatternTextActionForInsertRegexButton, &QAction::triggered, this, [this]() {
QPoint pos = exportPatternText->pos();
pos.rx() += exportPatternText->width() - ((16 + 4) * devicePixelRatioF());
pos.ry() += exportPatternText->height();
QMenu menu(this);
QSet<QAction *> actionList;
KatePluginSearchView::addRegexHelperActionsForReplace(&actionList, &menu);
auto &&action = menu.exec(QCursor::pos());
auto action = menu.exec(mapToGlobal(pos));
KatePluginSearchView::regexHelperActOnAction(action, actionList, exportPatternText);
});
......
......@@ -286,9 +286,9 @@ bool KatePluginSymbolViewerView::eventFilter(QObject *obj, QEvent *event)
return QObject::eventFilter(obj, event);
}
void KatePluginSymbolViewerView::slotShowContextMenu(const QPoint &)
void KatePluginSymbolViewerView::slotShowContextMenu(const QPoint &pos)
{
m_popup->popup(QCursor::pos(), m_treeOn);
m_popup->popup(m_symbols->viewport()->mapToGlobal(pos), m_treeOn);
}
/**
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment