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. Style-sheet pseudo-state for selected item in QListView?
Qt 6.11 is out! See what's new in the release blog

Style-sheet pseudo-state for selected item in QListView?

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 3 Posters 502 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.
  • J Offline
    J Offline
    Joachim W
    wrote on last edited by
    #1

    https://doc.qt.io/qt-6/stylesheet-reference.html#list-of-pseudo-states has a long list of pseudo-states, among them :selected for the selected items in a QListView. Is there really no :current pseudo-state for the current item in a QListView? Why?

    Pl45m4P 1 Reply Last reply
    0
    • J Joachim W

      https://doc.qt.io/qt-6/stylesheet-reference.html#list-of-pseudo-states has a long list of pseudo-states, among them :selected for the selected items in a QListView. Is there really no :current pseudo-state for the current item in a QListView? Why?

      Pl45m4P Offline
      Pl45m4P Offline
      Pl45m4
      wrote on last edited by Pl45m4
      #2

      @Joachim-W said in Style-sheet pseudo-state for selected item in QListView?:

      Is there really no :current pseudo-state for the current item in a QListView? Why?

      What should current do?
      There are selected and non selected items, or hovered and non hovered items, or active and inactive items... Why do you need a stylesheet (i.e. extra state/selector) for a "current" item?!


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

      ~E. W. Dijkstra

      J 1 Reply Last reply
      1
      • Pl45m4P Pl45m4

        @Joachim-W said in Style-sheet pseudo-state for selected item in QListView?:

        Is there really no :current pseudo-state for the current item in a QListView? Why?

        What should current do?
        There are selected and non selected items, or hovered and non hovered items, or active and inactive items... Why do you need a stylesheet (i.e. extra state/selector) for a "current" item?!

        J Offline
        J Offline
        Joachim W
        wrote on last edited by
        #3

        @Pl45m4 As I learned from https://forum.qt.io/topic/154635, and as confirmed by the API Docs (https://doc.qt.io/qt-6/qabstractitemview.html#currentIndex), there is also a "current" item in a QListView.

        JonBJ Pl45m4P 2 Replies Last reply
        0
        • J Joachim W

          @Pl45m4 As I learned from https://forum.qt.io/topic/154635, and as confirmed by the API Docs (https://doc.qt.io/qt-6/qabstractitemview.html#currentIndex), there is also a "current" item in a QListView.

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

          @Joachim-W
          If you read the docs that is kind of like/used for selection in code. As you have found, there is no pseudo-state for it. Hopefully selected would suffice for you.

          1 Reply Last reply
          1
          • J Joachim W

            @Pl45m4 As I learned from https://forum.qt.io/topic/154635, and as confirmed by the API Docs (https://doc.qt.io/qt-6/qabstractitemview.html#currentIndex), there is also a "current" item in a QListView.

            Pl45m4P Offline
            Pl45m4P Offline
            Pl45m4
            wrote on last edited by
            #5

            @Joachim-W said in Style-sheet pseudo-state for selected item in QListView?:

            As I learned from https://forum.qt.io/topic/154635, and as confirmed by the API Docs (https://doc.qt.io/qt-6/qabstractitemview.html#currentIndex), there is also a "current" item in a QListView.

            As @JonB said, you are mixing up code "logic" and stylesheet states... They have no direct relation to each other.
            If I create my own item view and add a function called blaa(), which returns a struct named Blaa, it does not mean you have a property or style selector named MyItemView:blaa to apply any stylesheet to.


            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
            1

            • Login

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