Make sure gridUnit is always an even number

This prevents subpixel alignment when gridUnit / 2 is used, which is
quite common.
This commit is contained in:
Sebastian Kügler 2014-05-23 16:09:31 +02:00
parent 2ba1a0c90f
commit 511495caad

View File

@ -167,7 +167,10 @@ int Units::gridUnit() const
void Units::themeChanged()
{
const int gridUnit = QFontMetrics(QGuiApplication::font()).boundingRect("M").height();
int gridUnit = QFontMetrics(QGuiApplication::font()).boundingRect("M").height();
if (gridUnit % 2 != 0) {
gridUnit++;
}
if (gridUnit != m_gridUnit) {
m_gridUnit = gridUnit;
emit gridUnitChanged();