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 delete dots from QListWidget?

How to delete dots from QListWidget?

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 3 Posters 751 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.
  • T Offline
    T Offline
    TomNow99
    wrote on last edited by
    #1

    Hi,

    I have QListWidget with QWidgets on it ( I use setItemWidget(); ).

    Everything is ok, but I would like to have a separate line between items on this list. So I have in my code:

    qlist->setStyleSheet( "QListWidget::item { border-bottom:1px solid black; }" );
    

    And it works.

    But when I started app I see that the first row have dots around that item. When I change selected row there are that dots in other row. When I delete that line, which set StyleSheet there are no dots.

    Picture:
    aaa.png

    1. with css ( there are dots and separate line )
    2. without css ( no dots and no separate line )

    How can I delete dots and have separate line?

    JonBJ 1 Reply Last reply
    0
    • Christian EhrlicherC Online
      Christian EhrlicherC Online
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      What you see here is the focus rect which has nothing to do with your css you posted above.

      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
      4
      • T TomNow99

        Hi,

        I have QListWidget with QWidgets on it ( I use setItemWidget(); ).

        Everything is ok, but I would like to have a separate line between items on this list. So I have in my code:

        qlist->setStyleSheet( "QListWidget::item { border-bottom:1px solid black; }" );
        

        And it works.

        But when I started app I see that the first row have dots around that item. When I change selected row there are that dots in other row. When I delete that line, which set StyleSheet there are no dots.

        Picture:
        aaa.png

        1. with css ( there are dots and separate line )
        2. without css ( no dots and no separate line )

        How can I delete dots and have separate line?

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

        @TomNow99
        Further to @Christian-Ehrlicher : the dots are the focus rectangle, if you never want to see it and your widget does not need to accept focus you could try yourWidget->setFocusPolicy(Qt::NoFocus).

        1 Reply Last reply
        2
        • T Offline
          T Offline
          TomNow99
          wrote on last edited by
          #4

          @Christian-Ehrlicher @JonB You are right. Thank you! But I have other question: why when I don't set css - everything is ok? When there is no css, QWidget has setFocusPolicy to noFocus?

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

            @TomNow99 said in How to delete dots from QListWidget?:

            why when I don't set css - everything is ok?

            Because your default style maybe does not draw a focus rect? Don't know your default style. For css another style is used due to: "Style sheets are applied on top of the current widget style, meaning that your applications will look as native as possible, but any style sheet constraints will be taken into consideration." (https://doc.qt.io/qt-5/stylesheet.html)

            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
            2

            • Login

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