]> cloud.milkyroute.net Git - dolphin.git/commitdiff
dolphinview: Fix right click broken on placeholderLabel
authorDavide Garberi <dade.garberi@gmail.com>
Wed, 25 Jan 2023 21:44:17 +0000 (22:44 +0100)
committerFelix Ernst <felixernst@kde.org>
Wed, 1 Feb 2023 10:20:09 +0000 (10:20 +0000)
* This commit fixes the right click context menu not being shown
  whenever the click is made right on the placeholderLabel text

Signed-off-by: Davide Garberi <dade.garberi@gmail.com>
src/views/dolphinview.cpp

index c84e642dc8a0362cb19d5acae4d4345dc5faf9e4..d16aa3b09207631afe265b7d429ccba98dd39aea 100644 (file)
@@ -161,6 +161,10 @@ DolphinView::DolphinView(const QUrl& url, QWidget* parent) :
     auto *centeringLayout = new QVBoxLayout(m_container);
     centeringLayout->addWidget(m_placeholderLabel);
     centeringLayout->setAlignment(m_placeholderLabel, Qt::AlignCenter);
+    m_placeholderLabel->setContextMenuPolicy(Qt::CustomContextMenu);
+    connect(m_placeholderLabel, &QWidget::customContextMenuRequested, this, [this](const QPoint& pos){
+        slotViewContextMenuRequested(m_placeholderLabel->mapToGlobal(pos));
+    });
 
     controller->setSelectionBehavior(KItemListController::MultiSelection);
     connect(controller, &KItemListController::itemActivated, this, &DolphinView::slotItemActivated);