ProfileMenuWidget.cpp
Go to the documentation of this file.
1 #include "ProfileMenuWidget.h"
2 
3 #include <QHBoxLayout>
4 #include <QLabel>
5 #include <QVBoxLayout>
6 
7 namespace armarx::skills::gui
8 {
9 
10  QIcon
11  getIcon(const std::string name)
12  {
13  QPixmap pix(QString::fromStdString(":icons/" + name));
14  QIcon icon(pix);
15  return icon;
16  }
17 
18  void
19  ProfileMenuWidget::setupUi()
20  {
21  setArgsFromClipboard = new QPushButton();
22  copyArgsToClipboard = new QPushButton();
23  resetArgsToProfile = new QPushButton();
24  profileSelector = new QComboBox();
25 
26  // layouting
27  QVBoxLayout* mainLayout = new QVBoxLayout();
28  QHBoxLayout* topLayout = new QHBoxLayout();
29 
30  mainLayout->addLayout(topLayout);
31  mainLayout->addWidget(profileSelector);
32 
33  topLayout->addWidget(setArgsFromClipboard);
34  topLayout->addWidget(copyArgsToClipboard);
35  // this is not good. We should probably use a QSpacerItem here...
36  topLayout->addWidget(new QLabel());
37  topLayout->addWidget(resetArgsToProfile);
38 
39  this->setLayout(mainLayout);
40 
41  // Text
42  setArgsFromClipboard->setText(QString::fromStdString(SET_ARGS_BUTTON_TEXT));
43  copyArgsToClipboard->setText(QString::fromStdString(COPY_ARGS_BUTTON_TEXT));
44  copyArgsToClipboard->setIcon(getIcon("edit-copy-4.svg"));
45  resetArgsToProfile->setText(QString::fromStdString(RESET_ARGS_BUTTON_TEXT));
46  resetArgsToProfile->setIcon(getIcon("refresh-black.svg"));
47  profileSelector->addItem(QString::fromStdString(DEFAULT_PROFILE_TEXT));
48  profileSelector->setDisabled(true);
49  profileSelector->setToolTip(QString::fromStdString(PROFILE_NOT_IMPLEMENTED));
50  }
51 
52 
53 } // namespace armarx::skills::gui
armarx::skills::gui::ProfileMenuWidget::profileSelector
QComboBox * profileSelector
Definition: ProfileMenuWidget.h:27
armarx::skills::gui::ProfileMenuWidget::setArgsFromClipboard
QPushButton * setArgsFromClipboard
Definition: ProfileMenuWidget.h:24
armarx::skills::gui::ProfileMenuWidget::COPY_ARGS_BUTTON_TEXT
static const constexpr char * COPY_ARGS_BUTTON_TEXT
Definition: ProfileMenuWidget.h:17
armarx::skills::gui::ProfileMenuWidget::copyArgsToClipboard
QPushButton * copyArgsToClipboard
Definition: ProfileMenuWidget.h:25
armarx::skills::gui::ProfileMenuWidget::SET_ARGS_BUTTON_TEXT
static const constexpr char * SET_ARGS_BUTTON_TEXT
Definition: ProfileMenuWidget.h:16
armarx::skills::gui::ProfileMenuWidget::DEFAULT_PROFILE_TEXT
static const constexpr char * DEFAULT_PROFILE_TEXT
Definition: ProfileMenuWidget.h:19
armarx::skills::gui
Definition: PeriodicUpdateWidget.cpp:11
ProfileMenuWidget.h
armarx::skills::gui::ProfileMenuWidget::RESET_ARGS_BUTTON_TEXT
static const constexpr char * RESET_ARGS_BUTTON_TEXT
Definition: ProfileMenuWidget.h:18
armarx::skills::gui::ProfileMenuWidget::resetArgsToProfile
QPushButton * resetArgsToProfile
Definition: ProfileMenuWidget.h:26
armarx::skills::gui::getIcon
QIcon getIcon(const std::string name)
Definition: ProfileMenuWidget.cpp:11
armarx::skills::gui::ProfileMenuWidget::PROFILE_NOT_IMPLEMENTED
static const constexpr char * PROFILE_NOT_IMPLEMENTED
Definition: ProfileMenuWidget.h:20