diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/widgets/tab_actor_info.cpp | 14 | ||||
-rw-r--r-- | src/widgets/tab_actor_info.h | 2 |
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; }; |