{
painter
->setRenderHint
(QPainter::Antialiasing);
qDebug("itemSymbols paint()");
bBox.setHeight(height);
bBox.setWidth(width);
header.setX(width/2);
header.setY(height*0.05);
qreal newHeight = header.y();
font.setBold(true);
painter->setFont(font);
pen.setWidth(200);
painter->setPen(pen);
painter->drawText(header,"Symbols");
qreal iRows = (height-newHeight)/15;
qreal h = iRows;
qreal iCol = width/4;
qreal c = iCol;
font.setBold(false);
painter->setFont(font);
font2.setPointSizeF(4);
painter->setFont(font2);
for(int i = 0;i<vPics.size();i++)
{
p.setX(10.0);
p.setY(h+10);
p2.setX(60.0);
p2.setY(h);
h = h + iRows;
c = c + iCol;
//painter->drawRect(d);
//painter->drawPixmap(p,pixmap);
const char *chTemp;
chTemp = vDesc.at(i).toAscii();
//painter->drawRect(t);
//painter->drawText(QRectF(p2.x(), p.y(),120,30), Qt::AlignCenter, QObject::tr(chTemp));
}
qDebug("Drawing a box at pos %f %f", bBox.topLeft().x(), bBox.topLeft().y());
painter->drawRect(bBox);
painter->drawPoint(centerPos);
}
void itemSymbols::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
painter->setRenderHint(QPainter::Antialiasing);
qDebug("itemSymbols paint()");
bBox.setHeight(height);
bBox.setWidth(width);
QPointF header;
header.setX(width/2);
header.setY(height*0.05);
qreal newHeight = header.y();
QFont font;
font.setBold(true);
painter->setFont(font);
QPen pen;
pen.setWidth(200);
painter->setPen(pen);
painter->drawText(header,"Symbols");
qreal iRows = (height-newHeight)/15;
qreal h = iRows;
qreal iCol = width/4;
qreal c = iCol;
font.setBold(false);
painter->setFont(font);
QFont font2;
font2.setPointSizeF(4);
painter->setFont(font2);
for(int i = 0;i<vPics.size();i++)
{
QPointF p;
p.setX(10.0);
p.setY(h+10);
QPointF p2;
p2.setX(60.0);
p2.setY(h);
h = h + iRows;
c = c + iCol;
QPixmap pixmap(vPics.at(i));
QRectF d = QRectF(p.x(),p.y(),28,28);
//painter->drawRect(d);
//painter->drawPixmap(p,pixmap);
const char *chTemp;
chTemp = vDesc.at(i).toAscii();
QRectF t = QRectF(p2.x(), p.y(),120,30);
//painter->drawRect(t);
//painter->drawText(QRectF(p2.x(), p.y(),120,30), Qt::AlignCenter, QObject::tr(chTemp));
}
qDebug("Drawing a box at pos %f %f", bBox.topLeft().x(), bBox.topLeft().y());
painter->drawRect(bBox);
painter->drawPoint(centerPos);
}
To copy to clipboard, switch view to plain text mode
Bookmarks