[solved] Problem with QListView scrolling
-
Hello
I earlier asked for some assistance regarding qlistviews (http://developer.qt.nokia.com/forums/viewthread/12298) and got some help that got me a lot further (thank you). Yet, I now run in to some issues, the code seems to segfault every time I try to "scroll". That is,
if I call:@this->logList->scrollToBottom(); // where logList is my QListView@
or if I try thhe code as suggested (probably understood the use incorrectly)
@
QModelIndex index = this->model->index(row,0); // Is this correct? model = the data model in use (QStandardItemModel, 2D)if (index.isValid()) {
//index is your last inserted item in the list
this->logList->scrollTo(index);
this->logList->setCurrentIndex(index);
}@I'd greatly appreciate any help! Thank you!
- Richard
-
A segfault is often caused by accessing a dangling pointer. Are you sure, your logList pointer is (still) valid at that point?
-
I feel stupid... This particular part was used as a component, and used by one instance where the model hadn't been set. This was called first so it always seemed to crash at this call, though the reason wasn't the object I suspected.. :P
Thank you for making me dig deeper!
-Richard