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. QTableView: hide vertical lines on windows?
QtWS25 Last Chance

QTableView: hide vertical lines on windows?

Scheduled Pinned Locked Moved Unsolved General and Desktop
14 Posts 4 Posters 547 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.
  • D Offline
    D Offline
    davecotter
    wrote on last edited by davecotter
    #1

    they are correctly not showing up on mac, which is what i want.
    but on windows, they incorrectly do show, no matter what i try:

    // nope:
    tableViewP->setShowGrid(false); 
    
    // also nope:
    tableViewP->setStyleSheet("QTableView:{ border: none; outline: 0; gridline-color: rgba(255,0,0,0.0); border-right-color: rgba(255,0,0,0.0); border-left-color: rgba(255,0,0,0.0); }");
    

    so: how do we get RID of those vertical lines??
    Screenshot 2025-02-17 at 12.36.47 PM.png

    1 Reply Last reply
    0
    • D Offline
      D Offline
      davecotter
      wrote on last edited by
      #2

      has anyone run into this?
      i can see lots of folks have this question, but no "answers" seem to work:

      https://forum.qt.io/topic/135029/how-can-i-hide-the-borders-of-the-cells-in-a-qtableview
      https://stackoverflow.com/questions/22455445/how-to-hide-vertical-horizontal-lines-in-qtablewidget
      https://stackoverflow.com/questions/69076597/how-can-i-remove-the-outside-gridlines-of-qtablewidget-and-qheaderview
      https://www.qtcentre.org/threads/57179-get-rid-of-grid-lines-amp-vertical-table-header-in-QTableView
      https://www.qtcentre.org/threads/23958-Grid-QTableView-horizontal-only

      here's one i have NOT tried but there MUST be a way to do this without creating a line draw delegate???
      https://stackoverflow.com/questions/37429127/remove-the-vertical-grid-lines-of-a-qtableview

      Pl45m4P 1 Reply Last reply
      0
      • D davecotter

        has anyone run into this?
        i can see lots of folks have this question, but no "answers" seem to work:

        https://forum.qt.io/topic/135029/how-can-i-hide-the-borders-of-the-cells-in-a-qtableview
        https://stackoverflow.com/questions/22455445/how-to-hide-vertical-horizontal-lines-in-qtablewidget
        https://stackoverflow.com/questions/69076597/how-can-i-remove-the-outside-gridlines-of-qtablewidget-and-qheaderview
        https://www.qtcentre.org/threads/57179-get-rid-of-grid-lines-amp-vertical-table-header-in-QTableView
        https://www.qtcentre.org/threads/23958-Grid-QTableView-horizontal-only

        here's one i have NOT tried but there MUST be a way to do this without creating a line draw delegate???
        https://stackoverflow.com/questions/37429127/remove-the-vertical-grid-lines-of-a-qtableview

        Pl45m4P Online
        Pl45m4P Online
        Pl45m4
        wrote on last edited by
        #3

        @davecotter said in QTableView: hide vertical lines on windows?:

        i can see lots of folks have this question, but no "answers" seem to work:

        AFAICS the solutions provided in most of the topics seem to work?!
        So I believe it must be the right way "somehow"...
        Have you tried the solutions discussed in @Simmania 's topic in a minimal/stripped-down example?!
        Maybe some parent style in your huge project is overriding the stylesheet again?


        If debugging is the process of removing software bugs, then programming must be the process of putting them in.

        ~E. W. Dijkstra

        1 Reply Last reply
        0
        • D Offline
          D Offline
          davecotter
          wrote on last edited by davecotter
          #4

          yes i tried that. there is an example called "Frozen Column" that demonstrates Table View using Widgets.

          i added lines to set the grid pen to none, line that hides the grid, and another that set the grid to RED.
          horizontal lines were removed (or 100% transparent?), but vertical lines were still showing, only in gray color, not RED.

          i actually think this must be a bug in Qt 6.9?

          i guess if i HAVE to make a custom draw delegate i will, but wow that's a LOT of work for something that should be a one-liner.

          Screenshot 2025-02-18 at 8.43.17 PM.png

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            Hi,

            Any chances you are on Windows 11 ?

            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
            • D Offline
              D Offline
              davecotter
              wrote on last edited by
              #6

              yes, windows 11

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #7

                Can you try again forcing the style to windowsvista ?

                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
                • D Offline
                  D Offline
                  davecotter
                  wrote on last edited by davecotter
                  #8

                  you mean as a test? cuz, you know, i prefer the modern windows style

                  actually i'm not sure how to set the style? it's a widgets app.

                  Pl45m4P 1 Reply Last reply
                  0
                  • D davecotter

                    you mean as a test? cuz, you know, i prefer the modern windows style

                    actually i'm not sure how to set the style? it's a widgets app.

                    Pl45m4P Online
                    Pl45m4P Online
                    Pl45m4
                    wrote on last edited by
                    #9

                    @davecotter said in QTableView: hide vertical lines on windows?:

                    actually i'm not sure how to set the style? it's a widgets app.

                    so...?!

                    Try

                    QApplication::setStyle(QStyleFactory::create("windowsvista"));
                    

                    If debugging is the process of removing software bugs, then programming must be the process of putting them in.

                    ~E. W. Dijkstra

                    1 Reply Last reply
                    0
                    • D Offline
                      D Offline
                      davecotter
                      wrote on last edited by
                      #10

                      your suspicion is correct: vista style has no lines:

                      Screenshot 2025-02-19 at 4.55.15 PM.png

                      Pl45m4P 1 Reply Last reply
                      0
                      • D Offline
                        D Offline
                        davecotter
                        wrote on last edited by
                        #11

                        https://bugreports.qt.io/browse/QTBUG-133853

                        Christian EhrlicherC 1 Reply Last reply
                        1
                        • D davecotter

                          your suspicion is correct: vista style has no lines:

                          Screenshot 2025-02-19 at 4.55.15 PM.png

                          Pl45m4P Online
                          Pl45m4P Online
                          Pl45m4
                          wrote on last edited by Pl45m4
                          #12

                          @davecotter said in QTableView: hide vertical lines on windows?:

                          your suspicion is correct: vista style has no lines:

                          So what @SGaist was after:
                          There are still some bugs related the "new" windows11 style.

                          Seems like you have to wait until it works correctly (or/and use other styles like fusion or windowsvista in the meantime)
                          Search the bugtracker for reports like these, if there aren't any, you may create your own bugreport so the dev team knows :)

                          Edit: Ok you did already :)


                          If debugging is the process of removing software bugs, then programming must be the process of putting them in.

                          ~E. W. Dijkstra

                          1 Reply Last reply
                          0
                          • D davecotter

                            https://bugreports.qt.io/browse/QTBUG-133853

                            Christian EhrlicherC Offline
                            Christian EhrlicherC Offline
                            Christian Ehrlicher
                            Lifetime Qt Champion
                            wrote on last edited by
                            #13

                            @davecotter said in QTableView: hide vertical lines on windows?:

                            https://bugreports.qt.io/browse/QTBUG-133853

                            You can close it. It's fixed in Qt 6.9 already.

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

                            1 Reply Last reply
                            0
                            • D Offline
                              D Offline
                              davecotter
                              wrote on last edited by
                              #14

                              i have 6.9 beta 2, it is NOT fixed.
                              are you talking about 6.9 beta 3?

                              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