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 stylesheet problem
Qt 6.11 is out! See what's new in the release blog

QComboBox stylesheet problem

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

    I have done a lot of googling and trial and error to get this combobox to where it is. The problem is when I modify the border of the dropdown, if the border is a different color than the background it looks like the scroll bar is being drawn on top of the border. I currently have the up and down buttons hidden, but even if I enable them and move them around there is still this problem. The only time it goes away is if I don't override the border of the dropdown. See attached image and stylesheet:

    !http://db.tt/0obSZX0w!

    @QAbstractItemView {
    border: 2px solid #2ef928;
    padding: 5 5 5 5;
    border-radius: 5px;
    background: black;
    color: #2ef928;
    font-size: 30px;
    }

    /* Sets up scrollbar size, border, color /
    QScrollBar:vertical {
    /
    border: 2px solid red; /
    border-radius: 5px;
    background: black;
    width: 48px;
    /
    margin sets up how far the handle can travel*/
    margin: 0px 0px 0px 0px;
    }

    /* Sets up the color and height of handle */
    QScrollBar::handle:vertical {
    border-radius: 5px;
    background: #2ef928;
    min-height: 48px;
    }

    /* This remvoes the bottom button by setting the height to 0px */
    QScrollBar::add-line:vertical {
    height: 0px;
    subcontrol-position: bottom;
    subcontrol-origin: margin;
    }

    /* This remvoes the top button by setting the height to 0px */
    QScrollBar::sub-line:vertical {
    height: 0px;
    subcontrol-position: top;
    subcontrol-origin: margin;
    }

    /*
    QScrollBar::up-arrow:vertical, QScrollBar::down-arrow:vertical {
    border: 2px solid grey;
    width: 5px;
    height: 5px;
    background: white;
    }
    */

    /* need this to get rid of crosshatching on scrollbar background */
    QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical {
    background: none;
    }

    QComboBox {
    border: 2px solid #2ef928;
    border-radius: 20px;
    background: black;
    padding-left: 5px;
    color: #2ef928;
    font-size: 30px;
    height: 50px;
    width: 309px;
    }

    QComboBox::down-arrow {
    image: url();
    }

    QComboBox::drop-down {
    border: 0px;
    }

    @

    1 Reply Last reply
    0
    • mgilormaM Offline
      mgilormaM Offline
      mgilorma
      wrote on last edited by
      #2

      Update:

      I found that if I adjusted the padding along the bottom to 16px, whatever is on top of the border is out of the way. When I did this, it brought to my attention that there is some sort of transparent control at the bottom that if I move my mouse over it scrolls down the list. This is only there when I change the border.

      !http://db.tt/lhTRDM3F!

      @QAbstractItemView {
      border: 2px solid #2ef928;
      padding: 5 5 16 5;
      border-radius: 10px;
      background: black;
      color: #2ef928;
      font-size: 30px;
      }

      /* Sets up scrollbar size, border, color /
      QScrollBar:vertical {
      border-radius: 10px;
      background: black;
      width: 48px;
      /
      margin sets up how far the handle can travel*/
      margin: 0px 0px 0px 0px;
      }

      /* Sets up the color and height of handle */
      QScrollBar::handle:vertical {
      border-radius: 10px;
      background: #2ef928;
      min-height: 48px;
      }

      /* This remvoes the bottom button by setting the height to 0px */
      QScrollBar::add-line:vertical {
      height: 0px;
      subcontrol-position: bottom;
      subcontrol-origin: margin;
      }

      /* This remvoes the top button by setting the height to 0px */
      QScrollBar::sub-line:vertical {
      height: 0px;
      subcontrol-position: top;
      subcontrol-origin: margin;
      }

      /* need this to get rid of crosshatching on scrollbar background */
      QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical {
      background: none;
      }

      QComboBox {
      border: 2px solid #2ef928;
      border-radius: 20px;
      background: black;
      padding-left: 5px;
      color: #2ef928;
      font-size: 30px;
      height: 50px;
      width: 309px;
      }

      QComboBox::down-arrow {
      image: url();
      }

      QComboBox::drop-down {
      border: 0px;
      }

      @

      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