Version: 9.16.0
FormContainer.cxx
Go to the documentation of this file.
1// Copyright (C) 2006-2026 CEA, EDF
2//
3// This library is free software; you can redistribute it and/or
4// modify it under the terms of the GNU Lesser General Public
5// License as published by the Free Software Foundation; either
6// version 2.1 of the License, or (at your option) any later version.
7//
8// This library is distributed in the hope that it will be useful,
9// but WITHOUT ANY WARRANTY; without even the implied warranty of
10// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11// Lesser General Public License for more details.
12//
13// You should have received a copy of the GNU Lesser General Public
14// License along with this library; if not, write to the Free Software
15// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16//
17// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18//
19
20#include "FormContainer.hxx"
22#include "Container.hxx"
23//#define _DEVDEBUG_
24#include "YacsTrace.hxx"
25
26#include <QComboBox>
27#include <QList>
28
29#include <sstream>
30
31using namespace std;
32
34{
35 gridLayout_2_2->addWidget(cb_type);
36 FormContainer::FillPanel(0); // --- set widgets before signal connexion to avoid false modif detection
37 connect(cb_type, SIGNAL(activated(const QString&)),this, SLOT(onModifyType(const QString&)));
38 connect(ch_aoc,SIGNAL(stateChanged(int)),this,SLOT(onModifyAOC(int)));
39}
40
42{
43}
44
46{
47 DEBTRACE("FormContainer::FillPanel");
49 if(container)
50 {
51 ch_aoc->setCheckState(container->isAttachedOnCloning()?Qt::Checked:Qt::Unchecked);
52 }
53 cb_type->clear();
54 cb_type->addItem("mono");
55 cb_type->addItem("multi");
56 if(_properties.count("type") && _properties["type"]=="multi")
57 cb_type->setCurrentIndex(1);
58}
59
61{
62 return QString("Container");
63}
64
65void FormContainer::onModifyType(const QString &text)
66{
67 DEBTRACE("onModifyType " << text.toStdString());
68 if (!_container)
69 return;
70 std::string prop=_container->getProperty("type");
71 _properties["type"] = text.toStdString();
72 if (_properties["type"] == "mono")
74 else
76 if (prop != text.toStdString())
77 onModified();
78}
79
81{
82 if (!_container)
83 return;
84 bool val2(false);
85 if(val==Qt::Unchecked)
86 val2=false;
87 if(val==Qt::Checked)
88 val2=true;
89 bool prop(_container->isAttachedOnCloning());
90 int prop2((int)val2);
91 std::ostringstream oss; oss << prop2;
94 if(prop!=val2)
95 onModified();
96}
#define DEBTRACE(msg)
Definition: YacsTrace.hxx:31
void setModeText(const std::string &mode)
virtual void onModified()
std::map< std::string, std::string > _properties
YACS::ENGINE::Container * _container
virtual void FillPanel(YACS::ENGINE::Container *container)
FormAdvParamContainer * _advancedParams
QString getTypeStr() const
QComboBox * cb_type
FormContainer(QWidget *parent=0)
virtual void FillPanel(YACS::ENGINE::Container *container)
virtual ~FormContainer()
void onModifyType(const QString &text)
void onModifyAOC(int val)
virtual std::string getProperty(const std::string &name) const =0
static const char AOC_ENTRY[]
Definition: Container.hxx:88
virtual bool isAttachedOnCloning() const
Definition: Container.cxx:89
virtual void setAttachOnCloningStatus(bool val) const
Definition: Container.cxx:68