CommitWidget.cpp
Go to the documentation of this file.
1 #include "CommitWidget.h"
2 
3 #include <QWidget>
4 #include <QLineEdit>
5 #include <QTabWidget>
6 #include <QPushButton>
7 #include <QCheckBox>
8 #include <QHBoxLayout>
9 #include <QVBoxLayout>
10 #include <QTextEdit>
11 
13 
14 
15 namespace armarx::armem::gui
16 {
17 
19  {
20  QHBoxLayout* hlayout1 = new QHBoxLayout();
21  QHBoxLayout* hlayout2 = new QHBoxLayout();
22  QVBoxLayout* vlayout = new QVBoxLayout();
23 
24  _sendCommit = new QPushButton("Commit");
25  _memoryID = new QLineEdit("memory/coreSegment/providerSegment/entity");
26  _aronJSONInput = new QTextEdit("");
27 
28  QFont font;
29  font.setFamily("Courier");
30  font.setStyleHint(QFont::Monospace);
31  font.setFixedPitch(true);
32  font.setPointSize(10);
33  _aronJSONInput->setFont(font);
34 
35  const int tabStop = 4;
36  QFontMetrics metrics(font);
37  _aronJSONInput->setTabStopWidth(tabStop * metrics.width(' '));
38 
39  hlayout1->addWidget(_memoryID);
40  hlayout1->addWidget(_sendCommit);
41 
42  hlayout2->addWidget(_aronJSONInput);
43 
44  const int margin = 0;
45  vlayout->setContentsMargins(margin, margin, margin, margin);
46 
47  vlayout->addLayout(hlayout1);
48  vlayout->addLayout(hlayout2);
49 
50  // Public connections.
51  connect(_sendCommit, &QPushButton::pressed, this, &This::commit);
52 
53  setLayout(vlayout);
54  }
55 
56  std::string CommitWidget::getAronJSON() const
57  {
58  return _aronJSONInput->toPlainText().toStdString();
59  }
60 
61  std::string CommitWidget::getMemoryID() const
62  {
63  return _memoryID->text().toStdString();
64  }
65 }
armarx::armem::gui::CommitWidget::CommitWidget
CommitWidget()
Definition: CommitWidget.cpp:18
armarx::armem::gui::CommitWidget::getAronJSON
std::string getAronJSON() const
Definition: CommitWidget.cpp:56
ExpressionException.h
armarx::armem::gui::CommitWidget::commit
void commit()
armarx::armem::gui
Definition: ActionsMenuBuilder.cpp:6
armarx::armem::gui::CommitWidget::getMemoryID
std::string getMemoryID() const
Definition: CommitWidget.cpp:61
CommitWidget.h