Remove "custom on success" logic from Image.
Create a new message element and message layout element type for mod badges.
This commit is contained in:
@@ -168,6 +168,33 @@ int ImageLayoutElement::getXFromIndex(int index)
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// IMAGE WITH BACKGROUND
|
||||
//
|
||||
ImageWithBackgroundLayoutElement::ImageWithBackgroundLayoutElement(
|
||||
MessageElement &creator, ImagePtr image, const QSize &size, QColor color)
|
||||
: ImageLayoutElement(creator, image, size)
|
||||
, color_(color)
|
||||
{
|
||||
}
|
||||
|
||||
void ImageWithBackgroundLayoutElement::paint(QPainter &painter)
|
||||
{
|
||||
if (this->image_ == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
auto pixmap = this->image_->pixmapOrLoad();
|
||||
if (pixmap && !this->image_->animated())
|
||||
{
|
||||
painter.fillRect(QRectF(this->getRect()), this->color_);
|
||||
|
||||
// fourtf: make it use qreal values
|
||||
painter.drawPixmap(QRectF(this->getRect()), *pixmap, QRectF());
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// TEXT
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user