#include "QDS_Table.h"
+#include "QDS_LineEdit.h"
+
class QDS_Table::DeleteFilter : public QObject
{
public:
: QtxTable( parent, name ),
myHorEdit( 0 ),
myVerEdit( 0 ),
-myTableEdit( 0 )
+myTableEdit( 0 ),
+myKeepEdits( false )
{
}
: QtxTable( r, c, parent, name ),
myHorEdit( 0 ),
myVerEdit( 0 ),
-myTableEdit( 0 )
+myTableEdit( 0 ),
+myKeepEdits( false )
{
myRowEdit.resize( r );
myColEdit.resize( c );
{
int old = numRows();
QtxTable::setNumRows( r );
- myRowEdit.resize( r );
- for ( int i = r + 1; i <= old; i++ )
- myCellEdit.remove( i );
+ 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 )
{
int old = numCols();
QtxTable::setNumCols( c );
- myColEdit.resize( c );
- for ( CellMap::Iterator it = myCellEdit.begin(); it != myCellEdit.end(); ++it )
+ if ( isKeepEditors() )
+ myColEdit.resize( QMAX( (int)myColEdit.size(), c ) );
+ else
{
- DatumMap& map = it.data();
- for ( int i = c + 1; i <= old; i++ )
- map.remove( i );
+ 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 );
+ }
}
}
QtxTable::clearCellWidget( row, col );
}
+bool QDS_Table::isKeepEditors() const
+{
+ return myKeepEdits;
+}
+
+void QDS_Table::setKeepEditors( const bool on )
+{
+ myKeepEdits = on;
+}
+
QWidget* QDS_Table::createHeaderEditor( QHeader* header, const int sect, const bool init )
{
if ( !header )
dat->setStringValue( header->label( sect ) );
else
dat->clear();
-// dat->selectAll();
+ dat->setProperty( "Selection", true );
}
else
wid = QtxTable::createHeaderEditor( header, sect, init );
dat->setStringValue( text( row, col ) );
else
dat->clear();
-// dat->selectAll();
+ dat->setProperty( "Selection", true );
}
else
wid = QtxTable::createEditor( row, col, init );
Q_OBJECT
+ Q_PROPERTY( bool KeepEditors READ isKeepEditors WRITE setKeepEditors )
+
public:
QDS_Table( QWidget* = 0, const char* = 0 );
QDS_Table( int, int, QWidget* = 0, const char* = 0 );
virtual void setNumCols( int );
virtual void clearCellWidget( int, int );
+ bool isKeepEditors() const;
+ void setKeepEditors( const bool );
+
protected:
virtual QWidget* createHeaderEditor( QHeader*, const int, const bool = true );
virtual QWidget* createEditor( int, int, bool ) const;
DatumVector myColEdit;
CellMap myCellEdit;
QDS_Datum* myTableEdit;
+ bool myKeepEdits;
};
#endif