Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Zooming QTableView
Qt 6.12 LTS is out! See what's new in the release blog

Zooming QTableView

Scheduled Pinned Locked Moved Solved General and Desktop
13 Posts 3 Posters 3.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.
  • Christian EhrlicherC Christian Ehrlicher

    @DzCode said in Zooming QTableView:

    However, header font does not change. setfont of it does not work

    Did you call it on the header? Maybe you set a style sheet on it?

    D Offline
    D Offline
    DzCode
    wrote on last edited by
    #3

    @Christian-Ehrlicher

    Yes, Now I am doing it inside my custom header view with stylesheet. However, when the point size of the font changed, the names of columns are not fitted to their own area.

    For example if the header name is "Measurement". It looks "asure" after zooming. The names should be like in the case of there is no zoom. If there is alide like this "Measure..." also after zoom it should be " Measure...", not "Mea...".

    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #4

      Then you have to resize your header sizes accordingly.

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

      D 1 Reply Last reply
      0
      • Christian EhrlicherC Christian Ehrlicher

        Then you have to resize your header sizes accordingly.

        D Offline
        D Offline
        DzCode
        wrote on last edited by
        #5

        @Christian-Ehrlicher

        yes but I want to ask something.
        Is there any other way to do zooming instead of changing fonts?

        1 Reply Last reply
        0
        • Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #6

          No, not that I'm aware of.

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

          D 1 Reply Last reply
          1
          • Christian EhrlicherC Christian Ehrlicher

            No, not that I'm aware of.

            D Offline
            D Offline
            DzCode
            wrote on last edited by
            #7

            @Christian-Ehrlicher

            I am asking this, because Icons and pixmaps in the decoration role does not change with the change of the font. image sizes also should change with zooming

            mrjjM 1 Reply Last reply
            0
            • D DzCode

              @Christian-Ehrlicher

              I am asking this, because Icons and pixmaps in the decoration role does not change with the change of the font. image sizes also should change with zooming

              mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by
              #8

              @DzCode
              Hi
              You could maybe subclass HeaderView and overwrite paintSection
              do your own image and text scaling.

              Do you also need the actual cells to scale this way ?
              You could add your own delegate and scale images and text too.

              D 1 Reply Last reply
              0
              • mrjjM mrjj

                @DzCode
                Hi
                You could maybe subclass HeaderView and overwrite paintSection
                do your own image and text scaling.

                Do you also need the actual cells to scale this way ?
                You could add your own delegate and scale images and text too.

                D Offline
                D Offline
                DzCode
                wrote on last edited by
                #9

                @mrjj

                I am resizing the images inside a proxymodel now.

                However, there is one thing left to solve my all problems.

                I am using checkstaterole of my model to make some columns checkable. There is problem about resizing them. I dont want to replace them with QCheckBox. I created checboxes with the help of the Qt::ItemIsUserCheckable flag. How can I resize them?

                mrjjM 1 Reply Last reply
                0
                • D DzCode

                  @mrjj

                  I am resizing the images inside a proxymodel now.

                  However, there is one thing left to solve my all problems.

                  I am using checkstaterole of my model to make some columns checkable. There is problem about resizing them. I dont want to replace them with QCheckBox. I created checboxes with the help of the Qt::ItemIsUserCheckable flag. How can I resize them?

                  mrjjM Offline
                  mrjjM Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on last edited by mrjj
                  #10

                  @DzCode
                  hi
                  Ok that sounds good too.

                  I have never tried to style the "checkable" but I think you can control it with a delegate and
                  https://doc.qt.io/qt-5/qitemdelegate.html#drawCheck

                  Update: nope, it wont care if given bigger or smaller rect.
                  bascially it boils down to
                  style->drawPrimitive(QStyle::PE_IndicatorItemViewItemCheck, &opt, painter, widget);

                  D 1 Reply Last reply
                  0
                  • mrjjM mrjj

                    @DzCode
                    hi
                    Ok that sounds good too.

                    I have never tried to style the "checkable" but I think you can control it with a delegate and
                    https://doc.qt.io/qt-5/qitemdelegate.html#drawCheck

                    Update: nope, it wont care if given bigger or smaller rect.
                    bascially it boils down to
                    style->drawPrimitive(QStyle::PE_IndicatorItemViewItemCheck, &opt, painter, widget);

                    D Offline
                    D Offline
                    DzCode
                    wrote on last edited by
                    #11

                    @mrjj

                    I did it via stylesheet of QtableView::indicator.

                    Thanks both of you for your support

                    mrjjM 1 Reply Last reply
                    1
                    • D DzCode

                      @mrjj

                      I did it via stylesheet of QtableView::indicator.

                      Thanks both of you for your support

                      mrjjM Offline
                      mrjjM Offline
                      mrjj
                      Lifetime Qt Champion
                      wrote on last edited by
                      #12

                      @DzCode
                      Good work. So even using stylesheets it zooms fast enough ?

                      D 1 Reply Last reply
                      0
                      • mrjjM mrjj

                        @DzCode
                        Good work. So even using stylesheets it zooms fast enough ?

                        D Offline
                        D Offline
                        DzCode
                        wrote on last edited by
                        #13

                        @mrjj I didnt test it with chrono since I didnt have a time to, but for user perspective, there is no problem if you have less table

                        1 Reply Last reply
                        1

                        • Login

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • Users
                        • Groups
                        • Search
                        • Get Qt
                        • Unsolved