mirror of
https://invent.kde.org/system/dolphin
synced 2024-11-05 18:47:12 +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
3 changed files with 5 additions and 9 deletions
|
@ -214,12 +214,10 @@ void FoldersPanel::slotItemMiddleClicked(int index)
|
||||||
|
|
||||||
void FoldersPanel::slotItemContextMenuRequested(int index, const QPointF& pos)
|
void FoldersPanel::slotItemContextMenuRequested(int index, const QPointF& pos)
|
||||||
{
|
{
|
||||||
Q_UNUSED(pos);
|
|
||||||
|
|
||||||
const KFileItem fileItem = m_model->fileItem(index);
|
const KFileItem fileItem = m_model->fileItem(index);
|
||||||
|
|
||||||
QPointer<TreeViewContextMenu> contextMenu = new TreeViewContextMenu(this, fileItem);
|
QPointer<TreeViewContextMenu> contextMenu = new TreeViewContextMenu(this, fileItem);
|
||||||
contextMenu.data()->open();
|
contextMenu.data()->open(pos.toPoint());
|
||||||
if (contextMenu.data()) {
|
if (contextMenu.data()) {
|
||||||
delete contextMenu.data();
|
delete contextMenu.data();
|
||||||
}
|
}
|
||||||
|
@ -227,10 +225,8 @@ void FoldersPanel::slotItemContextMenuRequested(int index, const QPointF& pos)
|
||||||
|
|
||||||
void FoldersPanel::slotViewContextMenuRequested(const QPointF& pos)
|
void FoldersPanel::slotViewContextMenuRequested(const QPointF& pos)
|
||||||
{
|
{
|
||||||
Q_UNUSED(pos);
|
|
||||||
|
|
||||||
QPointer<TreeViewContextMenu> contextMenu = new TreeViewContextMenu(this, KFileItem());
|
QPointer<TreeViewContextMenu> contextMenu = new TreeViewContextMenu(this, KFileItem());
|
||||||
contextMenu.data()->open();
|
contextMenu.data()->open(pos.toPoint());
|
||||||
if (contextMenu.data()) {
|
if (contextMenu.data()) {
|
||||||
delete 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);
|
QMenu* popup = new QMenu(m_parent);
|
||||||
|
|
||||||
|
@ -161,7 +161,7 @@ void TreeViewContextMenu::open()
|
||||||
}
|
}
|
||||||
|
|
||||||
QPointer<QMenu> popupPtr = popup;
|
QPointer<QMenu> popupPtr = popup;
|
||||||
popup->exec(QCursor::pos());
|
popup->exec(pos);
|
||||||
if (popupPtr.data()) {
|
if (popupPtr.data()) {
|
||||||
popupPtr.data()->deleteLater();
|
popupPtr.data()->deleteLater();
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@ public:
|
||||||
~TreeViewContextMenu() override;
|
~TreeViewContextMenu() override;
|
||||||
|
|
||||||
/** Opens the context menu modal. */
|
/** Opens the context menu modal. */
|
||||||
void open();
|
void open(const QPoint& pos);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
/** Cuts the item m_fileItem. */
|
/** Cuts the item m_fileItem. */
|
||||||
|
|
Loading…
Reference in a new issue