Skip to content
Snippets Groups Projects
Commit 2351582b authored by Peter Albrecht's avatar Peter Albrecht
Browse files

Use StatusLabel in ArmarXGui

parent 38674913
No related branches found
No related tags found
1 merge request!426Skill Gui QOL
Pipeline #17847 passed
...@@ -63,7 +63,7 @@ set(SOURCES ...@@ -63,7 +63,7 @@ set(SOURCES
SkillMemoryGui.cpp SkillMemoryGui.cpp
gui_utils.cpp gui_utils.cpp
StatusLabel.cpp
) )
set(HEADERS set(HEADERS
aron_tree_widget/visitors/AronTreeWidgetCreator.h aron_tree_widget/visitors/AronTreeWidgetCreator.h
...@@ -105,7 +105,6 @@ set(HEADERS ...@@ -105,7 +105,6 @@ set(HEADERS
SkillMemoryGui.h SkillMemoryGui.h
gui_utils.h gui_utils.h
StatusLabel.h
) )
armarx_gui_library("${LIB_NAME}" "${SOURCES}" "${GUI_MOC_HDRS}" "${GUI_UIS}" "" "${LIBRARIES}") armarx_gui_library("${LIB_NAME}" "${SOURCES}" "${GUI_MOC_HDRS}" "${GUI_UIS}" "" "${LIBRARIES}")
......
...@@ -10,8 +10,7 @@ ...@@ -10,8 +10,7 @@
#include <ArmarXCore/core/logging/Logging.h> #include <ArmarXCore/core/logging/Logging.h>
#include <ArmarXGui/libraries/ArmarXGuiBase/widgets/PeriodicUpdateWidget.h> #include <ArmarXGui/libraries/ArmarXGuiBase/widgets/PeriodicUpdateWidget.h>
#include <ArmarXGui/libraries/ArmarXGuiBase/widgets/StatusLabel.h>
#include "RobotAPI/libraries/skills_gui/StatusLabel.h"
#include "./aron_tree_widget/widgets/SkillDescriptionWidget.h" #include "./aron_tree_widget/widgets/SkillDescriptionWidget.h"
#include "./executions/SkillExecutionTreeWidget.h" #include "./executions/SkillExecutionTreeWidget.h"
......
#include "StatusLabel.h"
#include <QHBoxLayout>
namespace armarx::skills::gui
{
StatusLabel::StatusLabel()
{
this->label = new QLabel("");
this->resetButton = new QPushButton("");
this->setupUi();
}
void
StatusLabel::handleMessage(const std::string& message, std::string const& error)
{
this->label->setText(QString::fromStdString(message));
this->resetButton->setHidden(false);
label->setToolTip(QString::fromStdString(error));
}
void
StatusLabel::resetLabel()
{
this->label->setText(QString::fromStdString(""));
this->resetButton->setHidden(true);
}
void
StatusLabel::setupUi()
{
QHBoxLayout* layout = new QHBoxLayout();
layout->addWidget(resetButton);
layout->addWidget(label);
this->setLayout(layout);
layout->setStretch(1, 2);
label->setStyleSheet("QLabel { color : red; }");
this->resetButton->setHidden(true);
label->setMinimumHeight(35);
label->setMaximumHeight(35);
QPixmap pixmap(":/icons/delete.ico");
QIcon ButtonIcon(pixmap);
resetButton->setIcon(ButtonIcon);
resetButton->setIconSize(pixmap.rect().size() / 2);
connect(this->resetButton, &QPushButton::clicked, this, &StatusLabel::resetLabel);
}
} // namespace armarx::skills::gui
#pragma once
#include <QLabel>
#include <QPushButton>
namespace armarx::skills::gui
{
class StatusLabel : public QWidget
{
public:
/**
* @brief Constructor for StatusLabel
*/
StatusLabel();
public slots:
/**
* @brief Display a message to indicate an update.
*/
void handleMessage(std::string const& message, std::string const& error);
private slots:
/**
* @brief Reset the label to default state.
*/
void resetLabel();
private:
void setupUi();
// contents
QLabel* label = nullptr;
QPushButton* resetButton = nullptr;
};
} // namespace armarx::skills::gui
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment