aboutsummaryrefslogtreecommitdiffstats
path: root/backend-shared
diff options
context:
space:
mode:
Diffstat (limited to 'backend-shared')
-rw-r--r--backend-shared/CMakeLists.txt2
-rw-r--r--backend-shared/roundrectitem.cpp18
-rw-r--r--backend-shared/roundrectitem.h15
3 files changed, 35 insertions, 0 deletions
diff --git a/backend-shared/CMakeLists.txt b/backend-shared/CMakeLists.txt
index fdfdb1e05..736b03279 100644
--- a/backend-shared/CMakeLists.txt
+++ b/backend-shared/CMakeLists.txt
@@ -5,6 +5,8 @@ set(BACKEND_SRCS
exportfuncs.h
plannershared.cpp
plannershared.h
+ roundrectitem.cpp
+ roundrectitem.h
)
add_library(subsurface_backend_shared STATIC ${BACKEND_SRCS})
diff --git a/backend-shared/roundrectitem.cpp b/backend-shared/roundrectitem.cpp
new file mode 100644
index 000000000..2dbfd7b03
--- /dev/null
+++ b/backend-shared/roundrectitem.cpp
@@ -0,0 +1,18 @@
+#include "roundrectitem.h"
+#include <QPainter>
+#include <QStyleOptionGraphicsItem>
+
+RoundRectItem::RoundRectItem(double radius, QGraphicsItem *parent) : QGraphicsRectItem(parent),
+ radius(radius)
+{
+}
+
+void RoundRectItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *)
+{
+ painter->save();
+ painter->setClipRect(option->rect);
+ painter->setPen(pen());
+ painter->setBrush(brush());
+ painter->drawRoundedRect(rect(), radius, radius, Qt::AbsoluteSize);
+ painter->restore();
+}
diff --git a/backend-shared/roundrectitem.h b/backend-shared/roundrectitem.h
new file mode 100644
index 000000000..d3f58782f
--- /dev/null
+++ b/backend-shared/roundrectitem.h
@@ -0,0 +1,15 @@
+// SPDX-License-Identifier: GPL-2.0
+#ifndef ROUNDRECTITEM_H
+#define ROUNDRECTITEM_H
+
+#include <QGraphicsRectItem>
+
+class RoundRectItem : public QGraphicsRectItem {
+public:
+ RoundRectItem(double radius, QGraphicsItem *parent);
+private:
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
+ double radius;
+};
+
+#endif