aboutsummaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorConfuSomu2024-03-24 21:23:07 -0400
committerConfuSomu2024-03-24 21:23:07 -0400
commit7024480b84ec1ef7ba4d371a51511bd04c48e816 (patch)
treedb03b06bf9d27e29ec4b90ada127f1aaeb6ff382 /src/widgets
parent4142690acd68dde59d0a6b16ccdda12f9195f304 (diff)
downloadActorViewer-7024480b84ec1ef7ba4d371a51511bd04c48e816.tar
ActorViewer-7024480b84ec1ef7ba4d371a51511bd04c48e816.tar.gz
ActorViewer-7024480b84ec1ef7ba4d371a51511bd04c48e816.zip
Use shared pointer in APAttachment::get_pixmap()
Necessary as the pixmap may be deleted at any moment if another caller requests a differently sized pixmap.
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/tab_actor_info.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/widgets/tab_actor_info.cpp b/src/widgets/tab_actor_info.cpp
index 282d093..1bfb59d 100644
--- a/src/widgets/tab_actor_info.cpp
+++ b/src/widgets/tab_actor_info.cpp
@@ -39,7 +39,7 @@ void TabActorInfo::update_ui() {
ui->displayNameText->setText(ui->displayNameText->text().arg(actor->name).arg(actor->username));
ui->summaryText->setHtml(actor->summary);
- ui->avatarImage->setPixmap(actor->avatar->get_pixmap(ui->avatarImage->size().width()));
+ ui->avatarImage->setPixmap(*actor->avatar->get_pixmap(ui->avatarImage->size().width()));
int row = 0;
for (APPropertyValue prop : actor->table) {
@@ -56,17 +56,17 @@ void TabActorInfo::paintEvent(QPaintEvent* event) {
painter.setOpacity(0.75);
auto &widget = *(ui->displayNameText);
- QPixmap pixmap = actor->header->get_pixmap(widget.width());
+ std::shared_ptr<QPixmap> pixmap = actor->header->get_pixmap(widget.width());
- QPoint centre(widget.width() / 2 - pixmap.width() / 2,
- widget.height() / 2 - pixmap.height() / 2);
+ QPoint centre(widget.width() / 2 - pixmap->width() / 2,
+ widget.height() / 2 - pixmap->height() / 2);
QRect source(
- QPoint(0, abs(widget.height() - pixmap.height()) / 2),
- QPoint(pixmap.width(), abs(widget.height() - pixmap.height()) / 2 + widget.height())
+ 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.drawPixmap(widget.pos(), *pixmap, source);
painter.setOpacity(1.0);
}
}