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 to make QTableWidgets full of gridlines
Forum Updated to NodeBB v4.3 + New Features

How to make QTableWidgets full of gridlines

Scheduled Pinned Locked Moved Solved General and Desktop
18 Posts 5 Posters 2.3k 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.
  • jronaldJ Offline
    jronaldJ Offline
    jronald
    wrote on last edited by
    #3

    With stylesheets, how to draw lines between secions of vertical header, and make the color the same as other guide lines that's by default?

    Gojir4G 2 Replies Last reply
    0
    • jronaldJ jronald

      With stylesheets, how to draw lines between secions of vertical header, and make the color the same as other guide lines that's by default?

      Gojir4G Offline
      Gojir4G Offline
      Gojir4
      wrote on last edited by
      #4

      @jronald My bad, that stylesheet was only for table border but not for cells...

      this should work better, but it removes the background color in case you have changed it (see discussion here):
      ui->tableView->setStylesheet("QTableView::item { border: 1px solid red}");

      I didn't find a better solution

      1 Reply Last reply
      0
      • jronaldJ jronald

        With stylesheets, how to draw lines between secions of vertical header, and make the color the same as other guide lines that's by default?

        Gojir4G Offline
        Gojir4G Offline
        Gojir4
        wrote on last edited by
        #5

        @jronald This is probably the solution you're looking for:

        ui->tableView->setStylesheet("QTableView {gridline-color: red}");
        ui->tableView->horizontalHeader()->setStyleSheet("::section{border: 1px solid blue;}");
        ui->tableView->verticalHeader()->setStyleSheet("::section{border: 1px solid green;}");
        
        jronaldJ 1 Reply Last reply
        0
        • Gojir4G Gojir4

          @jronald This is probably the solution you're looking for:

          ui->tableView->setStylesheet("QTableView {gridline-color: red}");
          ui->tableView->horizontalHeader()->setStyleSheet("::section{border: 1px solid blue;}");
          ui->tableView->verticalHeader()->setStyleSheet("::section{border: 1px solid green;}");
          
          jronaldJ Offline
          jronaldJ Offline
          jronald
          wrote on last edited by
          #6

          @Gojir4 said in How to make QTableWidgets full of gridlines:

          ui->tableView->setStylesheet("QTableView {gridline-color: red}");
          ui->tableView->horizontalHeader()->setStyleSheet("::section{border: 1px solid blue;}");
          ui->tableView->verticalHeader()->setStyleSheet("::section{border: 1px solid green;}");

          d03ea014-b02e-4ce2-886e-46ff4591aac8-image.png

          Not perfect

          1 Reply Last reply
          0
          • jronaldJ Offline
            jronaldJ Offline
            jronald
            wrote on last edited by
            #7

            On Linux, it's better, though still not perfect. I think it might be the difference between free version and non-free version.
            4afa6108-b095-4d0a-89bc-41c9dd27e7c1-image.png

            JonBJ B 2 Replies Last reply
            0
            • jronaldJ jronald

              On Linux, it's better, though still not perfect. I think it might be the difference between free version and non-free version.
              4afa6108-b095-4d0a-89bc-41c9dd27e7c1-image.png

              JonBJ Offline
              JonBJ Offline
              JonB
              wrote on last edited by JonB
              #8

              @jronald said in How to make QTableWidgets full of gridlines:

              I think it might be the difference between free version and non-free version.

              I don't think so, since they are identical in this and most respects (the only differences being extras which come with the commercial version, plus The Qt Company's support) :) What induces you to make such a statement?

              jronaldJ 1 Reply Last reply
              3
              • jronaldJ jronald

                On Linux, it's better, though still not perfect. I think it might be the difference between free version and non-free version.
                4afa6108-b095-4d0a-89bc-41c9dd27e7c1-image.png

                B Offline
                B Offline
                Bonnie
                wrote on last edited by
                #9

                @jronald No, that's because on Linux it is using fusion style while Windows ones using windows vista style.
                On Windows it can also be set to use fusion style.
                Take a look at QStyle.

                jronaldJ 1 Reply Last reply
                4
                • JonBJ JonB

                  @jronald said in How to make QTableWidgets full of gridlines:

                  I think it might be the difference between free version and non-free version.

                  I don't think so, since they are identical in this and most respects (the only differences being extras which come with the commercial version, plus The Qt Company's support) :) What induces you to make such a statement?

                  jronaldJ Offline
                  jronaldJ Offline
                  jronald
                  wrote on last edited by jronald
                  #10

                  @JonB said in How to make QTableWidgets full of gridlines:

                  I don't think so, since they are identical in this and most respects (the only differences being extras which come with the commercial version, plus The Qt Company's support) :) What induces you to make such a statement?

                  Because it's obvious that tables show as below by default are not as expected, and it's not hard to fix.
                  For a non-free version, if you ask for the company for support for such problems, patches might have been already there.

                  1217c62b-bcb0-43af-8e70-8f76cf5ff0fc-image.png

                  JonBJ jsulmJ 2 Replies Last reply
                  0
                  • B Bonnie

                    @jronald No, that's because on Linux it is using fusion style while Windows ones using windows vista style.
                    On Windows it can also be set to use fusion style.
                    Take a look at QStyle.

                    jronaldJ Offline
                    jronaldJ Offline
                    jronald
                    wrote on last edited by
                    #11

                    @Bonnie said in How to make QTableWidgets full of gridlines:

                    @jronald No, that's because on Linux it is using fusion style while Windows ones using windows vista style.
                    On Windows it can also be set to use fusion style.
                    Take a look at QStyle.

                    Thanks very much, it must help.

                    1 Reply Last reply
                    0
                    • jronaldJ jronald

                      @JonB said in How to make QTableWidgets full of gridlines:

                      I don't think so, since they are identical in this and most respects (the only differences being extras which come with the commercial version, plus The Qt Company's support) :) What induces you to make such a statement?

                      Because it's obvious that tables show as below by default are not as expected, and it's not hard to fix.
                      For a non-free version, if you ask for the company for support for such problems, patches might have been already there.

                      1217c62b-bcb0-43af-8e70-8f76cf5ff0fc-image.png

                      JonBJ Offline
                      JonBJ Offline
                      JonB
                      wrote on last edited by
                      #12

                      @jronald said in How to make QTableWidgets full of gridlines:

                      Because it's obvious that tables shows as below by default is not expected, and it's not hard to fix.

                      Since you choose to reply to me, what in the world does this have to do with your statement that the difference is between the commercial and free versions of Qt? You are suggesting to other readers that there is such a difference, which is just misleading.

                      And since you have acknowledged that @Bonnie's answer about your choice of Fusion vs Vista style is the reason for the difference, you know that commercial vs open source is not at issue.

                      jronaldJ 1 Reply Last reply
                      1
                      • jronaldJ jronald

                        @JonB said in How to make QTableWidgets full of gridlines:

                        I don't think so, since they are identical in this and most respects (the only differences being extras which come with the commercial version, plus The Qt Company's support) :) What induces you to make such a statement?

                        Because it's obvious that tables show as below by default are not as expected, and it's not hard to fix.
                        For a non-free version, if you ask for the company for support for such problems, patches might have been already there.

                        1217c62b-bcb0-43af-8e70-8f76cf5ff0fc-image.png

                        jsulmJ Offline
                        jsulmJ Offline
                        jsulm
                        Lifetime Qt Champion
                        wrote on last edited by jsulm
                        #13

                        @jronald said in How to make QTableWidgets full of gridlines:

                        Because it's obvious that tables shows as below by default is not expected, and it's not hard to fix.

                        Do you really think that the only possible explanation for this issue is that "difference between free version and non-free version"?!
                        Open source and commercial Qt use same code base. The only difference is the license and some additional modules/tools available onyl for commercial users. QWidgets module is exactly the same...

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

                        jronaldJ 1 Reply Last reply
                        0
                        • jsulmJ jsulm

                          @jronald said in How to make QTableWidgets full of gridlines:

                          Because it's obvious that tables shows as below by default is not expected, and it's not hard to fix.

                          Do you really think that the only possible explanation for this issue is that "difference between free version and non-free version"?!
                          Open source and commercial Qt use same code base. The only difference is the license and some additional modules/tools available onyl for commercial users. QWidgets module is exactly the same...

                          jronaldJ Offline
                          jronaldJ Offline
                          jronald
                          wrote on last edited by
                          #14

                          @jsulm said in How to make QTableWidgets full of gridlines:

                          Do you really think that the only possible explanation for this issue is that "difference between free version and non-free version"?!
                          Open source and commercial Qt use same code base. The only difference is the license and some additional modules/tools available onyl for commercial users. QWidgets module is exactly the same...

                          Also supports by the company, patches might be there.

                          jsulmJ 1 Reply Last reply
                          0
                          • JonBJ JonB

                            @jronald said in How to make QTableWidgets full of gridlines:

                            Because it's obvious that tables shows as below by default is not expected, and it's not hard to fix.

                            Since you choose to reply to me, what in the world does this have to do with your statement that the difference is between the commercial and free versions of Qt? You are suggesting to other readers that there is such a difference, which is just misleading.

                            And since you have acknowledged that @Bonnie's answer about your choice of Fusion vs Vista style is the reason for the difference, you know that commercial vs open source is not at issue.

                            jronaldJ Offline
                            jronaldJ Offline
                            jronald
                            wrote on last edited by jronald
                            #15

                            @JonB said in How to make QTableWidgets full of gridlines:

                            @jronald said in How to make QTableWidgets full of gridlines:

                            Because it's obvious that tables shows as below by default is not expected, and it's not hard to fix.

                            Since you choose to reply to me, what in the world does this have to do with your statement that the difference is between the commercial and free versions of Qt? You are suggesting to other readers that there is such a difference, which is just misleading.

                            And since you have acknowledged that @Bonnie's answer about your choice of Fusion vs Vista style is the reason for the difference, you know that commercial vs open source is not at issue.

                            At first sorry for my grammar, I should review it before posting.

                            Anyway I think the default style on Windows is not as expected, for a comercial license, the customer can ask for support to fix it.
                            With fusion style, as the screenshot shows, it is still not perfect.

                            JonBJ 1 Reply Last reply
                            0
                            • jronaldJ jronald

                              @JonB said in How to make QTableWidgets full of gridlines:

                              @jronald said in How to make QTableWidgets full of gridlines:

                              Because it's obvious that tables shows as below by default is not expected, and it's not hard to fix.

                              Since you choose to reply to me, what in the world does this have to do with your statement that the difference is between the commercial and free versions of Qt? You are suggesting to other readers that there is such a difference, which is just misleading.

                              And since you have acknowledged that @Bonnie's answer about your choice of Fusion vs Vista style is the reason for the difference, you know that commercial vs open source is not at issue.

                              At first sorry for my grammar, I should review it before posting.

                              Anyway I think the default style on Windows is not as expected, for a comercial license, the customer can ask for support to fix it.
                              With fusion style, as the screenshot shows, it is still not perfect.

                              JonBJ Offline
                              JonBJ Offline
                              JonB
                              wrote on last edited by
                              #16

                              @jronald said in How to make QTableWidgets full of gridlines:

                              for a comercial license, the customer can ask support to fix it.

                              I don't know what to say. Get a commercial licence and then see what The Qt Company has to say when you/your end-user tries to ask them to "fix" this (intended) behaviour.

                              1 Reply Last reply
                              0
                              • jronaldJ jronald

                                @jsulm said in How to make QTableWidgets full of gridlines:

                                Do you really think that the only possible explanation for this issue is that "difference between free version and non-free version"?!
                                Open source and commercial Qt use same code base. The only difference is the license and some additional modules/tools available onyl for commercial users. QWidgets module is exactly the same...

                                Also supports by the company, patches might be there.

                                jsulmJ Offline
                                jsulmJ Offline
                                jsulm
                                Lifetime Qt Champion
                                wrote on last edited by jsulm
                                #17

                                @jronald said in How to make QTableWidgets full of gridlines:

                                Also supports by the company, patches might be there

                                Don't know what you mean. What company? What patches? What support?
                                All Qt patches are merged into mainline and released. The only difference is that open source users do not get Qt binaries for point releses (5.15.x). But open source users can download the source code and build by themselfs...
                                Support from QtCompany requires a commercial license, yes - but this has NOTHING to do with Qt itself...

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

                                jronaldJ 1 Reply Last reply
                                1
                                • jsulmJ jsulm

                                  @jronald said in How to make QTableWidgets full of gridlines:

                                  Also supports by the company, patches might be there

                                  Don't know what you mean. What company? What patches? What support?
                                  All Qt patches are merged into mainline and released. The only difference is that open source users do not get Qt binaries for point releses (5.15.x). But open source users can download the source code and build by themselfs...
                                  Support from QtCompany requires a commercial license, yes - but this has NOTHING to do with Qt itself...

                                  jronaldJ Offline
                                  jronaldJ Offline
                                  jronald
                                  wrote on last edited by jronald
                                  #18

                                  @jsulm said in How to make QTableWidgets full of gridlines:

                                  @jronald said in How to make QTableWidgets full of gridlines:

                                  Also supports by the company, patches might be there

                                  Don't know what you mean. What company?

                                  Qt

                                  What patches?

                                  patches to fix the lines in QTableWidget / QTableView

                                  What support?

                                  paid support

                                  All Qt patches are merged into mainline and released. The only difference is that open source users do not get Qt binaries for point releses (5.15.x). But open source users can download the source code and build by themselfs...
                                  Support from QtCompany requires a commercial license, yes - but this has NOTHING to do with Qt itself...

                                  If you are comfortable with the default table styles as in the screenshots below, you are right
                                  alt text

                                  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