Qt-interest Archive, June 2007
QAbstractItemModel::beginInsertRows stoped working with qt-4.3rc1
Message 1 in thread
Hi,
when switching from qt 4.2.3 to 4.3rc1 beginInsertRows stopped working.
The connected QTreeview does no longer update, when inserting new rows.
This Bug is still present in qt-4.3 final.
Code Example (based on simple TreeModel):
void TreeModel::addData(const QList<QVariant>& data,TreeItem * parent)
{
if(parent==NULL)
parent=rootItem;
QModelIndex parentIndex=createIndex(parent->row(),0,parent);
beginInsertRows(parentIndex,parent->childCount(),parent->childCount());
TreeItem *newItem=new TreeItem(data,parent);
parent->appendChild(newItem);
endInsertRows();
//reset();
}
When calling this function the data is added but not displayed.
full source: http://www.jradmacher.de/modelbug-qt43.tar.gz
Jochen
--
[ signature omitted ]
Message 2 in thread
On Friday 15 June 2007 14:46:18 Jochen Radmacher wrote:
> Hi,
> when switching from qt 4.2.3 to 4.3rc1 beginInsertRows stopped working.
> The connected QTreeview does no longer update, when inserting new rows.
> This Bug is still present in qt-4.3 final.
> Code Example (based on simple TreeModel):
>
> void TreeModel::addData(const QList<QVariant>& data,TreeItem * parent)
> {
> if(parent==NULL)
> parent=rootItem;
> QModelIndex parentIndex=createIndex(parent->row(),0,parent);
>
> beginInsertRows(parentIndex,parent->childCount(),parent->childCount());
> TreeItem *newItem=new TreeItem(data,parent);
> parent->appendChild(newItem);
> endInsertRows();
> //reset();
> }
>
> When calling this function the data is added but not displayed.
>
> full source: http://www.jradmacher.de/modelbug-qt43.tar.gz
>
> Jochen
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
> "unsubscribe" in the subject or the body. List archive and information:
> http://lists.trolltech.com/qt-interest/
How about running the model test on your model and see if it is able to find
any errors. It usually catches a lot of smaller things that could cause
other bigger things like beginInsertRows fail.
http://labs.trolltech.com/page/Projects/Itemview/Modeltest
-Benjamin Meyer
--
[ signature omitted ]
Message 3 in thread
On 18.06.07 09:12:31, Benjamin Meyer wrote:
> On Friday 15 June 2007 14:46:18 Jochen Radmacher wrote:
> > Hi,
> > when switching from qt 4.2.3 to 4.3rc1 beginInsertRows stopped working.
> > The connected QTreeview does no longer update, when inserting new rows.
> > This Bug is still present in qt-4.3 final.
> > Code Example (based on simple TreeModel):
> >
> > void TreeModel::addData(const QList<QVariant>& data,TreeItem * parent)
> > {
> > if(parent==NULL)
> > parent=rootItem;
> > QModelIndex parentIndex=createIndex(parent->row(),0,parent);
> >
> > beginInsertRows(parentIndex,parent->childCount(),parent->childCount());
> > TreeItem *newItem=new TreeItem(data,parent);
> > parent->appendChild(newItem);
> > endInsertRows();
> > //reset();
> > }
> >
> > When calling this function the data is added but not displayed.
> >
> > full source: http://www.jradmacher.de/modelbug-qt43.tar.gz
> >
> > Jochen
> >
> > --
> > To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
> > "unsubscribe" in the subject or the body. List archive and information:
> > http://lists.trolltech.com/qt-interest/
>
> How about running the model test on your model and see if it is able to find
> any errors. It usually catches a lot of smaller things that could cause
> other bigger things like beginInsertRows fail.
I should have responded earlier. I did this locally already. There was
one or two errors pointed out by the modeltest, but fixing them didn't
fix the issue at hand. What is rather weird is that the signals
rowsAboutToBeInserted and rowsInserted are emitted with proper values,
but the view is not updated for some reason. It seems as if it doesn't
get any signals at all.
Andreas
--
[ signature omitted ]
Message 4 in thread
Andreas Pakulat schrieb:
> [...]
>
> I should have responded earlier. I did this locally already. There was
> one or two errors pointed out by the modeltest, but fixing them didn't
> fix the issue at hand. What is rather weird is that the signals
> rowsAboutToBeInserted and rowsInserted are emitted with proper values,
> but the view is not updated for some reason. It seems as if it doesn't
> get any signals at all.
>
> Andreas
>
When I tested this demo model with the modeltest class, I noticed no
Problems. Adding debug statements in rowsInserted and
rowsAboutToBeInserted showed that these slots got called.
I also have a different model in my main project, which shows exactly
the same problem. It works with 4.2 but not 4.3 .
An additional note: If I call reset(); after the rows are inserted,
everything shows up in the view.
Jochen
--
[ signature omitted ]