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 )
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 );
}
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 )
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 )
#include <qmap.h>
#include <qptrvector.h>
+#ifdef WIN32
+#pragma warning( disable : 4251 )
+#endif
+
class QDS_EXPORT QDS_Table : public QtxTable
{
class DeleteFilter;
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;
private:
typedef QPtrVector<QDS_Datum> DatumVector;
- typedef QMap<int, QDS_Datum*> DatumMap;
- typedef QMap<int, DatumMap> 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