-
Notifications
You must be signed in to change notification settings - Fork 0
/
popup.cpp
38 lines (31 loc) · 881 Bytes
/
popup.cpp
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
#include "popup.h"
QHash<QString,QImage*> POPUP::IMAGE_CACHE;
Popup::Popup(int x,int y,QGraphicsView *view){
QPointF pt = view->mapToScene(QPoint(x,y));
qDebug("%f %f\n",pt.x(),pt.y());
this->setPos(pt.x(),pt.y());
}
Moji::Moji(QString moji,QGraphicsView *view):Popup(30,330,view){
this->moji = moji;
QGraphicsPixmapItem::setZValue(50.0);
QGraphicsPixmapItem::setPixmap(QPixmap::fromImage(POPUP::getImgcache("moji")));
qmoji = new QGraphicsTextItem(moji,this);
QFont tf;
tf.setPixelSize(20);
tf.setFamily("Fira Code");
qmoji->setDefaultTextColor(Qt::white);
qmoji->setTextWidth(550);
qmoji->setFont(tf);
qmoji->setPos(10,10);
}
void Moji::show(QGraphicsScene *scene){
scene->addItem(this);
}
void Moji::clear(QGraphicsScene *scene){
scene->removeItem(this);
delete qmoji;
}
void POPUP::init(){
//
}
//