OzQTNoob
3rd February 2012, 07:49
I have copied an example off of the web where they set up a model (trying to get my head around this stuff) and it all works quite well. I wanted to extend it though so I could have the constructor of the model class use a qstringlist of filenames to initialize the model. Being the absolute beginner in Qt and C++ I am quite confused as to how to proceed when I get the following error:
error: default argument missing for parameter 2 of 'QStandardItemModel* createModel(QObject*, QStringList (*)())'
originally I was trying to do this:
QStandardItemModel* createModel(QObject* parent=0, QStringList filenames); but i would still get the error above.
What I am trying to do is set up a model that is of the form
Filename
-item1
-item2
-item3
--item3a
--item3b
and so on. I have that working for a single case where the constructor only has the parent as input, and where the items are bits of information of course. But i want to be able to use that same structure to model n Filenames and where I dont actually know how many files there are until I get some input back from the UI. My thinking above was that if I had a constructer with 2 parameters where the 2nd is the qstringlist of filenames, then even if I dont populate the items immediately i can at least create my model
Filename1
-item1
-item2
-item3
--item3a
--item3b
Filename2
-item1
-item2
-item3
--item3a
--item3b
etc
any help is appreciated, even if its to tell me that this approach is sooooo wrong
Cheers
Oz
error: default argument missing for parameter 2 of 'QStandardItemModel* createModel(QObject*, QStringList (*)())'
originally I was trying to do this:
QStandardItemModel* createModel(QObject* parent=0, QStringList filenames); but i would still get the error above.
What I am trying to do is set up a model that is of the form
Filename
-item1
-item2
-item3
--item3a
--item3b
and so on. I have that working for a single case where the constructor only has the parent as input, and where the items are bits of information of course. But i want to be able to use that same structure to model n Filenames and where I dont actually know how many files there are until I get some input back from the UI. My thinking above was that if I had a constructer with 2 parameters where the 2nd is the qstringlist of filenames, then even if I dont populate the items immediately i can at least create my model
Filename1
-item1
-item2
-item3
--item3a
--item3b
Filename2
-item1
-item2
-item3
--item3a
--item3b
etc
any help is appreciated, even if its to tell me that this approach is sooooo wrong
Cheers
Oz