respect icon size for layout:menuitem-icon

BUG:437525
pull/22/head
Michail Vourlakos 4 years ago
parent 4a7174e7c2
commit ef383e8162

@ -228,7 +228,7 @@ void drawLayoutIcon(QPainter *painter, const QStyleOption &option, const bool &i
painter->setRenderHint(QPainter::Antialiasing, true);
if (isBackgroundFile) {
int backImageMargin = qMin(target.height()/4, ICONMARGIN+1);
int backImageMargin = 1; //most icon themes provide 1-2px. padding around icons //OLD CALCS: ICONMARGIN; //qMin(target.height()/4, ICONMARGIN+1);
QRect backTarget(target.x() + backImageMargin, target.y() + backImageMargin, target.width() - 2*backImageMargin, target.height() - 2*backImageMargin);
QPixmap backImage(iconName);

@ -68,8 +68,8 @@ void LayoutsComboBox::paintEvent(QPaintEvent *event)
painter.drawComplexControl(QStyle::CC_ComboBox, opt);
// icon
QRect remained = Latte::remainedFromLayoutIcon(opt, Qt::AlignLeft, 3, 3);
Latte::drawLayoutIcon(&painter, opt, m_layoutIcon.isBackgroundFile, m_layoutIcon.name, Qt::AlignLeft, 7, 4);
QRect remained = Latte::remainedFromLayoutIcon(opt, Qt::AlignLeft, 3, 5);
Latte::drawLayoutIcon(&painter, opt, m_layoutIcon.isBackgroundFile, m_layoutIcon.name, Qt::AlignLeft, 7, 6);
opt.rect = remained;
// adjust text place, move it a bit to the left

@ -49,7 +49,7 @@ void BackgroundDelegate::paint(QPainter *painter, const QStyleOptionViewItem &op
//! background
Latte::drawBackground(painter, option);
Latte::drawLayoutIcon(painter, option, icon.isBackgroundFile, icon.name, Qt::AlignHCenter, -1, 2);
Latte::drawLayoutIcon(painter, option, icon.isBackgroundFile, icon.name, Qt::AlignHCenter, -1, 3);
}
}

@ -49,8 +49,8 @@ void LayoutCmbItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem
Latte::Data::LayoutIcon icon = index.data(Model::Layouts::BACKGROUNDUSERROLE).value<Latte::Data::LayoutIcon>();
//! icon
QRect remained = Latte::remainedFromLayoutIcon(myOptions, Qt::AlignLeft, 4, 0);
Latte::drawLayoutIcon(painter, myOptions, icon.isBackgroundFile, icon.name, Qt::AlignLeft, 5, 0); //+1px in order to take into account popup window border
QRect remained = Latte::remainedFromLayoutIcon(myOptions, Qt::AlignLeft, 4, 2);
Latte::drawLayoutIcon(painter, myOptions, icon.isBackgroundFile, icon.name, Qt::AlignLeft, 5, 2); //+1px in order to take into account popup window border
myOptions.rect = remained;
//!

@ -96,8 +96,9 @@ void LayoutMenuItemWidget::paintEvent(QPaintEvent* e)
opt.rect = remained;
//! icon
remained = Latte::remainedFromLayoutIcon(opt, Qt::AlignLeft, 1, 4); //add also spacing to push text a little to the right
Latte::drawLayoutIcon(&painter, opt, m_isBackgroundFile, m_iconName, Qt::AlignLeft, 0, 4);
int thickpadding = (opt.rect.height() - qMax(16, opt.maxIconWidth)) / 2; //old value 4
remained = Latte::remainedFromLayoutIcon(opt, Qt::AlignLeft, 1, thickpadding);
Latte::drawLayoutIcon(&painter, opt, m_isBackgroundFile, m_iconName, Qt::AlignLeft, 1, thickpadding);
opt.rect = remained;
//! text

Loading…
Cancel
Save