janorcutt
11th February 2010, 10:44
ok i may be being thick here but i have a problem.
i subclassed QStandardItemModel for my app, and have set up a model with 4 columns. when i read a list of items from a file it adds the rows in arraying the items in the correct order. that is File, Title, Artist, Album. now when i double click on the treeview it calls the following code
void myTunes::treeDclick(QModelIndex index)
{
QString str(model->fileForIndex(index));
Phonon::MediaSource src(str);
mediaObject->stop();
mediaObject->setCurrentSource(src);
mediaObject->play();
}
QString mediaLibrary::fileForIndex(QModelIndex index)
{
int i;
i = index.row();
return QString(item(i,0)->text());
}
when compiled the programme runs fine untill the double click event when the code
return QString(item(i,0)->text()); creates an error and the debugger halts the programme execution. so my question is why??? and how do i get around it???
as there are no errors shown i cant post them. any help would be very much appreciated.
ta janorcutt :confused:
i subclassed QStandardItemModel for my app, and have set up a model with 4 columns. when i read a list of items from a file it adds the rows in arraying the items in the correct order. that is File, Title, Artist, Album. now when i double click on the treeview it calls the following code
void myTunes::treeDclick(QModelIndex index)
{
QString str(model->fileForIndex(index));
Phonon::MediaSource src(str);
mediaObject->stop();
mediaObject->setCurrentSource(src);
mediaObject->play();
}
QString mediaLibrary::fileForIndex(QModelIndex index)
{
int i;
i = index.row();
return QString(item(i,0)->text());
}
when compiled the programme runs fine untill the double click event when the code
return QString(item(i,0)->text()); creates an error and the debugger halts the programme execution. so my question is why??? and how do i get around it???
as there are no errors shown i cant post them. any help would be very much appreciated.
ta janorcutt :confused: