X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FParametersPlugin%2FParametersPlugin_WidgetParamsMgr.cpp;h=96e10edb14c720706a7f03058c5e5c9059301d4f;hb=f6bd0f4e080b833c0de7ef25822ebee641073445;hp=7087b1b9cd2fad45e2903b526af13761cef3d085;hpb=423c10234142d14d0d5de89383f2f96a4ec5930f;p=modules%2Fshaper.git diff --git a/src/ParametersPlugin/ParametersPlugin_WidgetParamsMgr.cpp b/src/ParametersPlugin/ParametersPlugin_WidgetParamsMgr.cpp index 7087b1b9c..96e10edb1 100644 --- a/src/ParametersPlugin/ParametersPlugin_WidgetParamsMgr.cpp +++ b/src/ParametersPlugin/ParametersPlugin_WidgetParamsMgr.cpp @@ -1,8 +1,22 @@ -// Copyright (C) 2014-20xx CEA/DEN, EDF R&D --> - -// File: ParametersPlugin_WidgetParamsMgr.cpp -// Created: 11 Apr 2016 -// Author: Vitaly SMETANNIKOV +// Copyright (C) 2014-2017 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or +// email : webmaster.salome@opencascade.com +// #include "ParametersPlugin_WidgetParamsMgr.h" #include "ParametersPlugin_Parameter.h" @@ -102,7 +116,8 @@ void ParametersPlugin_ItemDelegate::paint(QPainter* painter, { QBrush aBrush = painter->brush(); QPen aPen = painter->pen(); -// if (!isEditable(index)) + //if (!isEditable(index)) + // painter->setBrush(Qt::lightGray); if (!index.parent().isValid()) painter->setBrush(Qt::lightGray); @@ -168,7 +183,7 @@ ParametersPlugin_WidgetParamsMgr::ParametersPlugin_WidgetParamsMgr(QWidget* theP myTable = new ParametersPlugin_TreeWidget(this); myTable->setColumnCount(4); QStringList aHeaders; - aHeaders << tr("Name") << tr("Equation") << tr("Result") << tr("Comment"); + aHeaders << tr("Name") << tr("Expression") << tr("Result") << tr("Comment"); myTable->setHeaderLabels(aHeaders); myTable->setColumnWidth(Col_Name, 200); myTable->setColumnWidth(Col_Equation, 100); @@ -296,7 +311,7 @@ void ParametersPlugin_WidgetParamsMgr::updateParametersFeatures() int aNbFeatures = aDoc->numInternalFeatures(); for (int i = 0; i < aNbFeatures; i++) { aParamFeature = aDoc->internalFeature(i); - if (aParamFeature->getKind() == ParametersPlugin_Parameter::ID()) { + if (aParamFeature && aParamFeature->getKind() == ParametersPlugin_Parameter::ID()) { myParametersList.append(aParamFeature); } } @@ -328,7 +343,7 @@ QList ParametersPlugin_WidgetParamsMgr:: for(aIt = aRefs.cbegin(); aIt != aRefs.cend(); aIt++) { std::shared_ptr aAttr = (*aIt); FeaturePtr aReferenced = std::dynamic_pointer_cast(aAttr->owner()); - if (aReferenced.get()) { + if (aReferenced.get() && (aReferenced != aParameter)) { if (aReferenced->getKind() == ParametersPlugin_Parameter::ID()) { // Find referenced feature Recursive QList aList; @@ -519,9 +534,10 @@ QTreeWidgetItem* ParametersPlugin_WidgetParamsMgr::createNewItem(QTreeWidgetItem aValues << NoValue; QTreeWidgetItem* aItem = new QTreeWidgetItem(aValues); - if (theParent == myParameters) + if (theParent == myParameters) { aItem->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled); - else + aItem->setForeground(2, Qt::darkGray); + } else aItem->setFlags(Qt::NoItemFlags); return aItem; } @@ -756,16 +772,14 @@ void ParametersPlugin_WidgetParamsMgr::enableButtons(bool theEnable) bool ParametersPlugin_WidgetParamsMgr::isValid() { QTreeWidgetItem* aItem; - bool aIsValid = true; for(int i = 0; i < myParameters->childCount(); i++) { aItem = myParameters->child(i); if ((aItem->text(Col_Name) == NoName) || (aItem->text(Col_Equation) == NoValue) || (!ModelAPI_Expression::isVariable(aItem->text(Col_Name).toStdString())) ) { - aIsValid = false; - break; + return false; } } - return aIsValid; + return true; }