diff options
author | ConfuSomu | 2024-03-20 21:12:43 -0400 |
---|---|---|
committer | ConfuSomu | 2024-03-20 21:12:43 -0400 |
commit | 54bdc79a5bd12c36cbb0c025b6e0c7ce68e73752 (patch) | |
tree | 9ebd3a8690fe6c05fdca18a017167b36dbd816dd | |
parent | 4e59eadba3b0d4586a9122e6a825ea030a139c9a (diff) | |
download | ActorViewer-54bdc79a5bd12c36cbb0c025b6e0c7ce68e73752.tar ActorViewer-54bdc79a5bd12c36cbb0c025b6e0c7ce68e73752.tar.gz ActorViewer-54bdc79a5bd12c36cbb0c025b6e0c7ce68e73752.zip |
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.
-rw-r--r-- | src/widgets/tab_actor_info.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
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); } } |