Skip to content
Snippets Groups Projects
Commit 5ce8765f authored by Riccardo Musso's avatar Riccardo Musso
Browse files

CommandPad now saves selected message type on the xml configuration

parent 64a8ac54
No related branches found
No related tags found
No related merge requests found
...@@ -72,11 +72,17 @@ QWidget* CommandPad::toWidget() { ...@@ -72,11 +72,17 @@ QWidget* CommandPad::toWidget() {
} }
XmlObject CommandPad::toXmlObject() { XmlObject CommandPad::toXmlObject() {
return XmlObject(getName(ModuleId::COMMANDPAD)); XmlObject obj(getName(ModuleId::COMMANDPAD));
obj.addAttribute("selected", commandComboBox->currentText());
return obj;
} }
void CommandPad::fromXmlObject(const XmlObject& xmlObject) { void CommandPad::fromXmlObject(const XmlObject& xmlObject) {
Q_UNUSED(xmlObject); QString curr = xmlObject.getAttribute("selected");
int idx = commandComboBox->findText(curr);
if(idx != -1) {
commandComboBox->setCurrentIndex(idx);
}
} }
#define _CMD(id, strName) \ #define _CMD(id, strName) \
...@@ -128,7 +134,7 @@ void CommandPad::fromXmlObject(const XmlObject& xmlObject) { ...@@ -128,7 +134,7 @@ void CommandPad::fromXmlObject(const XmlObject& xmlObject) {
void CommandPad::setupUi() { void CommandPad::setupUi() {
QStackedWidget* stacked = new QStackedWidget; QStackedWidget* stacked = new QStackedWidget;
QComboBox* commandComboBox = new QComboBox; commandComboBox = new QComboBox;
commandComboBox->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed)); commandComboBox->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
connect(commandComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), this, connect(commandComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
[ = ](int idx) { [ = ](int idx) {
......
...@@ -22,6 +22,8 @@ class CommandPad : public DefaultModule { ...@@ -22,6 +22,8 @@ class CommandPad : public DefaultModule {
private: private:
void setupUi(); void setupUi();
QComboBox* commandComboBox;
}; };
#endif // COMMANDPAD_H #endif // COMMANDPAD_H
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment