+/*!
+ \class StdMeshersGUI_DistrTableFrame::SpinBoxDelegate
+ \brief Custom item delegate (uses double spin box to edit table item)
+ \internal
+*/
+
+class StdMeshersGUI_DistrTableFrame::SpinBoxDelegate : public QItemDelegate
+{
+public:
+ SpinBoxDelegate( StdMeshersGUI_DistrTableFrame::Table* );
+ ~SpinBoxDelegate();
+
+ QWidget* createEditor( QWidget*,
+ const QStyleOptionViewItem&,
+ const QModelIndex& ) const;
+ void setEditorData( QWidget*, const QModelIndex&) const;
+ void setModelData( QWidget*, QAbstractItemModel*,
+ const QModelIndex& ) const;
+ void updateEditorGeometry( QWidget*,
+ const QStyleOptionViewItem&,
+ const QModelIndex& ) const;
+
+private:
+ StdMeshersGUI_DistrTableFrame::Table* myTable;
+};
+
+/*!
+ \class StdMeshersGUI_DistrTableFrame::Table
+ \brief Table function widget
+ \internal
+*/
+
+class StdMeshersGUI_DistrTableFrame::Table : public QTableWidget
+{
+private:
+ struct EditorData
+ {
+ int r, c;
+ SMESHGUI_SpinBox* sb;
+ EditorData() { reset(); }
+ void reset() { r = -1; c = -1; sb = 0; }
+ };
+
+public:
+ Table( QWidget*, int = 2 );
+ ~Table();
+
+ QList<double> data();
+ void setData( const QList<double>& );
+
+ double value( int, int ) const;
+ void setValue( int, int, double );
+
+ double argMinimum( int ) const;
+ double argMaximum( int ) const;
+ double argStep( int ) const;
+ double funcMinimum( int ) const;
+ double funcMaximum( int ) const;
+ double funcStep( int ) const;
+
+ void setFuncMinValue( double );
+
+ QSize sizeHint() const;
+
+ void addRow();
+ void deleteRow();
+
+ void setEditor( int, int, SMESHGUI_SpinBox* );
+
+protected:
+ void closeEditor( QWidget*, QAbstractItemDelegate::EndEditHint );
+
+private:
+ void setUpRows( bool = false );
+ QSize cachedSizeHint() const;
+ void setCachedSizeHint( const QSize& ) const;
+ QList<int> selectedRows();
+
+private:
+ double myFuncMin;
+ QSize myCachedSizeHint;
+ EditorData myEditorData;
+};
+
+// ---
+// StdMeshersGUI_DistrTableFrame::SpinBoxDelegate implementation
+// ---
+
+StdMeshersGUI_DistrTableFrame::SpinBoxDelegate::
+SpinBoxDelegate( StdMeshersGUI_DistrTableFrame::Table* parent )
+ : QItemDelegate( parent ), myTable( parent )