From: nds Date: Thu, 12 Nov 2015 10:40:54 +0000 (+0300) Subject: Undoes temporary modifications. X-Git-Tag: V_2.0.0_alfa2~20 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=2453acda48eeae4eecf565f7bff2c123e9480cd5;p=modules%2Fshaper.git Undoes temporary modifications. --- diff --git a/src/ModuleBase/CMakeLists.txt b/src/ModuleBase/CMakeLists.txt index 2467dcd98..0969deb10 100644 --- a/src/ModuleBase/CMakeLists.txt +++ b/src/ModuleBase/CMakeLists.txt @@ -33,7 +33,6 @@ SET(PROJECT_HEADERS ModuleBase_Preferences.h ModuleBase_ResultPrs.h ModuleBase_SelectionValidator.h - ModuleBase_TableModel.h ModuleBase_ToolBox.h ModuleBase_Tools.h ModuleBase_ViewerFilters.h @@ -53,7 +52,6 @@ SET(PROJECT_HEADERS ModuleBase_WidgetShapeSelector.h ModuleBase_WidgetSwitch.h ModuleBase_WidgetToolbox.h - ModuleBase_WidgetTable.h ModuleBase_WidgetValidated.h ModuleBase_IconFactory.h ModuleBase_WidgetErrorLabel.h @@ -86,7 +84,6 @@ SET(PROJECT_SOURCES ModuleBase_ParamSpinBox.cpp ModuleBase_Preferences.cpp ModuleBase_ResultPrs.cpp - ModuleBase_TableModel.cpp ModuleBase_ToolBox.cpp ModuleBase_Tools.cpp ModuleBase_ViewerFilters.cpp @@ -106,7 +103,6 @@ SET(PROJECT_SOURCES ModuleBase_WidgetShapeSelector.cpp ModuleBase_WidgetSwitch.cpp ModuleBase_WidgetToolbox.cpp - ModuleBase_WidgetTable.cpp ModuleBase_WidgetValidated.cpp ModuleBase_IconFactory.cpp ModuleBase_WidgetErrorLabel.cpp diff --git a/src/ModuleBase/ModuleBase_TableModel.cpp b/src/ModuleBase/ModuleBase_TableModel.cpp deleted file mode 100755 index 9f66fd407..000000000 --- a/src/ModuleBase/ModuleBase_TableModel.cpp +++ /dev/null @@ -1,110 +0,0 @@ -// Copyright (C) 2014-20xx CEA/DEN, EDF R&D - -// File: ModuleBase_TableModel.cxx -// Author: Natalia ERMOLAEVA -// -#include "ModuleBase_TableModel.h" - -ModuleBase_TableModel::ModuleBase_TableModel(QObject* theParent) -: QAbstractTableModel(theParent) -{ -} - -void ModuleBase_TableModel::addRow(const QStringList& theValue) -{ - if (theValue.size() != columnCount()) - return; - - int aRowId = rowCount(); - for (int i = 0, aCols = columnCount(); i < aCols; i++) - myValues.append(Value(aRowId, i, theValue[i].toDouble())); - - emit layoutChanged(); -} - -void ModuleBase_TableModel::addRow() -{ - return; - int aRowId = rowCount(); - for (int i = 0, aCols = columnCount(); i < aCols; i++) - myValues.append(Value(aRowId, i, 0.0)); - - emit layoutChanged(); -} - -QVariant ModuleBase_TableModel::headerData(int theSection, Qt::Orientation theOrientation, - int theRole) const -{ - if (theSection < myColumnHeaders.size() && theRole == Qt::DisplayRole) - return myColumnHeaders[theSection]; - - return QAbstractTableModel::headerData(theSection, theOrientation, theRole); -} - -QModelIndex ModuleBase_TableModel::index( int theRow, int theColumn, - const QModelIndex &theParent) const -{ - if (!hasIndex(theRow, theColumn, theParent)) - return QModelIndex(); - - return createIndex(theRow, theColumn); -} - -QVariant ModuleBase_TableModel::data( const QModelIndex& theIndex, int theRole) const -{ - QVariant aValue; - if (theRole == Qt::DisplayRole) { - QList::const_iterator anIt = myValues.begin(), aLast = myValues.end(); - for (; anIt != aLast; anIt++) { - Value aVal = *anIt; - if (aVal.myRow == theIndex.row() && aVal.myColumn == theIndex.column()) { - aValue = aVal.myValue; - break; - } - } - } - else { - aValue = QVariant(); - } - - return aValue; -} - -bool ModuleBase_TableModel::setData( const QModelIndex& theIndex, const QVariant& theValue, - int theRole) -{ - bool isDone = false; - if (theRole == Qt::DisplayRole) { - QList::const_iterator anIt = myValues.begin(), aLast = myValues.end(); - for (; anIt != aLast; anIt++) { - Value aVal = *anIt; - if (aVal.myRow == theIndex.row() && aVal.myColumn == theIndex.column()) { - aVal.myValue = theValue.toDouble(); - break; - } - } - isDone = true; - } - else - isDone = true; - return isDone; -} - -int ModuleBase_TableModel::rowCount( const QModelIndex &theParent) const -{ - return myValues.size()/myColumnHeaders.size(); -} - -int ModuleBase_TableModel::columnCount( const QModelIndex &theParent) const -{ - return myColumnHeaders.size(); -} - -Qt::ItemFlags ModuleBase_TableModel::flags(const QModelIndex& theIndex) const -{ - if (!theIndex.isValid()) - return 0; - Qt::ItemFlags aFlags = Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable; - - return aFlags; -} diff --git a/src/ModuleBase/ModuleBase_TableModel.h b/src/ModuleBase/ModuleBase_TableModel.h deleted file mode 100755 index a554280a0..000000000 --- a/src/ModuleBase/ModuleBase_TableModel.h +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (C) 2014-20xx CEA/DEN, EDF R&D - -// File: ModuleBase_TableModel.h -// Author: Natalia ERMOLAEVA -// -#ifndef MODULEBASE_TABLE_MODEL_H_ -#define MODULEBASE_TABLE_MODEL_H_ - -#include "ModuleBase.h" - -#include -#include - -/** - * \ingroup GUI - * Enhanced version of the Qt's int spin box. - * It allows to store modified state -*/ -class MODULEBASE_EXPORT ModuleBase_TableModel : public QAbstractTableModel -{ - Q_OBJECT - -public: -struct Value { - Value(int theRowId, int theColumnId, double theValue) - : myRow(theRowId), myColumn(theColumnId), myValue(theValue) {} - int myRow; - int myColumn; - double myValue; - }; - -public: - explicit ModuleBase_TableModel(QObject* theParent = 0); - virtual ~ModuleBase_TableModel() {}; - - void setHeaders(const QStringList& theHeaders) { myColumnHeaders = theHeaders; } - - void addRow(const QStringList& theValue); - void addRow(); - - virtual QVariant headerData( int theSection, Qt::Orientation theOrientation, - int theRole = Qt::DisplayRole ) const; - //-------------------------------------------------------------------------------------- - virtual QModelIndex index( int theRow, int theColumn, - const QModelIndex &theParent = QModelIndex() ) const; - virtual QVariant data( const QModelIndex& theIndex, int theRole = Qt::DisplayRole ) const; - virtual bool setData( const QModelIndex& theIndex, const QVariant& theValue, - int theRole = Qt::EditRole ); - - //-------------------------------------------------------------------------------------- - virtual Qt::ItemFlags flags( const QModelIndex &theIndex ) const; - - virtual int rowCount( const QModelIndex &theParent = QModelIndex() ) const; - virtual int columnCount( const QModelIndex &theParent = QModelIndex() ) const; - -private: - QStringList myColumnHeaders; - QList myValues; -}; - -#endif diff --git a/src/ModuleBase/ModuleBase_WidgetTable.cpp b/src/ModuleBase/ModuleBase_WidgetTable.cpp deleted file mode 100755 index e6d79d530..000000000 --- a/src/ModuleBase/ModuleBase_WidgetTable.cpp +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright (C) 2014-20xx CEA/DEN, EDF R&D - -// File: ModuleBase_WidgetLabel.cpp -// Created: 03 Dec 2014 -// Author: Vitaly SMETANNIKOV - -#include "ModuleBase_WidgetTable.h" - -#include -#include - -#include -#include -#include - -#include -#include -#include - -ModuleBase_WidgetTable::ModuleBase_WidgetTable(QWidget* theParent, - const Config_WidgetAPI* theData, - const std::string& theParentId) - : ModuleBase_ModelWidget(theParent, theData, theParentId) -{ - QString aLabel = "Values"; - - QStringList aHeaders; - aHeaders << "X" << "Y" << "Z"; - - QStringList aValues1, aValues2, aValues3; - - aValues1 << "0" << "0" << "0"; - aValues2 << "0.1" << "0.1" << "0.1"; - aValues3 << "0.2" << "0.2" << "0.2"; - - QGridLayout* aLayout = new QGridLayout(this); - - myTableModel = new ModuleBase_TableModel(theParent); - myTableModel->setHeaders(aHeaders); - myTableModel->addRow(aValues1); - myTableModel->addRow(aValues2); - myTableModel->addRow(aValues3); - - myTableView = new QTableView(this); - myTableView->setModel(myTableModel); - - QPushButton* anAddBtn = new QPushButton("+", this); - QPushButton* aRemBtn = new QPushButton("-", this); - - connect(anAddBtn, SIGNAL(clicked()), this, SLOT(onAddRow())); - - aLayout->addWidget(new QLabel(aLabel), 0, 0); - aLayout->addWidget(anAddBtn, 0, 1); - aLayout->addWidget(aRemBtn, 0, 2); - - aLayout->addWidget(myTableView, 1, 0, 1, 3); - - //QVBoxLayout* aLayout = new QVBoxLayout(this); - ModuleBase_Tools::zeroMargins(aLayout); - //aLayout->addWidget(myLabel); - setLayout(aLayout); -} - -ModuleBase_WidgetTable::~ModuleBase_WidgetTable() -{ -} - -QList ModuleBase_WidgetTable::getControls() const -{ - QList aControls; - aControls.append(myTableView); - return aControls; -} - -void ModuleBase_WidgetTable::onAddRow() -{ - myTableModel->addRow(); -} diff --git a/src/ModuleBase/ModuleBase_WidgetTable.h b/src/ModuleBase/ModuleBase_WidgetTable.h deleted file mode 100755 index 331c19577..000000000 --- a/src/ModuleBase/ModuleBase_WidgetTable.h +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (C) 2014-20xx CEA/DEN, EDF R&D - -/* - * ModuleBase_WidgetTable.h - * - * Created on: Oct 8, 2014 - * Author: sbh - */ - -#ifndef ModuleBase_WidgetTable_H_ -#define ModuleBase_WidgetTable_H_ - -#include -#include - -class ModuleBase_TableModel; -class QTableView; - -/** -* \ingroup GUI -* Implementation of model widget for line edit widget. -* It can be defined with "stringvalue" keyword. -*/ -class MODULEBASE_EXPORT ModuleBase_WidgetTable : public ModuleBase_ModelWidget -{ - Q_OBJECT - public: - /// Constructor - /// \param theParent the parent object - /// \param theData the widget configuration. - /// \param theParentId is Id of a parent of the current attribute - /// \param thePlaceHolder a string of placeholder - ModuleBase_WidgetTable( QWidget* theParent, - const Config_WidgetAPI* theData, - const std::string& theParentId ); - virtual ~ModuleBase_WidgetTable(); - - /// Redefinition of virtual method - virtual QList getControls() const; - -protected slots: - void onAddRow(); - -protected: - /// Saves the internal parameters to the given feature - /// \return True in success - virtual bool storeValueCustom() const { return true;}; - - /// Restore value from attribute data to the widget's control - virtual bool restoreValueCustom() { return true; } - -private: - /// A line edit control - ModuleBase_TableModel* myTableModel; - QTableView* myTableView; -}; - -#endif /* MODULEBASE_WIDGETFILESELECTOR_H_ */ diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index 6a7977835..69d58a916 100755 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -36,7 +36,6 @@ #include #include #include -#include #include #include @@ -512,10 +511,7 @@ ModuleBase_ModelWidget* PartSet_Module::createWidgetByType(const std::string& th aPointWgt->setSketch(mySketchMgr->activeSketch()); connect(aPointWgt, SIGNAL(vertexSelected()), sketchReentranceMgr(), SLOT(onVertexSelected())); aWgt = aPointWgt; - } - else if (theType == "tablevalue") { - aWgt = new ModuleBase_WidgetTable(theParent, theWidgetApi, theParentId); - }else if (theType == "sketch-2dpoint_flyout_selector") { + } else if (theType == "sketch-2dpoint_flyout_selector") { PartSet_WidgetPoint2DFlyout* aPointWgt = new PartSet_WidgetPoint2DFlyout(theParent, aWorkshop, theWidgetApi, theParentId); aPointWgt->setSketch(mySketchMgr->activeSketch());