fixbug192192 combobox下拉框里有的有图标,有的没有图标时,文字需要跟图标对齐

This commit is contained in:
tanjing 2023-10-25 11:32:40 +08:00 committed by xibowen
parent 3777b9f9d4
commit 2e672ea3cd
1 changed files with 11 additions and 9 deletions

View File

@ -5342,15 +5342,17 @@ void Qt5UKUIStyle::drawControl(QStyle::ControlElement element, const QStyleOptio
bool hasIcon = false;
if(isComboBox)
{
auto *comboBox = qobject_cast<const QComboBox*>(widget);
int column = comboBox->count();
for(int i = 0; i < column; i++)
{
if(!comboBox->itemIcon(i).isNull()){
if(!menuItem->icon.isNull())
hasIcon = true;
break;
}
}
// auto *comboBox = qobject_cast<const QComboBox*>(widget);
// int column = comboBox->count();
// for(int i = 0; i < column; i++)
// {
// if(!comboBox->itemIcon(i).isNull()){
// hasIcon = true;
// break;
// }
// }
}
else if(menuItem->maxIconWidth != 0)
hasIcon = true;