From: stv Date: Wed, 11 Oct 2006 12:30:21 +0000 (+0000) Subject: Cell editors stored as cell properties. X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=c51527e28b51e41ec94032349b8fe5fa883a7b16;p=modules%2Fgui.git Cell editors stored as cell properties. --- diff --git a/src/QDS/QDS_Table.cxx b/src/QDS/QDS_Table.cxx index b14e80c8f..12e796314 100644 --- a/src/QDS/QDS_Table.cxx +++ b/src/QDS/QDS_Table.cxx @@ -141,11 +141,11 @@ QDS_Datum* QDS_Table::columnEditor( const int col ) const QDS_Datum* QDS_Table::cellEditor( const int row, const int col ) const { - if ( !myCellEdit.contains( row ) ) + QVariant res = cellProperty( row, col, Datum ); + if ( !res.canCast( QVariant::LongLong ) ) return 0; - const DatumMap& map = myCellEdit[row]; - return map.contains( col ) ? map[col] : 0; + return (QDS_Datum*)res.toLongLong(); } void QDS_Table::setTableEditor( QDS_Datum* dat ) @@ -195,10 +195,7 @@ void QDS_Table::setCellEditor( const int row, const int col, QDS_Datum* dat ) if ( isEditing() && currEditRow() == row && currEditCol() == col && actualCellEditor( row, col ) != dat ) endEdit( currEditRow(), currEditCol(), false, false ); - if ( !myCellEdit.contains( row ) ) - myCellEdit.insert( row, DatumMap() ); - - myCellEdit[row].insert( col, dat ); + setCellProperty( row, col, Datum, (Q_LLONG)dat ); initEditor( dat ); } @@ -222,11 +219,7 @@ void QDS_Table::setNumRows( int r ) if ( isKeepEditors() ) myRowEdit.resize( QMAX( (int)myRowEdit.size(), r ) ); else - { myRowEdit.resize( r ); - for ( int i = r + 1; i <= old; i++ ) - myCellEdit.remove( i ); - } } void QDS_Table::setNumCols( int c ) @@ -237,15 +230,7 @@ void QDS_Table::setNumCols( int c ) if ( isKeepEditors() ) myColEdit.resize( QMAX( (int)myColEdit.size(), c ) ); else - { myColEdit.resize( c ); - for ( CellMap::Iterator it = myCellEdit.begin(); it != myCellEdit.end(); ++it ) - { - DatumMap& map = it.data(); - for ( int i = c + 1; i <= old; i++ ) - map.remove( i ); - } - } } void QDS_Table::clearCellWidget( int row, int col ) diff --git a/src/QDS/QDS_Table.h b/src/QDS/QDS_Table.h index c7d33abf9..691de4b71 100644 --- a/src/QDS/QDS_Table.h +++ b/src/QDS/QDS_Table.h @@ -26,6 +26,10 @@ #include #include +#ifdef WIN32 +#pragma warning( disable : 4251 ) +#endif + class QDS_EXPORT QDS_Table : public QtxTable { class DeleteFilter; @@ -70,6 +74,9 @@ public: bool isKeepEditors() const; void setKeepEditors( const bool ); +protected: + enum { Datum = QtxTable::User, User }; + protected: virtual QWidget* createHeaderEditor( QHeader*, const int, const bool = true ); virtual QWidget* createEditor( int, int, bool ) const; @@ -83,17 +90,18 @@ private: private: typedef QPtrVector DatumVector; - typedef QMap DatumMap; - typedef QMap CellMap; private: QDS_Datum* myHorEdit; QDS_Datum* myVerEdit; DatumVector myRowEdit; DatumVector myColEdit; - CellMap myCellEdit; QDS_Datum* myTableEdit; bool myKeepEdits; }; +#ifdef WIN32 +#pragma warning( default: 4251 ) +#endif + #endif