Browse Source

MaskablePixmapWidget: white background, removed circular mask

pull/321/head
krepa098 11 years ago
parent
commit
de7ade033a
  1. BIN
      img/avatar_mask.png
  2. BIN
      img/avatar_mask_circle.png
  3. 2
      widget/form/genericchatform.cpp
  4. 3
      widget/maskablepixmapwidget.cpp

BIN
img/avatar_mask.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

BIN
img/avatar_mask_circle.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.1 KiB

2
widget/form/genericchatform.cpp

@ -36,7 +36,7 @@ GenericChatForm::GenericChatForm(QWidget *parent) : @@ -36,7 +36,7 @@ GenericChatForm::GenericChatForm(QWidget *parent) :
headWidget = new QWidget();
nameLabel = new CroppingLabel();
avatar = new MaskablePixmapWidget(this, QSize(40,40), ":/img/avatar_mask_circle.png");
avatar = new MaskablePixmapWidget(this, QSize(40,40), ":/img/avatar_mask.png");
QHBoxLayout *headLayout = new QHBoxLayout(), *mainFootLayout = new QHBoxLayout();
headTextLayout = new QVBoxLayout();
QVBoxLayout *mainLayout = new QVBoxLayout();

3
widget/maskablepixmapwidget.cpp

@ -42,7 +42,8 @@ void MaskablePixmapWidget::paintEvent(QPaintEvent *) @@ -42,7 +42,8 @@ void MaskablePixmapWidget::paintEvent(QPaintEvent *)
QPoint offset((width() - pixmap.size().width())/2,(height() - pixmap.size().height())/2); // centering the pixmap
QPainter painter(&tmp);
painter.setCompositionMode(QPainter::CompositionMode_Source);
painter.setCompositionMode(QPainter::CompositionMode_SourceOver);
painter.fillRect(0,0,width(),height(),Qt::white);
painter.drawPixmap(offset,pixmap);
painter.setCompositionMode(QPainter::CompositionMode_DestinationIn);
painter.drawPixmap(0,0,mask);

Loading…
Cancel
Save