-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwidgetstyle.h
69 lines (56 loc) · 2.06 KB
/
widgetstyle.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#ifndef WIDGETSTYLE_H
#define WIDGETSTYLE_H
#include "src/common.h"
#include "src/graphicswidget.h"
#include "src/coreEditor/coreeditor.h"
#include <QtWidgets>
namespace Ui {
class WidgetStyle;
}
class WidgetStyle : public QWidget
{
Q_OBJECT
public:
explicit WidgetStyle(QWidget* parent = nullptr);
~WidgetStyle() override;
void setFocusLineEdit();
QGraphicsScene* getScene() const;
QGraphicsScene* createScene();
void setScene(QGraphicsScene* scene);
public slots:
void setStyleSheetWidget(const QString& style);
private slots:
void filterListWidget();
void selectWidget();
void deleteWidget();
void clearScene();
private:
class WidgetScene : public QGraphicsScene
{
public:
WidgetScene(qreal x, qreal y, qreal widht, qreal height, WidgetStyle* parent = nullptr);
~WidgetScene() override = default;
void addItemWidget(GraphicsWidget* wgt);
QList<GraphicsWidget*> getItemWidget() const;
GraphicsWidget* removeWidget(GraphicsWidget* wgt);
void clearWidget();
private:
WidgetStyle *m_wgtStyle = nullptr;
QGraphicsRectItem *m_rectItem = nullptr;
QPointF m_topLeftRect;
Qt::MouseButton m_mouseButton = Qt::NoButton;
QList<GraphicsWidget*> m_graphicsWgt_;
void mousePressEvent(QGraphicsSceneMouseEvent* event) override;
void mouseMoveEvent(QGraphicsSceneMouseEvent* event) override;
void mouseReleaseEvent(QGraphicsSceneMouseEvent* event) override;
};
Ui::WidgetStyle *ui = nullptr;
WidgetScene *m_scene = new WidgetScene(0, 0, 5000, 5000, this);
CoreEditor *m_editor = nullptr;
QList<GraphicsWidget*> m_deleteGraphicsWgt_;
QWidget* createWidget(const QString& name);
QWidget* setLayoutWidget(const QVector<QWidget*>& vecWgt, const QSize& size);
void distinguishRect(const QRectF& rect);
bool containsWidget(const QPointF& point);
};
#endif // WIDGETSTYLE_H