[Qt-interest] Problem with subclassing of the QAbstractTableModel
Igor Mironchik
imironchick at gmail.com
Fri Nov 5 18:23:51 CET 2010
Hi
> The trolls put out a modeltest class. Find that and your problems will
> be revealed.
>
I've tried it, nice.
There were two problems in my model:
rowCount() should be:
int rowCount( const QModelIndex & parent = QModelIndex() ) const
{
if( parent.isValid() )
return 0;
else
return m_data.size();
}
and flags():
Qt::ItemFlags flags( const QModelIndex & index ) const
{
if( !index.isValid() )
return 0;
if( index.column() == 1 )
return Qt::ItemIsEditable | Qt::ItemIsSelectable |
Qt::ItemIsUserCheckable | Qt::ItemIsEnabled;
else
return Qt::ItemIsSelectable | Qt::ItemIsUserCheckable |
Qt::ItemIsEnabled;
}
More information about the Qt-interest-old
mailing list