From 54bdc79a5bd12c36cbb0c025b6e0c7ce68e73752 Mon Sep 17 00:00:00 2001 From: ConfuSomu Date: Wed, 20 Mar 2024 21:12:43 -0400 Subject: Draw Actor header image centered This looks visually more attractive and is way better than squishing the image to fit in the display name text boundaries. --- src/widgets/tab_actor_info.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/widgets/tab_actor_info.cpp b/src/widgets/tab_actor_info.cpp index 9a289e0..7a01980 100644 --- a/src/widgets/tab_actor_info.cpp +++ b/src/widgets/tab_actor_info.cpp @@ -55,7 +55,11 @@ void TabActorInfo::paintEvent(QPaintEvent* event) { if (actor and actor->header) { painter.setOpacity(0.75); QPixmap pixmap = actor->header->get_pixmap(ui->displayNameText->width()); - painter.drawPixmap(ui->displayNameText->geometry(), pixmap); + auto &widget = *(ui->displayNameText); + painter.translate(widget.pos()); + QPoint centre(widget.width() / 2 - pixmap.width() / 2, + widget.height() / 2 - pixmap.height() / 2); + painter.drawPixmap(centre, pixmap); painter.setOpacity(1.0); } } -- cgit v1.2.3-54-g00ecf