pycharmpyqt5qt-designerqcomboboxqlistview

styleSheet QComboBox QListView not working after convert UI to PY


I created my first UI using Qt Designer and convert UI to PY. The styleSheets QComboBox QListView and QComboBox QAbstractItemView are not working after converting. But in Qt Designer all styleSheet QComboBox is working. I using Python 3.9.13 and PyCharm Community Edition.

QComboBox {
    border: 2px solid #0d7377;
    border-radius: 20;
    padding: 10px;
    color: #eeeeee;
}
QComboBox::drop-down {
    border: 0px;
}
QComboBox::down-arrow {
    image: url(:/iconic/arrow.png);
    width: 14px;
    height: 14px;
    margin-right: 15px;
}
QComboBox QAbstractItemView {
    selection-background-color: #1a1a1a;
    selection-color: #eeeeee;
}
QComboBox QListView {
    border: 2px solid #0d7377;
    border-radius: 15;
    padding: 10px;
    color: #0d7377;
    outline: 0px;
}

in Qt Designer

after convert ui to py

styleSheet in PyCharm

I only tried delete one at a time line in styleSheets QComboBox QListView and QComboBox QAbstractItemView in PyCharm to understand which line gives the error, but it did not give results.


Solution

  • Any font change in Combobox using the properties editor breaking normal its operation. Change the font in the style sheet

    QComboBox {
        font: bold 12pt "Microsoft YaHei";
        border: 2px solid #0d7377;
        border-radius: 20;
        padding: 10px;
        color: #eeeeee;
    }