Added description label in the RegisterHistoryItem widget

This commit is contained in:
Nav
2021-09-21 21:21:00 +01:00
parent 59b7069a9c
commit e76bb07ef1
3 changed files with 22 additions and 11 deletions

View File

@@ -1,7 +1,7 @@
#include "RegisterHistoryItem.hpp" #include "RegisterHistoryItem.hpp"
#include <QStyle> #include <QStyle>
#include <QVBoxLayout> #include <QHBoxLayout>
#include <QByteArray> #include <QByteArray>
using namespace Bloom::Widgets; using namespace Bloom::Widgets;
@@ -24,15 +24,20 @@ RegisterHistoryItem::RegisterHistoryItem(
).toHex()).toUpper()); ).toHex()).toUpper());
this->valueLabel->setObjectName("value-label"); this->valueLabel->setObjectName("value-label");
auto labelLayout = new QVBoxLayout(); this->descriptionLayout->setText("Register Written");
labelLayout->setSpacing(5); this->descriptionLayout->setObjectName("description-label");
labelLayout->setContentsMargins(0, 0, 0, 0);
labelLayout->addWidget(this->dateLabel, 0, Qt::AlignmentFlag::AlignTop);
labelLayout->addWidget(this->valueLabel, 0, Qt::AlignmentFlag::AlignTop);
labelLayout->addStretch(1);
this->layout->setSpacing(1); auto subLabelLayout = new QHBoxLayout();
this->layout->addLayout(labelLayout); subLabelLayout->setSpacing(0);
subLabelLayout->setContentsMargins(0, 0, 0, 0);
subLabelLayout->addWidget(this->valueLabel, 0, Qt::AlignmentFlag::AlignLeft);
subLabelLayout->addStretch(1);
subLabelLayout->addWidget(this->descriptionLayout, 0, Qt::AlignmentFlag::AlignRight);
this->layout->setSpacing(5);
this->layout->addWidget(this->dateLabel, 0, Qt::AlignmentFlag::AlignTop);
this->layout->addLayout(subLabelLayout);
this->layout->addStretch(1);
auto onClick = [this] { auto onClick = [this] {
this->setSelected(true); this->setSelected(true);

View File

@@ -1,7 +1,7 @@
#pragma once #pragma once
#include <QDateTime> #include <QDateTime>
#include <QHBoxLayout> #include <QVBoxLayout>
#include <QLabel> #include <QLabel>
#include "Item.hpp" #include "Item.hpp"
@@ -11,9 +11,10 @@ namespace Bloom::Widgets
class RegisterHistoryItem: public Item class RegisterHistoryItem: public Item
{ {
Q_OBJECT Q_OBJECT
QHBoxLayout* layout = new QHBoxLayout(this); QVBoxLayout* layout = new QVBoxLayout(this);
QLabel* dateLabel = new QLabel(this); QLabel* dateLabel = new QLabel(this);
QLabel* valueLabel = new QLabel(this); QLabel* valueLabel = new QLabel(this);
QLabel* descriptionLayout = new QLabel(this);
public: public:
RegisterHistoryItem( RegisterHistoryItem(

View File

@@ -111,6 +111,11 @@ QPushButton:disabled {
color: #8a8a8d; color: #8a8a8d;
} }
#target-register-history-widget #register-history-item #description-label {
font-size: 13px;
color: #8a8a8d;
}
#target-register-history-widget #separator-label { #target-register-history-widget #separator-label {
/*font-style: italic;*/ /*font-style: italic;*/
color: #8a8a8d; color: #8a8a8d;