aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorConfuSomu2024-01-26 18:02:28 -0500
committerConfuSomu2024-01-26 18:02:28 -0500
commit948bfe5e1032f7e19046638c3b47001f45d5a3f1 (patch)
tree8242dbb7230e07c35653e7a72d4fb6a95e860d1b
parentfa9b2130f43547be7e4698b8d95a23155c5d3ee1 (diff)
downloadActorViewer-948bfe5e1032f7e19046638c3b47001f45d5a3f1.tar
ActorViewer-948bfe5e1032f7e19046638c3b47001f45d5a3f1.tar.gz
ActorViewer-948bfe5e1032f7e19046638c3b47001f45d5a3f1.zip
Display header image in actor info tab
-rw-r--r--src/widgets/tab_actor_info.cpp14
-rw-r--r--src/widgets/tab_actor_info.h2
2 files changed, 14 insertions, 2 deletions
diff --git a/src/widgets/tab_actor_info.cpp b/src/widgets/tab_actor_info.cpp
index 9d35b29..c769297 100644
--- a/src/widgets/tab_actor_info.cpp
+++ b/src/widgets/tab_actor_info.cpp
@@ -3,6 +3,7 @@
#include "src/activitypub/apactor.h"
#include "src/archive/base_archive.h"
#include <QTableWidgetItem>
+#include <QPainter>
TabActorInfo::TabActorInfo(APActor* actor, QWidget* parent)
: QWidget(parent), ui(new Ui::TabActorInfo), actor(actor)
@@ -40,8 +41,6 @@ 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()));
- // TODO: set header as top of background of widget
- // Affiche le nom et la description fonctionne sans problèmes
int row = 0;
for (APPropertyValue prop : actor->table) {
@@ -50,3 +49,14 @@ void TabActorInfo::update_ui() {
ui->attachments->setItem(row++, 1, new QTableWidgetItem(prop.value));
}
}
+
+void TabActorInfo::paintEvent(QPaintEvent* event) {
+ QPainter painter(this);
+
+ if (actor and actor->header) {
+ painter.setOpacity(0.75);
+ QPixmap pixmap = actor->header->get_pixmap(ui->displayNameText->width());
+ painter.drawPixmap(ui->displayNameText->geometry(), pixmap);
+ painter.setOpacity(1.0);
+ }
+}
diff --git a/src/widgets/tab_actor_info.h b/src/widgets/tab_actor_info.h
index a1dd84f..c6a4b88 100644
--- a/src/widgets/tab_actor_info.h
+++ b/src/widgets/tab_actor_info.h
@@ -23,5 +23,7 @@ public slots:
private:
Ui::TabActorInfo* ui;
+ void paintEvent(QPaintEvent* event);
+
APActor* actor = nullptr;
};