[X2Go-Commits] [x2goplasmabindings] 02/02: plasmoidhoveredicon.{cpp, h}: use QFrame in Plasma 5 mode, where Plasma::Frame is not available.
git-admin at x2go.org
git-admin at x2go.org
Mon May 8 23:35:21 CEST 2023
This is an automated email from the git hooks/post-receive script.
x2go pushed a commit to branch master
in repository x2goplasmabindings.
commit 4e5a987cbc5a63ca2ef28ed691b86abb3766d87b
Author: Mihai Moldovan <ionic at ionic.de>
Date: Mon May 8 23:34:53 2023 +0200
plasmoidhoveredicon.{cpp,h}: use QFrame in Plasma 5 mode, where Plasma::Frame is not available.
We try to recreate the previous look by using a StyledFrame with the
default lineWidth of one.
---
debian/changelog | 3 +++
plasmoidhovereditem.cpp | 25 ++++++++++++++++++++++++-
plasmoidhovereditem.h | 13 ++++++++++++-
3 files changed, 39 insertions(+), 2 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index 12a784c..6ef9cb4 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -28,6 +28,9 @@ x2goplasmabindings (3.0.2.3-0x2go1) UNRELEASED; urgency=medium
- CMakeLists.txt: include ECMInstallIcons module.
- /: add plasma_compat.h, defining the helper macro
X2GOPLASMOID_PLASMA5_COMPAT if we're building against Plasma 5.
+ - plasmoidhoveredicon.{cpp,h}: use QFrame in Plasma 5 mode, where
+ Plasma::Frame is not available. We try to recreate the previous look by
+ using a StyledFrame with the default lineWidth of one.
* debian/control:
+ Adapt description to also mention KDE 5.
+ Build-Depend on libkf5plasma-dev and libkf5i18n-dev, with a fallback to
diff --git a/plasmoidhovereditem.cpp b/plasmoidhovereditem.cpp
index 2bc73af..f143a7f 100644
--- a/plasmoidhovereditem.cpp
+++ b/plasmoidhovereditem.cpp
@@ -19,16 +19,27 @@
Boston, MA 02110-1301, USA.
*/
+#include "plasma_compat.h"
#include "plasmoidhovereditem.h"
#include <QDebug>
+#ifdef X2GOPLASMOID_PLASMA5_COMPAT
+#include <QFrame>
+#else
#include <plasma/widgets/frame.h>
+#endif
#include <plasma/widgets/iconwidget.h>
#include <plasma/widgets/label.h>
#include <QGraphicsLinearLayout>
-PlasmoidHoveredItem::PlasmoidHoveredItem(QGraphicsWidget* parent): Plasma::Frame(parent),label(0),icon(0)
+PlasmoidHoveredItem::PlasmoidHoveredItem(QGraphicsWidget* parent):
+#ifdef X2GOPLASMOID_PLASMA5_COMPAT
+ QFrame (parent)
+#else
+ Plasma::Frame(parent)
+#endif
+ , label(0),icon(0)
{
setAcceptHoverEvents(true);
setZValue(0);
@@ -41,6 +52,10 @@ PlasmoidHoveredItem::PlasmoidHoveredItem(QGraphicsWidget* parent): Plasma::Frame
icon->setAcceptHoverEvents(false);
icon->setAcceptedMouseButtons(0);
icon->setMaximumWidth(18);
+
+#ifdef X2GOPLASMOID_PLASMA5_COMPAT
+ this->setFrameStyle (QFrame::StyledPanel | QFrame::Plain);
+#endif
}
PlasmoidHoveredItem::~PlasmoidHoveredItem()
@@ -54,13 +69,21 @@ void PlasmoidHoveredItem::buttonPressed()
void PlasmoidHoveredItem::hoverEnter()
{
+#ifdef X2GOPLASMOID_PLASMA5_COMPAT
+ this->setFrameStyle (this->frameShape () | QFrame::Raised);
+#else
setFrameShadow(Plasma::Frame::Raised);
+#endif
update();
}
void PlasmoidHoveredItem::hoverLeave()
{
+#ifdef X2GOPLASMOID_PLASMA5_COMPAT
+ this->setFrameStyle (this->frameShape () | QFrame::Plain);
+#else
setFrameShadow(Plasma::Frame::Plain);
+#endif
update();
}
diff --git a/plasmoidhovereditem.h b/plasmoidhovereditem.h
index 4ef6f12..bc254f1 100644
--- a/plasmoidhovereditem.h
+++ b/plasmoidhovereditem.h
@@ -22,14 +22,25 @@
#ifndef SHAREITEM_H
#define SHAREITEM_H
+#include "plasma_compat.h"
+
+#ifdef X2GOPLASMOID_PLASMA5_COMPAT
+#include <QFrame>
+#else
#include <plasma/widgets/frame.h>
+#endif
#include <QObject>
#include <plasma/widgets/label.h>
#include <plasma/widgets/iconwidget.h>
class QGraphicsLinearLayout;
-class PlasmoidHoveredItem : public Plasma::Frame
+class PlasmoidHoveredItem : public
+#ifdef X2GOPLASMOID_PLASMA5_COMPAT
+ QFrame
+#else
+ Plasma::Frame
+#endif
{
Q_OBJECT
public:
--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goplasmabindings.git
More information about the x2go-commits
mailing list