|
@@ -1,10 +1,55 @@
|
|
|
#ifndef JIOMAPPAGE_H
|
|
|
#define JIOMAPPAGE_H
|
|
|
+#include "TreeViewManagerHead.h"
|
|
|
+#include <QMouseEvent>
|
|
|
|
|
|
-class JIoMapPage
|
|
|
+class ClickCircleLabel : public QLabel {
|
|
|
+ Q_OBJECT
|
|
|
+
|
|
|
+public:
|
|
|
+ ClickCircleLabel(QWidget* parent = nullptr)
|
|
|
+ : QLabel(parent), m_bClicked(false)
|
|
|
+ {
|
|
|
+ setFixedSize(30, 30);
|
|
|
+ }
|
|
|
+
|
|
|
+protected:
|
|
|
+ void paintEvent(QPaintEvent* event) override
|
|
|
+ {
|
|
|
+ QLabel::paintEvent(event);
|
|
|
+
|
|
|
+ QPainter painter(this);
|
|
|
+ painter.setRenderHint(QPainter::Antialiasing);
|
|
|
+ int radius = qMin(width(), height()) / 2 - 5;
|
|
|
+ int x = (width() - 2 * radius) / 2;
|
|
|
+ int y = (height() - 2 * radius) / 2;
|
|
|
+
|
|
|
+ painter.setPen(Qt::NoPen);
|
|
|
+ painter.setBrush(m_bClicked ? Qt::red : Qt::gray);
|
|
|
+ painter.drawEllipse(x, y, 2 * radius, 2 * radius);
|
|
|
+ }
|
|
|
+
|
|
|
+ void mousePressEvent(QMouseEvent* event) override
|
|
|
+ {
|
|
|
+ if (event->button() == Qt::LeftButton)
|
|
|
+ {
|
|
|
+ m_bClicked = !m_bClicked;
|
|
|
+ update();
|
|
|
+ }
|
|
|
+ QLabel::mousePressEvent(event);
|
|
|
+ }
|
|
|
+
|
|
|
+private:
|
|
|
+ bool m_bClicked; // 当前状态
|
|
|
+};
|
|
|
+
|
|
|
+class JIoMapPage :public QObject
|
|
|
{
|
|
|
+ Q_OBJECT
|
|
|
public:
|
|
|
JIoMapPage();
|
|
|
+
|
|
|
+ static QWidget* CreateIoPage();
|
|
|
};
|
|
|
|
|
|
#include <QApplication>
|