-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsakmessageitem.h
35 lines (31 loc) · 906 Bytes
/
sakmessageitem.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
#ifndef SAKMESSAGEITEM_H_
#define SAKMESSAGEITEM_H_
#include <QtGui>
class SakMessageItem : public QObject, public QGraphicsItem
{
public:
SakMessageItem(const QString& message);
~SakMessageItem();
//void setPixmap(const QPixmap &p);
//QPixmap pixmap();
void setGeometry(const QRect&);
QRectF boundingRect() const { return m_rect; }
void paint( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0 );
private:
QGraphicsPixmapItem* m_p;
QTextDocument* m_t;
QPixmap m_cachedPixmap;
QRectF m_rect;
};
class SakExitItem : public QObject, public QGraphicsPixmapItem
{
Q_OBJECT;
public:
SakExitItem(const QPixmap&p) : QGraphicsPixmapItem(p) {}
signals:
void exit();
protected:
void mousePressEvent ( QGraphicsSceneMouseEvent * ) {}
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *) { emit exit(); };
};
#endif