summaryrefslogtreecommitdiffstats
path: root/examples/animation/piemenu/scene.cpp
blob: 08aad06944d154ec84100caa4e79b515e33b89c2 (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
40
41
42
43
/****************************************************************************
**
** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information (qt-info@nokia.com)
**
** This file is part of the $MODULE$ of the Qt Toolkit.
**
** $TROLLTECH_DUAL_LICENSE$
**
****************************************************************************/

#include "qgraphicspiemenu.h"
#include "scene.h"

#include <QtGui/qaction.h>
#include <QtGui/qgraphicssceneevent.h>

Scene::Scene(qreal x, qreal y, qreal width, qreal height, QObject *parent)
    : QGraphicsScene(x, y, width, height, parent)
{
}

Scene::Scene(const QRectF &sceneRect, QObject *parent)
    : QGraphicsScene(sceneRect, parent)
{
}

Scene::Scene(QObject *parent)
    : QGraphicsScene(parent)
{
}

Scene::~Scene()
{
}

void Scene::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
    QGraphicsPieMenu *menu = new QGraphicsPieMenu;
    for (int i = 0; i < 5; ++i)
        menu->addAction(new QAction(QString("Item %1").arg(i), menu));
    menu->popup(event->scenePos());
}