Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [solved] Problem with QListView scrolling
Forum Updated to NodeBB v4.3 + New Features

[solved] Problem with QListView scrolling

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.9k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    ThaRez
    wrote on last edited by
    #1

    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
    1 Reply Last reply
    0
    • G Offline
      G Offline
      goetz
      wrote on last edited by
      #2

      A segfault is often caused by accessing a dangling pointer. Are you sure, your logList pointer is (still) valid at that point?

      http://www.catb.org/~esr/faqs/smart-questions.html

      1 Reply Last reply
      0
      • T Offline
        T Offline
        ThaRez
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved