StatusLabel.cpp
Go to the documentation of this file.
1 #include "StatusLabel.h"
2 
3 #include <QHBoxLayout>
4 
5 namespace armarx::skills::gui
6 {
7 
9  {
10  this->label = new QLabel("");
11  this->resetButton = new QPushButton("");
12  this->setupUi();
13  }
14 
15  void
16  StatusLabel::handleMessage(const std::string& message, std::string const& error)
17  {
18  this->label->setText(QString::fromStdString(message));
19  this->resetButton->setHidden(false);
20  label->setToolTip(QString::fromStdString(error));
21  }
22 
23  void
24  StatusLabel::resetLabel()
25  {
26  this->label->setText(QString::fromStdString(""));
27  this->resetButton->setHidden(true);
28  }
29 
30  void
31  StatusLabel::setupUi()
32  {
33  QHBoxLayout* layout = new QHBoxLayout();
34  layout->addWidget(resetButton);
35  layout->addWidget(label);
36  this->setLayout(layout);
37  layout->setStretch(1, 2);
38  label->setStyleSheet("QLabel { color : red; }");
39  this->resetButton->setHidden(true);
40 
41  label->setMinimumHeight(35);
42  label->setMaximumHeight(35);
43 
44  QPixmap pixmap(":/icons/delete.ico");
45  QIcon ButtonIcon(pixmap);
46  resetButton->setIcon(ButtonIcon);
47  resetButton->setIconSize(pixmap.rect().size() / 2);
48 
49  connect(this->resetButton, &QPushButton::clicked, this, &StatusLabel::resetLabel);
50  }
51 
52 } // namespace armarx::skills::gui
armarx::skills::gui::StatusLabel::handleMessage
void handleMessage(std::string const &message, std::string const &error)
Display a message to indicate an update.
Definition: StatusLabel.cpp:16
message
message(STATUS "Boost-Library-Dir: " "${Boost_LIBRARY_DIRS}") message(STATUS "Boost-LIBRARIES
Definition: CMakeLists.txt:8
armarx::skills::gui
Definition: PeriodicUpdateWidget.cpp:11
StatusLabel.h
armarx::skills::gui::StatusLabel::StatusLabel
StatusLabel()
Constructor for StatusLabel.
Definition: StatusLabel.cpp:8