| 1 | // For license of this file, see <project-root-folder>/LICENSE.md. |
| 2 | |
| 3 | #include "gui/reusable/labelwithstatus.h" |
| 4 | |
| 5 | #include "gui/reusable/plaintoolbutton.h" |
| 6 | |
| 7 | #include <QHBoxLayout> |
| 8 | |
| 9 | LabelWithStatus::LabelWithStatus(QWidget* parent) : WidgetWithStatus(parent) { |
| 10 | m_wdgInput = new QLabel(this); |
| 11 | |
| 12 | // Set correct size for the tool button. |
| 13 | int label_height = m_wdgInput->sizeHint().height() * 1.2; |
| 14 | |
| 15 | m_btnStatus->setFixedSize(label_height, label_height); |
| 16 | |
| 17 | // Compose the layout. |
| 18 | m_layout->addWidget(m_wdgInput); |
| 19 | m_layout->addWidget(m_btnStatus); |
| 20 | |
| 21 | setLayoutDirection(Qt::LayoutDirection::RightToLeft); |
| 22 | } |
| 23 | |
| 24 | void LabelWithStatus::setStatus(WidgetWithStatus::StatusType status, |
| 25 | const QString& label_text, |
| 26 | const QString& status_text) { |
| 27 | WidgetWithStatus::setStatus(status, status_text); |
| 28 | label()->setText(label_text); |
| 29 | } |