Salome HOME
projects
/
modules
/
shaper.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Issue #559: Control doesn't have variable if its text is empty
[modules/shaper.git]
/
src
/
ModuleBase
/
ModuleBase_WidgetChoice.cpp
diff --git
a/src/ModuleBase/ModuleBase_WidgetChoice.cpp
b/src/ModuleBase/ModuleBase_WidgetChoice.cpp
index ba5a281eda49256daa308c3571deff2a360c2da0..83537b71d3bcf293047252fea682769153a22c48 100644
(file)
--- a/
src/ModuleBase/ModuleBase_WidgetChoice.cpp
+++ b/
src/ModuleBase/ModuleBase_WidgetChoice.cpp
@@
-1,8
+1,11
@@
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
// File: ModuleBase_WidgetChoice.cpp
// Created: 03 Sept 2014
// Author: Vitaly Smetannikov
#include "ModuleBase_WidgetChoice.h"
// File: ModuleBase_WidgetChoice.cpp
// Created: 03 Sept 2014
// Author: Vitaly Smetannikov
#include "ModuleBase_WidgetChoice.h"
+#include <ModuleBase_Tools.h>
#include <ModelAPI_AttributeInteger.h>
#include <ModelAPI_Data.h>
#include <ModelAPI_AttributeInteger.h>
#include <ModelAPI_Data.h>
@@
-18,18
+21,17
@@
ModuleBase_WidgetChoice::ModuleBase_WidgetChoice(QWidget* theParent,
const std::string& theParentId)
: ModuleBase_ModelWidget(theParent, theData, theParentId)
{
const std::string& theParentId)
: ModuleBase_ModelWidget(theParent, theData, theParentId)
{
- myContainer = new QWidget(theParent);
- QHBoxLayout* aLayout = new QHBoxLayout(myContainer);
- aLayout->setContentsMargins(0, 0, 0, 0);
+ QHBoxLayout* aLayout = new QHBoxLayout(this);
+ ModuleBase_Tools::adjustMargins(aLayout);
QString aLabelText = QString::fromStdString(theData->widgetLabel());
QString aLabelIcon = QString::fromStdString(theData->widgetIcon());
QString aLabelText = QString::fromStdString(theData->widgetLabel());
QString aLabelIcon = QString::fromStdString(theData->widgetIcon());
- myLabel = new QLabel(aLabelText,
myContainer
);
+ myLabel = new QLabel(aLabelText,
this
);
if (!aLabelIcon.isEmpty())
myLabel->setPixmap(QPixmap(aLabelIcon));
aLayout->addWidget(myLabel);
if (!aLabelIcon.isEmpty())
myLabel->setPixmap(QPixmap(aLabelIcon));
aLayout->addWidget(myLabel);
- myCombo = new QComboBox(
myContainer
);
+ myCombo = new QComboBox(
this
);
aLayout->addWidget(myCombo, 1);
std::string aTypes = theData->getProperty("string_list");
aLayout->addWidget(myCombo, 1);
std::string aTypes = theData->getProperty("string_list");
@@
-43,10
+45,10
@@
ModuleBase_WidgetChoice::~ModuleBase_WidgetChoice()
{
}
{
}
-bool ModuleBase_WidgetChoice::storeValue() const
+bool ModuleBase_WidgetChoice::storeValue
Custom
() const
{
DataPtr aData = myFeature->data();
{
DataPtr aData = myFeature->data();
-
boost
::shared_ptr<ModelAPI_AttributeInteger> aIntAttr = aData->integer(attributeID());
+
std
::shared_ptr<ModelAPI_AttributeInteger> aIntAttr = aData->integer(attributeID());
aIntAttr->setValue(myCombo->currentIndex());
updateObject(myFeature);
aIntAttr->setValue(myCombo->currentIndex());
updateObject(myFeature);
@@
-56,7
+58,7
@@
bool ModuleBase_WidgetChoice::storeValue() const
bool ModuleBase_WidgetChoice::restoreValue()
{
DataPtr aData = myFeature->data();
bool ModuleBase_WidgetChoice::restoreValue()
{
DataPtr aData = myFeature->data();
-
boost
::shared_ptr<ModelAPI_AttributeInteger> aIntAttr = aData->integer(attributeID());
+
std
::shared_ptr<ModelAPI_AttributeInteger> aIntAttr = aData->integer(attributeID());
bool isBlocked = myCombo->blockSignals(true);
myCombo->setCurrentIndex(aIntAttr->value());
bool isBlocked = myCombo->blockSignals(true);
myCombo->setCurrentIndex(aIntAttr->value());
@@
-73,7
+75,6
@@
bool ModuleBase_WidgetChoice::focusTo()
QList<QWidget*> ModuleBase_WidgetChoice::getControls() const
{
QList<QWidget*> aControls;
QList<QWidget*> ModuleBase_WidgetChoice::getControls() const
{
QList<QWidget*> aControls;
- aControls.append(myLabel);
aControls.append(myCombo);
return aControls;
}
aControls.append(myCombo);
return aControls;
}
@@
-81,5
+82,6
@@
QList<QWidget*> ModuleBase_WidgetChoice::getControls() const
void ModuleBase_WidgetChoice::onCurrentIndexChanged(int theIndex)
{
emit valuesChanged();
void ModuleBase_WidgetChoice::onCurrentIndexChanged(int theIndex)
{
emit valuesChanged();
- emit focusOutWidget(this);
-}
\ No newline at end of file
+ // Don't transfer focus
+ // emit focusOutWidget(this);
+}