diff options
| author | oldmud0 <oldmud0@users.noreply.github.com> | 2020-10-21 21:32:33 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-10-21 21:32:33 -0500 |
| commit | 30be47ebfc6260fd1d9297a6b10f467b5b34a4e1 (patch) | |
| tree | 1861687a8b2f4e8a54f2e9270b6bd2db36657a28 /src/aoimage.cpp | |
| parent | 849f91d991bf0e95d579df268e9ab358e09b1ac1 (diff) | |
| parent | f4cdb3954f500679bf61f0ac2815722669ec595a (diff) | |
Merge pull request #322 from AttorneyOnline/in1tiate/aoimage-masking
Add proper alpha masking to AOImage elements
Diffstat (limited to 'src/aoimage.cpp')
| -rw-r--r-- | src/aoimage.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/aoimage.cpp b/src/aoimage.cpp index 2663ba05..3977c979 100644 --- a/src/aoimage.cpp +++ b/src/aoimage.cpp @@ -2,6 +2,8 @@ #include "aoimage.h" +#include <QBitmap> + AOImage::AOImage(QWidget *parent, AOApplication *p_ao_app) : QLabel(parent) { m_parent = parent; @@ -29,9 +31,10 @@ bool AOImage::set_image(QString p_image) } QPixmap f_pixmap(final_image_path); - - this->setPixmap( - f_pixmap.scaled(this->width(), this->height(), Qt::IgnoreAspectRatio)); + f_pixmap = + f_pixmap.scaled(this->width(), this->height(), Qt::IgnoreAspectRatio); + this->setPixmap(f_pixmap); + this->setMask(f_pixmap.mask()); return true; } @@ -45,7 +48,9 @@ bool AOImage::set_chatbox(QString p_path) QPixmap f_pixmap(p_path); - this->setPixmap( - f_pixmap.scaled(this->width(), this->height(), Qt::IgnoreAspectRatio)); + f_pixmap = + f_pixmap.scaled(this->width(), this->height(), Qt::IgnoreAspectRatio); + this->setPixmap(f_pixmap); + this->setMask(f_pixmap.mask()); return true; } |
