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. Strange border with QListWidget
Forum Updated to NodeBB v4.3 + New Features

Strange border with QListWidget

Scheduled Pinned Locked Moved Solved General and Desktop
16 Posts 3 Posters 7.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.
  • T Tyskie

    Thanks @mrjj , I tried to set the style on all parent item till QObject :D nothing helped it looks like it is outside the QListWidget, I will try to dig deeper. thanks for the hint.

    @Diracsbracket Thanks as well, I tried to set the Shape and Style, nothing help unfortunately :(

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

    @Tyskie
    Thats the main reason , its recommended to use 1 stylesheet on
    QApplication or mainwindow and not multiple on various widgets.
    Its hard(er) to handle.

    Im pretty sure it just comes from a broad selector somewhere in parent tree.

    DiracsbracketD 1 Reply Last reply
    2
    • mrjjM mrjj

      @Tyskie
      Thats the main reason , its recommended to use 1 stylesheet on
      QApplication or mainwindow and not multiple on various widgets.
      Its hard(er) to handle.

      Im pretty sure it just comes from a broad selector somewhere in parent tree.

      DiracsbracketD Offline
      DiracsbracketD Offline
      Diracsbracket
      wrote on last edited by Diracsbracket
      #8

      @Tyskie
      As @mrjj said in Strange border with QListWidget:

      Thats the main reason , its recommended to use 1 stylesheet on
      QApplication or mainwindow and not multiple on various widgets.
      Its hard(er) to handle.

      In addition, to debug your specific problem, try to comment all the setStyleSheet() commands you use in your code and check if the frame is still there.
      Then, if it is still there, try tabwidget.setFrameStyle()...

      1 Reply Last reply
      1
      • T Offline
        T Offline
        Tyskie
        wrote on last edited by
        #9

        @Diracsbracket I did that already, I even set custom frame style and border to that Frame, it appears inside this gray border box. This is really weird, even setting a * on the MainWindow style sheet with a border: 1px solid red doesnt color that border. I cannot find where it is coming from :D

        1 Reply Last reply
        0
        • T Offline
          T Offline
          Tyskie
          wrote on last edited by
          #10

          It seems to happen only on mac-osx apparently. On Windows I do not have this border ;(

          mrjjM DiracsbracketD 2 Replies Last reply
          0
          • T Tyskie

            It seems to happen only on mac-osx apparently. On Windows I do not have this border ;(

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

            @Tyskie
            oh ?
            time to test a clean project then.
            To see if it just gets border if it sees a stylesheet. ( on macOs)

            DiracsbracketD 1 Reply Last reply
            1
            • T Tyskie

              It seems to happen only on mac-osx apparently. On Windows I do not have this border ;(

              DiracsbracketD Offline
              DiracsbracketD Offline
              Diracsbracket
              wrote on last edited by Diracsbracket
              #12

              @Tyskie said in Strange border with QListWidget:

              On Windows I do not have this border ;(

              That's why I suggested the setFrameStyle. I had a similar problem when running my first app on MacOS. The frame was not visible in Windows, because it happened to have the same color as the window. It showed on MacOS X, and it took me a while to remember that I had put my layout in a parent QFrame (I couldn't at first understand why there was a border at all because layouts don't have a border or frame property). Too bad it is not helping in your case :-(.

              1 Reply Last reply
              0
              • mrjjM mrjj

                @Tyskie
                oh ?
                time to test a clean project then.
                To see if it just gets border if it sees a stylesheet. ( on macOs)

                DiracsbracketD Offline
                DiracsbracketD Offline
                Diracsbracket
                wrote on last edited by Diracsbracket
                #13

                @Tyskie I think I may have found it...
                As suggested by @mrjj, I tried a clean example on my MacOS X VM...

                The thick border seems to be a focus border...

                If you set the focusPolicy property of the QListWidget to NoFocus, the border disappears.

                Alternatively, and better:
                https://stackoverflow.com/questions/13327818/how-to-prevent-the-default-blue-border-being-drawn-on-qlineedit-focus

                ui->listWidget->setAttribute(Qt::WA_MacShowFocusRect, 0)
                
                mrjjM 1 Reply Last reply
                0
                • DiracsbracketD Diracsbracket

                  @Tyskie I think I may have found it...
                  As suggested by @mrjj, I tried a clean example on my MacOS X VM...

                  The thick border seems to be a focus border...

                  If you set the focusPolicy property of the QListWidget to NoFocus, the border disappears.

                  Alternatively, and better:
                  https://stackoverflow.com/questions/13327818/how-to-prevent-the-default-blue-border-being-drawn-on-qlineedit-focus

                  ui->listWidget->setAttribute(Qt::WA_MacShowFocusRect, 0)
                  
                  mrjjM Offline
                  mrjjM Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on last edited by
                  #14

                  Nice find @Diracsbracket
                  So its just MacOs focus Rect we see ?

                  DiracsbracketD 1 Reply Last reply
                  0
                  • mrjjM mrjj

                    Nice find @Diracsbracket
                    So its just MacOs focus Rect we see ?

                    DiracsbracketD Offline
                    DiracsbracketD Offline
                    Diracsbracket
                    wrote on last edited by Diracsbracket
                    #15

                    @mrjj said in Strange border with QListWidget:

                    So its just MacOs focus Rect we see

                    Yes, it seems that way. However, I was suprised to see that when I clicked on a button, the focus rectangle did not disappear; this was because the button only had tab focus. When I changed the focus policy of the button to strong, the focus rectangle disappears from the QListWidget when I clicked the button; If this would have happened directly, it would have been clear from the start that this was a focus rectangle :0

                    1 Reply Last reply
                    1
                    • T Offline
                      T Offline
                      Tyskie
                      wrote on last edited by
                      #16

                      @Diracsbracket said in Strange border with QListWidget:

                      The thick border seems to be a focus border...

                      Wow. Thanks ! indeed it did the trick, I would never have find that. Thanks a ton !

                      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