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. Override paintEvent or paintSection in QHeaderView
Forum Updated to NodeBB v4.3 + New Features

Override paintEvent or paintSection in QHeaderView

Scheduled Pinned Locked Moved Solved General and Desktop
qheaderview
5 Posts 3 Posters 925 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.
  • F Offline
    F Offline
    firen
    wrote on 24 Jun 2021, 15:07 last edited by firen
    #1

    Hello again,

    I am trying to rewrite QHeaderView to get individual colors for sections (depending on the values in the column), QPixmaps in them and so on...

    The CHeaderView class (the derived from QHeaderView) uses the same model like the QTableView. So in general I know I need to use the model in the CHeaderView to get this job done... :-)

    My problem is that I dont know where I could use it.
    Some google results indicate that I need to do that in the paintEvent-Method, but I am missing the logicalIndex there. So how should I know which section is the actual one who is repainted?

    Furthermore there is the method paintSection (with logicalIndex), but I cant figure out when it is called. How can I figure that out (in debug mode I never get there)? Do I have to call the method manually?

    Thank you!

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 24 Jun 2021, 18:21 last edited by
      #2

      Hi,

      The most simple to see when it's called is to look at the documentation.

      It's called in the paintEvent of QHeaderView. There might be other places. You can use the browser to look for them.

      You can also check the base implementation to see how things are done.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • F Offline
        F Offline
        firen
        wrote on 25 Jun 2021, 08:01 last edited by
        #3

        Thank you :)

        -> Still have to get in my mind, that the code is not a blackbox and I can just look at it.

        Something else: i am wondering that I am not able to write in the forum with firefox, only with chrome.

        J 1 Reply Last reply 25 Jun 2021, 08:05
        0
        • F firen
          25 Jun 2021, 08:01

          Thank you :)

          -> Still have to get in my mind, that the code is not a blackbox and I can just look at it.

          Something else: i am wondering that I am not able to write in the forum with firefox, only with chrome.

          J Offline
          J Offline
          jsulm
          Lifetime Qt Champion
          wrote on 25 Jun 2021, 08:05 last edited by
          #4

          @firen said in Override paintEvent or paintSection in QHeaderView:

          i am wondering that I am not able to write in the forum with firefox

          I use Firefox, no problem.
          What happens if you use Firefox and what version is it?

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          F 1 Reply Last reply 25 Jun 2021, 09:21
          0
          • J jsulm
            25 Jun 2021, 08:05

            @firen said in Override paintEvent or paintSection in QHeaderView:

            i am wondering that I am not able to write in the forum with firefox

            I use Firefox, no problem.
            What happens if you use Firefox and what version is it?

            F Offline
            F Offline
            firen
            wrote on 25 Jun 2021, 09:21 last edited by firen
            #5

            @jsulm On my business notebook i cant reply (only read) in firefox. Didnt check on private notebokk. Maybe only some security thinks...

            1 Reply Last reply
            0

            1/5

            24 Jun 2021, 15:07

            • Login

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