Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Call for Presentations - Qt World Summit

    Unsolved (QtableView or QTreeView ) Vs (QTableWidget and QtreeWidget)

    General and Desktop
    2
    2
    1419
    Loading More Posts
    • 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.
    • Q
      Qt Enthusiast last edited by

      I want to know does QtreeView fetches data from model only for visible rows in the windows
      If we have QtableView or QTreeView if we have 1000 rows in model and if only 50 rows are visible at one tine does QTreeView/QtableView only fetches data for 50 rows only

      Also for Storage part I assume the QTreeWidget /QtableWidget stores data for all the rows but QTReeView/QtableView does not store any data

      1 Reply Last reply Reply Quote 0
      • Chris Kawa
        Chris Kawa Moderators last edited by Chris Kawa

        Neither Q*Widget nor Q*View store data. They both use models for it. Q*Widget classes inherit Q*View ones.
        The difference is that Q*Widget classes have a built-in customized model that is pretty much equivalent to Q*View using QStandardItemModel (with minor bells and whistles).

        As to what is queried when depends on the model and some view settings. "data" is not only the visible part (like text or color of a cell), but also things like size hint. While some data types will be queried only for the visible items, some others might be queried for all.

        For example to properly calculate position and ranges of the scroll bars all cells need to be asked for their size, whether they are visible or not. There are some view settings that can help optimize this, e.g. uniformRowHeights.

        Also, a model can implement certain optimizations too. One example is canFetchMore() method. With it the model will report that it has only some limited subset of rows. When the view scrolls near the bottom the view will call canFetchMoreand fetchMoreto make the model dynamically load more data.

        1 Reply Last reply Reply Quote 0
        • First post
          Last post