cardIconPlayer is a QLabel and this is how I set up the icons using pixmap.
void Canvas::setUpPlayerIcons(string *pString)
{
string str;
for (int i = 0; i < MAXCARDS; i++)
{
shadow = new QGraphicsDropShadowEffect(this);
shadow->setBlurRadius(10);
cardIconPlayer
[i
] = new QLabel(cardTable
);
str = pString[i];
iconSize = qpx.size();
iconSize.scale(190, 276, Qt::KeepAspectRatio);
QPixmap scaledImage
= qpx.
scaled(iconSize, Qt
::KeepAspectRatio, Qt
::SmoothTransformation);
cardIconPlayer[i]->setPixmap(scaledImage);
cardIconPlayer[i]->move(20 + 60 * i, 350);
cardIconPlayer[i]->setGraphicsEffect(shadow);
//playerPixmaps.push_back(scaledImage);
}
}
void Canvas::setUpPlayerIcons(string *pString)
{
QPixmap qpx;
QSize iconSize;
string str;
for (int i = 0; i < MAXCARDS; i++)
{
shadow = new QGraphicsDropShadowEffect(this);
shadow->setBlurRadius(10);
cardIconPlayer[i] = new QLabel(cardTable);
str = pString[i];
qpx = QPixmap(str.c_str());
iconSize = qpx.size();
iconSize.scale(190, 276, Qt::KeepAspectRatio);
QPixmap scaledImage = qpx.scaled(iconSize, Qt::KeepAspectRatio, Qt::SmoothTransformation);
cardIconPlayer[i]->setPixmap(scaledImage);
cardIconPlayer[i]->move(20 + 60 * i, 350);
cardIconPlayer[i]->setGraphicsEffect(shadow);
//playerPixmaps.push_back(scaledImage);
}
}
To copy to clipboard, switch view to plain text mode
Just to get this straight. Are you saying I should use QRect instead of QPoint.
Bookmarks