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. Invalidate filter sometimes doesn't cause a repaint?

Invalidate filter sometimes doesn't cause a repaint?

Scheduled Pinned Locked Moved General and Desktop
5 Posts 2 Posters 2.4k Views
  • 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.
  • M Offline
    M Offline
    Moschops
    wrote on last edited by
    #1

    I have a subclass of @QSortFilterProxyModel@

    A bug has arisen. Correct behaviour is that, when some data are selected in a certain way, the on screen listing should show those in a different font (in this case, light grey - "greyed out"); this is done by marking the data in such a way that @ filteracceptsrow()@ returns false when I want it greyed out, and true otherwise.

    They are not greyed out until the window is forced to be redrawn in some way - just clicking, or dragging another window over it, will make this happen. I suspect there's some kind of race hazard going on, as when I tried to debug it, having a breakpoint in the chain means it works correctly (i.e. with a breakpoint, when I let it run free again, the lines are greyed out, but if I remove the breakpoint and repeat, I have to force a redraw by moving a window around before the lines are greyed out).

    Currently, the code looks like this:

    @ hiddenMessages += messages;
    invalidateFilter();@

    The messages to grey out are simply added to hiddenMessages , and then invalidateFilter is called, which as I understand it causes a refresh and a redraw on screen.

    I'm still new to a lot of this and getting my head round the clever QT filter model. Does it sound like this is some kind of race hazard, or the like? If so, is there a better way to ensure a redraw than just calling invalidateFilter?

    1 Reply Last reply
    0
    • raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      what happens when you call QSortFilterProxyModel::invalidate() instead/additionally?

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      0
      • M Offline
        M Offline
        Moschops
        wrote on last edited by
        #3

        I've been digging, and it's actually a tiny bit different (and more mystifying to me).

        The panel that doesn't update unless I do something to force a redraw is a docked window, living alongside a couple of other docked windows with a tab manager to allow the user to flip between them.

        If I undock this window, and put it somewhere else, it works; that is, what I do to effect the change (which is select a folder in the tree and pick the relevant option) works - the one I pick goes light grey (it's a folder) and all of the subfiles in that folder (looks like a pretty normal folder/file tree) go grey. I don't have to do anything to force a redraw.

        If I leave it docked, only the folder goes grey until I do something to force a redraw (such as drag another window over the edge of it, or flip tabs and then back again).

        This is driving me insane :) Does this difference mean anything? When it's the only tab there (i.e. I have undocked all the other that share that space and moved them elsewhere) it's still bad; I have to force a redraw.

        1 Reply Last reply
        0
        • raven-worxR Offline
          raven-worxR Offline
          raven-worx
          Moderators
          wrote on last edited by
          #4

          please file a "bug report":https://bugreports.qt-project.org.

          --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
          If you have a question please use the forum so others can benefit from the solution in the future

          1 Reply Last reply
          0
          • M Offline
            M Offline
            Moschops
            wrote on last edited by
            #5

            I'll keep digging; I'd want to be pretty sure of myself before lodging a bug report. Deeper in the code, there's some logic that examines each item to be shown (modelindex) and if the parent is the original folder I selected to be greyed out, it gets greyed out.

            It seems that this comes back as false when it's not working, and as true when it is; this means that it comes back as false, then I nudge the window, and then it redraws and this time it comes back as true. As if there's some kind of race hazard; like the model isn't being updated in time for the redraw.

            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