| 1 |
// Copyright (C) 2016 The Qt Company Ltd. |
| 2 |
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
| 3 |
|
| 4 |
#ifndef CUSTOMITEM_H |
| 5 |
#define CUSTOMITEM_H |
| 6 |
|
| 7 |
#include <QGraphicsItem> |
| 8 |
#include <QBrush> |
| 9 |
#include <QGraphicsScene> |
| 10 |
|
| 11 |
class CustomGroup : public QGraphicsItemGroup |
| 12 |
{ |
| 13 |
public: |
| 14 |
CustomGroup(); |
| 15 |
virtual ~CustomGroup() { } |
| 16 |
|
| 17 |
protected: |
| 18 |
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); |
| 19 |
virtual QRectF boundingRect() const; |
| 20 |
}; |
| 21 |
|
| 22 |
class CustomItem : public QGraphicsRectItem |
| 23 |
{ |
| 24 |
public: |
| 25 |
CustomItem(qreal x, qreal y, qreal width, qreal height, const QBrush & brush = QBrush()); |
| 26 |
virtual ~CustomItem() { } |
| 27 |
}; |
| 28 |
|
| 29 |
class CustomScene : public QGraphicsScene |
| 30 |
{ |
| 31 |
Q_OBJECT |
| 32 |
public: |
| 33 |
CustomScene() : QGraphicsScene() { } |
| 34 |
|
| 35 |
QList<CustomItem*> selectedCustomItems() const; |
| 36 |
QList<CustomGroup*> selectedCustomGroups() const; |
| 37 |
}; |
| 38 |
|
| 39 |
#endif // CUSTOMITEM_H |