diff options
-rw-r--r-- | src/widgets/tab_actor_info.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/widgets/tab_actor_info.cpp b/src/widgets/tab_actor_info.cpp index 7a01980..282d093 100644 --- a/src/widgets/tab_actor_info.cpp +++ b/src/widgets/tab_actor_info.cpp @@ -54,12 +54,19 @@ void TabActorInfo::paintEvent(QPaintEvent* event) { if (actor and actor->header) { painter.setOpacity(0.75); - QPixmap pixmap = actor->header->get_pixmap(ui->displayNameText->width()); + auto &widget = *(ui->displayNameText); - painter.translate(widget.pos()); + QPixmap pixmap = actor->header->get_pixmap(widget.width()); + QPoint centre(widget.width() / 2 - pixmap.width() / 2, widget.height() / 2 - pixmap.height() / 2); - painter.drawPixmap(centre, pixmap); + + QRect source( + QPoint(0, abs(widget.height() - pixmap.height()) / 2), + QPoint(pixmap.width(), abs(widget.height() - pixmap.height()) / 2 + widget.height()) + ); + + painter.drawPixmap(widget.pos(), pixmap, source); painter.setOpacity(1.0); } } |