Thanks jpn, sibling was what I need (I'm italian so sometimes i don't understand the use of a function from its name: I had no idea of what was simling; after you pointed me to it I have recovered a thesaurus to get the meaning of that word and discovered that it was the function I was searching for).
Now the final code:
void MainDialog::showPreviuosTitle()
{
if(mi.row() > 0) {
listView->setCurrentIndex(mi.sibling(mi.row()-1,mi.column()));
viewTitle(listView->currentIndex());
}
}
void MainDialog::showNextTitle()
{
if(mi.row() < listView->model()->rowCount() - 1) {
listView->setCurrentIndex(mi.sibling(mi.row()+1,mi.column()));
viewTitle(listView->currentIndex());
}
}
void MainDialog::showPreviuosTitle()
{
QModelIndex mi = listView->currentIndex();
if(mi.row() > 0) {
listView->setCurrentIndex(mi.sibling(mi.row()-1,mi.column()));
viewTitle(listView->currentIndex());
}
}
void MainDialog::showNextTitle()
{
QModelIndex mi = listView->currentIndex();
if(mi.row() < listView->model()->rowCount() - 1) {
listView->setCurrentIndex(mi.sibling(mi.row()+1,mi.column()));
viewTitle(listView->currentIndex());
}
}
To copy to clipboard, switch view to plain text mode
Thanks
Bookmarks