summaryrefslogtreecommitdiff
path: root/tests/manual/qgraphicsitemgroup/customitem.h
blob: 30a41b0699a31c85ee1eee526a1115579225c9b9 (plain)
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
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0

#ifndef CUSTOMITEM_H
#define CUSTOMITEM_H

#include <QGraphicsItem>
#include <QBrush>
#include <QGraphicsScene>

class CustomGroup : public QGraphicsItemGroup
{
public:
    CustomGroup();
    virtual ~CustomGroup() { }

protected:
    virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
    virtual QRectF boundingRect() const;
};

class CustomItem : public QGraphicsRectItem
{
public:
    CustomItem(qreal x, qreal y, qreal width, qreal height, const QBrush & brush = QBrush());
    virtual ~CustomItem() { }
};

class CustomScene : public QGraphicsScene
{
    Q_OBJECT
public:
    CustomScene() : QGraphicsScene() { }

    QList<CustomItem*> selectedCustomItems() const;
    QList<CustomGroup*> selectedCustomGroups() const;
};

#endif // CUSTOMITEM_H