1 // File: ModuleBase_WidgetChoice.cpp
2 // Created: 03 Sept 2014
3 // Author: Vitaly Smetannikov
5 #include "ModuleBase_WidgetChoice.h"
7 #include <Config_WidgetAPI.h>
14 ModuleBase_WidgetChoice::ModuleBase_WidgetChoice(QWidget* theParent,
15 const Config_WidgetAPI* theData,
16 const std::string& theParentId)
17 : ModuleBase_ModelWidget(theParent, theData, theParentId)
19 myContainer = new QWidget(theParent);
20 QHBoxLayout* aLayout = new QHBoxLayout(myContainer);
21 aLayout->setContentsMargins(0, 0, 0, 0);
23 QString aLabelText = QString::fromStdString(theData->widgetLabel());
24 QString aLabelIcon = QString::fromStdString(theData->widgetIcon());
25 myLabel = new QLabel(aLabelText, myContainer);
26 myLabel->setPixmap(QPixmap(aLabelIcon));
27 aLayout->addWidget(myLabel);
29 myCombo = new QComboBox(myContainer);
30 aLayout->addWidget(myCombo);
31 connect(myCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(onCurrentIndexChanged(int)));
34 ModuleBase_WidgetChoice::~ModuleBase_WidgetChoice()
38 bool ModuleBase_WidgetChoice::storeValue() const
43 bool ModuleBase_WidgetChoice::restoreValue()
48 bool ModuleBase_WidgetChoice::focusTo()
54 QList<QWidget*> ModuleBase_WidgetChoice::getControls() const
56 QList<QWidget*> aControls;
57 aControls.append(myLabel);
58 aControls.append(myCombo);
62 void ModuleBase_WidgetChoice::onCurrentIndexChanged(int theIndex)