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. QComboBox Popup Hover Style [SOLVED]

QComboBox Popup Hover Style [SOLVED]

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 4.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.
  • E Offline
    E Offline
    elveatles
    wrote on last edited by
    #1

    Is there really no way to have the stylesheet affect individual items in the list view that pops up when you click on a combo box?
    I tried this:
    @
    QComboBox QAbstractItemView::item:hover {
    background: red;
    }
    @

    but it doesn't work.

    1 Reply Last reply
    0
    • dheerendraD Offline
      dheerendraD Offline
      dheerendra
      Qt Champions 2022
      wrote on last edited by
      #2

      Try this.

      @ QComboBox combo;
      QListView * listView = new QListView(&combo);
      combo.addItem("pthinks.com");
      combo.addItem("Bangaluru");
      combo.addItem("india");
      combo.addItem("dheerendra");
      listView->setStyleSheet("QListView::item:hover {
      background: red }
      ");

      combo.setView(listView);
      combo.show();@
      

      Dheerendra
      @Community Service
      Certified Qt Specialist
      http://www.pthinks.com

      1 Reply Last reply
      0
      • E Offline
        E Offline
        elveatles
        wrote on last edited by
        #3

        This works! Thank you so much!
        These Qt quirks drive me crazy!

        1 Reply Last reply
        0
        • dheerendraD Offline
          dheerendraD Offline
          dheerendra
          Qt Champions 2022
          wrote on last edited by
          #4

          You can move this to SOLVED state by editing your question.

          Dheerendra
          @Community Service
          Certified Qt Specialist
          http://www.pthinks.com

          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