如果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());
1、設置樣式: 邊框色、選項高度、下拉按鈕圖標
network_type->setStyleSheet("QComboBox{border:1px solid gray;}" "QComboBox QAbstractItemView::item{height:20px;}" //下拉選項高度 "QComboBox::down-arrow{image:url(:/icon/arrowdown);}" //下拉箭頭 "QComboBox::drop-down{border:0px;}"); //下拉按鈕 network_type->setView(new QListView());