On Tuesday 19 May 2009 12:41:04 Jos van den Oever wrote:
> Here is a small application with an implementation of
> QAbstractItemModel that is very simple. It just wraps a
> QStandardItemModel.
> Nevertheless it does not work as the plain QStandardItemModel.
> Am I making a mistake or is there a bug somewhere?
>
>
>     TestModel model;
>     QTreeView view;
>     // view.setModel(model.model()); // works fine
>     view.setModel(&model);  // does not work
>     view.resizeColumnToContents(0);
>     view.show();
>
> Cheers,
> Jos


    QModelIndex index(int row, int column, const QModelIndex& parent) const {
        return m.index(row, column, parent);
    }

this is wrong as you return a ModelIndex from the other model. (the 
index.model() is not right)

in your index function you must return an index that has been created by the 
createIndex function


_______________________________________________
Qt4-preview-feedback mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt4-preview-feedback

Reply via email to