ModuleBase_Preferences.h
ModuleBase_ResultPrs.h
ModuleBase_SelectionValidator.h
- ModuleBase_TableModel.h
ModuleBase_ToolBox.h
ModuleBase_Tools.h
ModuleBase_ViewerFilters.h
ModuleBase_WidgetShapeSelector.h
ModuleBase_WidgetSwitch.h
ModuleBase_WidgetToolbox.h
- ModuleBase_WidgetTable.h
ModuleBase_WidgetValidated.h
ModuleBase_IconFactory.h
ModuleBase_WidgetErrorLabel.h
ModuleBase_ParamSpinBox.cpp
ModuleBase_Preferences.cpp
ModuleBase_ResultPrs.cpp
- ModuleBase_TableModel.cpp
ModuleBase_ToolBox.cpp
ModuleBase_Tools.cpp
ModuleBase_ViewerFilters.cpp
ModuleBase_WidgetShapeSelector.cpp
ModuleBase_WidgetSwitch.cpp
ModuleBase_WidgetToolbox.cpp
- ModuleBase_WidgetTable.cpp
ModuleBase_WidgetValidated.cpp
ModuleBase_IconFactory.cpp
ModuleBase_WidgetErrorLabel.cpp
+++ /dev/null
-// 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<Value>::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<Value>::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;
-}
+++ /dev/null
-// 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 <QAbstractTableModel>
-#include <QStringList>
-
-/**
- * \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<Value> myValues;
-};
-
-#endif
+++ /dev/null
-// 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 <Config_WidgetAPI.h>
-#include <ModuleBase_Tools.h>
-
-#include <ModuleBase_TableModel.h>
-#include <ModuleBase_Tools.h>
-#include <QTableView>
-
-#include <QLabel>
-#include <QPushButton>
-#include <QGridLayout>
-
-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<QWidget*> ModuleBase_WidgetTable::getControls() const
-{
- QList<QWidget*> aControls;
- aControls.append(myTableView);
- return aControls;
-}
-
-void ModuleBase_WidgetTable::onAddRow()
-{
- myTableModel->addRow();
-}
+++ /dev/null
-// 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 <ModuleBase.h>
-#include <ModuleBase_ModelWidget.h>
-
-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<QWidget*> 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_ */
#include <ModuleBase_FilterFactory.h>
#include <ModuleBase_Tools.h>
#include <ModuleBase_OperationFeature.h>
-#include <ModuleBase_WidgetTable.h>
#include <ModelAPI_Object.h>
#include <ModelAPI_Events.h>
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());