┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/panels/information/informationpanelcontent.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/panels/information/informationpanelcontent.cpp')
-rw-r--r--src/panels/information/informationpanelcontent.cpp55
1 files changed, 37 insertions, 18 deletions
diff --git a/src/panels/information/informationpanelcontent.cpp b/src/panels/information/informationpanelcontent.cpp
index 9db7f8bb7..ded88bd96 100644
--- a/src/panels/information/informationpanelcontent.cpp
+++ b/src/panels/information/informationpanelcontent.cpp
@@ -1,21 +1,8 @@
-/***************************************************************************
- * Copyright (C) 2009 by Peter Penz <[email protected]> *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the *
- * Free Software Foundation, Inc., *
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
- ***************************************************************************/
+/*
+ * SPDX-FileCopyrightText: 2009 Peter Penz <[email protected]>
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
#include "informationpanelcontent.h"
@@ -46,11 +33,13 @@
#include <QTextLayout>
#include <QTimer>
#include <QVBoxLayout>
+#include <QScroller>
#include <QStyle>
#include <QPainter>
#include <QBitmap>
#include <QLinearGradient>
#include <QPolygon>
+#include <QGesture>
#include "dolphin_informationpanelsettings.h"
#include "phononwidget.h"
@@ -147,6 +136,7 @@ InformationPanelContent::InformationPanelContent(QWidget* parent) :
m_metaDataArea->setFrameShape(QFrame::NoFrame);
QWidget* viewport = m_metaDataArea->viewport();
+ QScroller::grabGesture(viewport, QScroller::TouchGesture);
viewport->installEventFilter(this);
layout->addWidget(m_preview);
@@ -157,6 +147,8 @@ InformationPanelContent::InformationPanelContent(QWidget* parent) :
layout->addWidget(m_metaDataArea);
layout->addWidget(m_configureButtons);
+ grabGesture(Qt::TapAndHoldGesture);
+
m_placesItemModel = new PlacesItemModel(this);
}
@@ -351,6 +343,33 @@ bool InformationPanelContent::eventFilter(QObject* obj, QEvent* event)
return QWidget::eventFilter(obj, event);
}
+bool InformationPanelContent::event(QEvent* event)
+{
+ if (event->type() == QEvent::Gesture) {
+ gestureEvent(static_cast<QGestureEvent*>(event));
+ return true;
+ }
+ return QWidget::event(event);
+}
+
+bool InformationPanelContent::gestureEvent(QGestureEvent* event)
+{
+ if (!underMouse()) {
+ return false;
+ }
+
+ QTapAndHoldGesture* tap = static_cast<QTapAndHoldGesture*>(event->gesture(Qt::TapAndHoldGesture));
+
+ if (tap) {
+ if (tap->state() == Qt::GestureFinished) {
+ emit contextMenuRequested(tap->position().toPoint());
+ }
+ event->accept();
+ return true;
+ }
+ return false;
+}
+
void InformationPanelContent::showIcon(const KFileItem& item)
{
m_outdatedPreviewTimer->stop();