ruphy / raptor

menu for KDE 4

Bruno Abinader (author)
Wed Apr 22 06:36:10 -0700 2009
ruphy (committer)
Sun Apr 26 10:35:37 -0700 2009
raptor / view / breadcrumb.h
100644 70 lines (53 sloc) 1.757 kb
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
70
/* This file is part of the KDE project
 
Copyright (C) 2009 Alessandro Diaferia <alediaferia@gmail.com>
Copyright (C) 2009 Lukas Appelhans <l.appelhans@gmx.de>
 
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
*/
#ifndef BREADCRUMB_H
#define BREADCRUMB_H
 
#include <QGraphicsWidget>
#include <QList>
 
class BreadcrumbItem;
class QModelIndex;
class QAbstractItemModel;
class QGraphicsSceneResizeEvent;
class QGraphicsSceneMouseEvent;
class QRectF;
class QTimeLine;
class RaptorGraphicsView;
 
class Breadcrumb : public QGraphicsWidget
{
    Q_OBJECT
public:
    Breadcrumb(RaptorGraphicsView *view, QGraphicsWidget *parent = 0);
    ~Breadcrumb();
 
    void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
 
    void updateItemRects();
 
public slots:
    void setCurrentItem(const QModelIndex &index);
 
signals:
    /**
* This signal is emitted when the user clicks an
* item of the breadcrumb.
*/
    void changedRootIndex(const QModelIndex &);
 
    void rootMenuRequested();
 
private:
    RaptorGraphicsView *m_view;
    QList<BreadcrumbItem*> m_items;
    BreadcrumbItem *m_currentShowing;
    QTimeLine *m_timeLine;
    qreal m_realFrame;
 
protected:
    void resizeEvent(QGraphicsSceneResizeEvent *event);
 
    void mousePressEvent(QGraphicsSceneMouseEvent *event);
 
    void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
    void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
    void hoverMoveEvent(QGraphicsSceneHoverEvent *event);
 
protected slots:
    void animate();
};
 
#endif