mirror of
https://invent.kde.org/system/dolphin
synced 2024-09-12 12:54:29 +00:00
[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.
This commit is contained in:
parent
3c9efb362a
commit
9f2bb143b5
|
@ -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. */
|
||||
|
|
Loading…
Reference in a new issue