QRectF Painting::boundingRect() const{ return QRectF(x,y,5,5);}void Painting::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget){ QRectF rec = boundingRect(); QBrush brush; QPen pen; if(type<7) { pen = QPen(Qt::black); } else if(type<9) { pen = QPen(Qt::black); setRotation(45); } else { pen = QPen(Qt::NoPen); brush = QBrush(Qt::SolidPattern); } painter->setPen(pen); painter->setBrush(brush); painter->drawRect(rec);}
paint = new Painting(current_pos, pointY, time_in,time_out,type, "sound/1.WAV"); scene->addItem(paint); paint->rotate(45);
return QRectF(x,y,5,5);
QRectF(0,0,5,5);
Painting::Painting(int x, int y, int time_in, int time_out, int type, QString sound){........ setPos(mapToParent(x, y)); setRotation(45); }