why this program is not working
can anyone tell why this program is not working?
am not able to see the directory structure.
(from the printf's i could make out that is is not calling parent and data functions. this code doesnt contains printfs)
Code:
#include <QtGui>
{
public:
TestModel()
{
}
{
return model->data(index, role);
}
{
return model->index(row, column, parent);
}
{
return model->parent(index);
}
{
return model->rowCount(parent);
}
{
return model->columnCount(parent);
}
};
int main(int a, char** b)
{
TestModel *mod = new TestModel;
view.setModel(mod);
view.show();
return app.exec();
}
Thanks
Re: why this program is not working
The index contains a pointer to the model and it has to match the actual model that is using it, so if you want to pass the index you get to another model, you have to build a new index that references this another model and not yours. And of course your index() and parent() implementations are invalid because of the same reason.
Re: why this program is not working
Thanks Wysota,
but i have no idea as how to build new index or map to another model index. Could you give any reference doc which is explaining this? How difficulty it is?
Re: why this program is not working
Call the model's index() method with appropriate parameters. By the way, I don't know what you are doing, but maybe using QAbstractProxyModel would be easier?