Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 9f2bb143 authored by Elvis Angelaccio's avatar Elvis Angelaccio

[FoldersPanel] Stop ignoring positions from the controller

This fixes the position of Folder panel's context menus on multi-screens
on Wayland, because `QCursor::pos()` is not reliable on those setups.
parent 3c9efb36
......@@ -214,12 +214,10 @@ void FoldersPanel::slotItemMiddleClicked(int index)
void FoldersPanel::slotItemContextMenuRequested(int index, const QPointF& pos)
{
Q_UNUSED(pos);
const KFileItem fileItem = m_model->fileItem(index);
QPointer<TreeViewContextMenu> contextMenu = new TreeViewContextMenu(this, fileItem);
contextMenu.data()->open();
contextMenu.data()->open(pos.toPoint());
if (contextMenu.data()) {
delete contextMenu.data();
}
......@@ -227,10 +225,8 @@ void FoldersPanel::slotItemContextMenuRequested(int index, const QPointF& pos)
void FoldersPanel::slotViewContextMenuRequested(const QPointF& pos)
{
Q_UNUSED(pos);
QPointer<TreeViewContextMenu> contextMenu = new TreeViewContextMenu(this, KFileItem());
contextMenu.data()->open();
contextMenu.data()->open(pos.toPoint());
if (contextMenu.data()) {
delete contextMenu.data();
}
......
......@@ -55,7 +55,7 @@ TreeViewContextMenu::~TreeViewContextMenu()
{
}
void TreeViewContextMenu::open()
void TreeViewContextMenu::open(const QPoint& pos)
{
QMenu* popup = new QMenu(m_parent);
......@@ -161,7 +161,7 @@ void TreeViewContextMenu::open()
}
QPointer<QMenu> popupPtr = popup;
popup->exec(QCursor::pos());
popup->exec(pos);
if (popupPtr.data()) {
popupPtr.data()->deleteLater();
}
......
......@@ -49,7 +49,7 @@ public:
~TreeViewContextMenu() override;
/** Opens the context menu modal. */
void open();
void open(const QPoint& pos);
private slots:
/** Cuts the item m_fileItem. */
......
Markdown is supported
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