dolphinview: Fix right click broken on placeholderLabel

* 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>
This commit is contained in:
Davide Garberi 2023-01-25 22:44:17 +01:00 committed by Felix Ernst
parent e4e68b90b1
commit f0d201dcf1

View 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);