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. QListWidget currentRow prints -1 after setting a stylesheet
Forum Updated to NodeBB v4.3 + New Features

QListWidget currentRow prints -1 after setting a stylesheet

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 265 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.
  • S Offline
    S Offline
    Sucharek
    wrote on last edited by
    #1

    Hi, so I set a stylesheet to QListWidget, but when I try to get the current row I selected, it prints -1.
    I don't know why this is happening.
    Also, when I scroll down, and I try to click something, it doesn't click where I want it to.
    The stylesheet:

    QListWidget::item {color: rgb(211, 213, 201); background-color: rgb(36, 36, 44);}
    QListWidget::item:selected {color: rgb(211, 213, 201); background-color: rgb(66, 66, 74); border: 0.5px solid black;}
    
    JonBJ 1 Reply Last reply
    0
    • S Sucharek

      Hi, so I set a stylesheet to QListWidget, but when I try to get the current row I selected, it prints -1.
      I don't know why this is happening.
      Also, when I scroll down, and I try to click something, it doesn't click where I want it to.
      The stylesheet:

      QListWidget::item {color: rgb(211, 213, 201); background-color: rgb(36, 36, 44);}
      QListWidget::item:selected {color: rgb(211, 213, 201); background-color: rgb(66, 66, 74); border: 0.5px solid black;}
      
      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by JonB
      #2

      @Sucharek
      Setting or not setting a stylesheet can have no effect at all on anything like "get the current row I selected" or "what you click" on a QListWidget. Nor affecting its click behaviour. So whatever you are doing/not doing it is in your code for the list widget.

      S 1 Reply Last reply
      2
      • JonBJ JonB

        @Sucharek
        Setting or not setting a stylesheet can have no effect at all on anything like "get the current row I selected" or "what you click" on a QListWidget. Nor affecting its click behaviour. So whatever you are doing/not doing it is in your code for the list widget.

        S Offline
        S Offline
        Sucharek
        wrote on last edited by
        #3

        Hi @JonB thanks for your response.
        After a deep look in my code, I found the thing that was causing this to fail.
        Thanks for telling me.

        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