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. How to avoid a QTreeView -"setUpdatesEnabled(false)" from erasing itself before restore with "setUpdatesEnabled(true)"
Forum Updated to NodeBB v4.3 + New Features

How to avoid a QTreeView -"setUpdatesEnabled(false)" from erasing itself before restore with "setUpdatesEnabled(true)"

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 1.8k 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.
  • J Offline
    J Offline
    jzq740176597
    wrote on last edited by
    #1

    I use a QTreeView with QStandartItemModel,I trigger a Dlg that will change the QStandartItemModel underling structure.
    So I need temporarily prevent view to update which in turn call QStandartItemModel 's index() or sth need to read data from the underling the structure .

    But when I call QTreeView -"setUpdatesEnabled(false)" before the DLg.exec(). the View is erased?

    how can I stop view to update but not erase it?

    Regards!

    1 Reply Last reply
    0
    • J Offline
      J Offline
      jzq740176597
      wrote on last edited by
      #2

      I have solved it myself.
      Thanks any way!

      1 Reply Last reply
      0
      • S Offline
        S Offline
        Seba84
        wrote on last edited by
        #3

        Can you post the solution? Otherwise this thread is useless.
        Thanks.

        1 Reply Last reply
        0
        • J Offline
          J Offline
          jzq740176597
          wrote on last edited by
          #4

          OK!
          @m_deviceView->setAttribute(Qt::WA_OpaquePaintEvent, !bEnable);@
          I previous use:
          @m_deviceView->setUpdatesEnabled(bEnable);@

          Like Mentioned above,@setUpdatesEnabled(bEnable)@May suit the situation for a short period of time only(like writed in QT document)

          But In my case,I want the Dlg.exec() waiting the user may longer time interaction until restore the QTreeVIew update.

          So May my solution is not ideal but enough for me .

          If you have good or more reasonable solution ,then let me know.

          Thanks in advance!

          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