optional add country flag to avatar feature (thx to drull)

This commit is contained in:
doitux
2010-10-26 17:31:41 +00:00
parent fbc623a704
commit 74a96a4354
6 changed files with 45 additions and 17 deletions
+23
View File
@@ -112,6 +112,29 @@ void MyAvatarLabel::setPixmap ( const QPixmap &pix, const bool trans) {
}
void MyAvatarLabel::setPixmapAndCountry ( const QPixmap &pix,QString countryString, int seatPlace, const bool trans) {
QPixmap resultAvatar(pix.scaled(50,50, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
QPainter painter(&resultAvatar);
int showCountryFlags = myW->getMyConfig()->readConfigInt("ShowCountryFlagInAvatar");
if(showCountryFlags && !countryString.isEmpty())
{
if(seatPlace<=2||seatPlace>=8)
{
painter.drawPixmap(resultAvatar.width()-(QPixmap(countryString)).width(),resultAvatar.height()-(QPixmap(countryString)).height(),QPixmap(countryString));
}
else
{
painter.drawPixmap(resultAvatar.width()-(QPixmap(countryString)).width(),0,QPixmap(countryString));
}
}
painter.end();
myPixmap = resultAvatar;
transparent = trans;
update();
}
void MyAvatarLabel::paintEvent(QPaintEvent*) {
QPainter painter(this);