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 remove border around qtreeview??

how to remove border around qtreeview??

Scheduled Pinned Locked Moved Solved General and Desktop
10 Posts 3 Posters 3.0k 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.
  • A Offline
    A Offline
    abdullahzubair109
    wrote on last edited by
    #1

    i want to remove border around a qtreeview widget?? i am using qtreeview under a vertical layout.. but it paints a rectangular border,, how can i remove that?

    jsulmJ 1 Reply Last reply
    0
    • A abdullahzubair109

      i want to remove border around a qtreeview widget?? i am using qtreeview under a vertical layout.. but it paints a rectangular border,, how can i remove that?

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

      @abdullahzubair109 What border do you mean?
      You probably need to remove the margins from your layout.

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

      1 Reply Last reply
      1
      • mrjjM Offline
        mrjjM Offline
        mrjj
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi
        https://doc.qt.io/qt-5/qlayout.html#setContentsMargins
        It has 9-11 px default margin for any layout.

        A 1 Reply Last reply
        0
        • mrjjM mrjj

          Hi
          https://doc.qt.io/qt-5/qlayout.html#setContentsMargins
          It has 9-11 px default margin for any layout.

          A Offline
          A Offline
          abdullahzubair109
          wrote on last edited by
          #4

          @mrjj i meant black border around the widget..

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

            hi
            you can use stylesheet
            tree->setStyleSheet("border: 0");
            use
            setFrameShape(QFrame::NoFrame);

            A 2 Replies Last reply
            0
            • mrjjM mrjj

              hi
              you can use stylesheet
              tree->setStyleSheet("border: 0");
              use
              setFrameShape(QFrame::NoFrame);

              A Offline
              A Offline
              abdullahzubair109
              wrote on last edited by
              #6

              @mrjj thaks

              1 Reply Last reply
              0
              • mrjjM mrjj

                hi
                you can use stylesheet
                tree->setStyleSheet("border: 0");
                use
                setFrameShape(QFrame::NoFrame);

                A Offline
                A Offline
                abdullahzubair109
                wrote on last edited by
                #7

                @mrjj one more thing.. can i use qstyle instead???

                mrjjM 1 Reply Last reply
                0
                • A abdullahzubair109

                  @mrjj one more thing.. can i use qstyle instead???

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

                  @abdullahzubair109
                  Hi
                  Well yes if you made a custom style that would draw the qtreeview without border but
                  i think its not trivial. You could also look into
                  https://doc.qt.io/qt-5/qproxystyle.html
                  but I cant tell what you would need to override to get rid of the border.

                  A 1 Reply Last reply
                  0
                  • mrjjM mrjj

                    @abdullahzubair109
                    Hi
                    Well yes if you made a custom style that would draw the qtreeview without border but
                    i think its not trivial. You could also look into
                    https://doc.qt.io/qt-5/qproxystyle.html
                    but I cant tell what you would need to override to get rid of the border.

                    A Offline
                    A Offline
                    abdullahzubair109
                    wrote on last edited by
                    #9

                    @mrjj i tried to set frame shape of treeview to QFrame::NoFrame.. it worked

                    mrjjM 1 Reply Last reply
                    3
                    • A abdullahzubair109

                      @mrjj i tried to set frame shape of treeview to QFrame::NoFrame.. it worked

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

                      @abdullahzubair109
                      ah. i missed it had setFrame function.
                      Good found :)

                      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