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 Can I force call QHeaderView::paintSection?

How Can I force call QHeaderView::paintSection?

Scheduled Pinned Locked Moved Unsolved General and Desktop
qheaderviewpaint
4 Posts 3 Posters 473 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.
  • L Offline
    L Offline
    leonardo M B
    wrote on 6 Apr 2023, 16:48 last edited by leonardo M B 4 Jun 2023, 16:49
    #1

    So I have a customized paintSection implemented. I implemented in a way that always that I change a certain cell in my table view, the associated headers change the color.
    The problem is that now I'm using cells with checkboxes and when I change the state of the checkbox the paintSection is not called. If I hover the headers the paintSection is called and the color is applyed, but if I only check the state of the cell, its value change, but paintSection is not called, How can I force it?

    C 1 Reply Last reply 6 Apr 2023, 17:18
    0
    • L leonardo M B
      6 Apr 2023, 16:48

      So I have a customized paintSection implemented. I implemented in a way that always that I change a certain cell in my table view, the associated headers change the color.
      The problem is that now I'm using cells with checkboxes and when I change the state of the checkbox the paintSection is not called. If I hover the headers the paintSection is called and the color is applyed, but if I only check the state of the cell, its value change, but paintSection is not called, How can I force it?

      C Online
      C Online
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on 6 Apr 2023, 17:18 last edited by
      #2

      @leonardo-M-B said in How Can I force call QHeaderView::paintSection?:

      that I change a certain cell in my table view, the associated headers change the color.

      Connect the dataChanged() signal and emit headerDataChanged() in the slot depending on the changes or directly emit headerDataChanged().

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      L 1 Reply Last reply 6 Apr 2023, 17:37
      0
      • C Christian Ehrlicher
        6 Apr 2023, 17:18

        @leonardo-M-B said in How Can I force call QHeaderView::paintSection?:

        that I change a certain cell in my table view, the associated headers change the color.

        Connect the dataChanged() signal and emit headerDataChanged() in the slot depending on the changes or directly emit headerDataChanged().

        L Offline
        L Offline
        leonardo M B
        wrote on 6 Apr 2023, 17:37 last edited by
        #3

        @Christian-Ehrlicher Good Idea, but How Can I get the logicalFirst and logicalLast that the headerDataChanged require? I mean, dataChanged sends two QModelIndex

        J 1 Reply Last reply 6 Apr 2023, 18:01
        0
        • L leonardo M B
          6 Apr 2023, 17:37

          @Christian-Ehrlicher Good Idea, but How Can I get the logicalFirst and logicalLast that the headerDataChanged require? I mean, dataChanged sends two QModelIndex

          J Offline
          J Offline
          JonB
          wrote on 6 Apr 2023, 18:01 last edited by
          #4

          @leonardo-M-B
          Pass topLeft.column(), bottomRight.column() on to headerDataChanged()?

          1 Reply Last reply
          1

          2/4

          6 Apr 2023, 17:18

          • Login

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