TheDodger
21-06-2002, 14:03
Hat jemand von euch eine ahnung, wie ich bei einem QListView die Columzahl so ändern kann, das sie dynamischer ist?
Bei QTable gibt es dafür setNumCols( int ).
Ich habe mir jetzt eine eigene ListView-Klasse abgeleitet, doch die entfernt keine Columns, sondern fügt nur hinzu :(
Hier mal mein Codekram :
BListView::BListView( QWidget* parent, const char* name )
: QListView( parent, name )
{
}
int BListView::getColumnCount()
{
return( columns() );
}
void BListView::setNumCols( int cols )
{
removeAllCols();
for( int i = 0 ; i < cols ; i++ )
addColumn( "", 100 );
}
void BListView::removeAllCols()
{
int isColumns = columns();
for( int i = 0 ; i < isColumns ; i++ )
{
removeColumn ( i );
}
}
Bei QTable gibt es dafür setNumCols( int ).
Ich habe mir jetzt eine eigene ListView-Klasse abgeleitet, doch die entfernt keine Columns, sondern fügt nur hinzu :(
Hier mal mein Codekram :
BListView::BListView( QWidget* parent, const char* name )
: QListView( parent, name )
{
}
int BListView::getColumnCount()
{
return( columns() );
}
void BListView::setNumCols( int cols )
{
removeAllCols();
for( int i = 0 ; i < cols ; i++ )
addColumn( "", 100 );
}
void BListView::removeAllCols()
{
int isColumns = columns();
for( int i = 0 ; i < isColumns ; i++ )
{
removeColumn ( i );
}
}