Fix icon button painting for different sizes
This commit is contained in:
parent
067cf211b3
commit
fc6f67dac0
|
@ -204,5 +204,9 @@ void QtMaterialIconButton::paintEvent(QPaintEvent *event)
|
||||||
QPainter icon(&pixmap);
|
QPainter icon(&pixmap);
|
||||||
icon.setCompositionMode(QPainter::CompositionMode_SourceIn);
|
icon.setCompositionMode(QPainter::CompositionMode_SourceIn);
|
||||||
icon.fillRect(pixmap.rect(), isEnabled() ? color() : disabledColor());
|
icon.fillRect(pixmap.rect(), isEnabled() ? color() : disabledColor());
|
||||||
painter.drawPixmap(0, 0, pixmap);
|
|
||||||
|
QRect r(rect());
|
||||||
|
const qreal w = pixmap.width();
|
||||||
|
const qreal h = pixmap.height();
|
||||||
|
painter.drawPixmap(QRect((r.width()-w)/2, (r.height()-h)/2, w, h), pixmap);
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@ AppBarSettingsEditor::AppBarSettingsEditor(QWidget *parent)
|
||||||
m_appBar->appBarLayout()->addWidget(button);
|
m_appBar->appBarLayout()->addWidget(button);
|
||||||
m_appBar->appBarLayout()->addStretch(1);
|
m_appBar->appBarLayout()->addStretch(1);
|
||||||
button->setColor(Qt::white);
|
button->setColor(Qt::white);
|
||||||
|
button->setFixedWidth(42);
|
||||||
|
|
||||||
QVBoxLayout *layout = new QVBoxLayout;
|
QVBoxLayout *layout = new QVBoxLayout;
|
||||||
setLayout(layout);
|
setLayout(layout);
|
||||||
|
|
Loading…
Reference in New Issue