Qt QComboBox下拉框文字重叠解决方法

如果QComboBox下拉框文字重叠,在设置好样式之后,在后面加 setView(new QListView())即可;

 m_comboRate = new QComboBox();
    m_comboRate->setFixedSize(700,74);
    m_comboRate->setStyleSheet(QString("QComboBox{border: 1px solid #949494;border-radius:5px;"
                             "font-family:MicrosoftYaHei;font-size:30px;color:#333333;}"
                              "QComboBox QAbstractItemView{border: 0px;outline:0px;"
                              "selection-background-color: #26409b;height:100px;font:30px;}"
                             "QComboBox::drop-down {width: 60px;border-left-width: 0px;"
                              "border-left-color: gray;border-left-style: solid;"
                             "image: url(%1);}"
                           "QComboBox::down-arrow:hover{image:url(%2);}").arg(SKINPATH+"/pull.png").arg(
                                 SKINPATH+"/pull_checked.png"));
    m_comboRate->setView(new QListView());

猜你喜欢

转载自www.cnblogs.com/nanqiang/p/10559736.html