Use msize.height, not width for gridUnit

This change does two things:

- it increases the gridUnit to 11 pixel on 102DPI, 18 on 170DPI. This
  means on the one hand larger sizing, but aligns gridUnit and
  theme.largeSpacing consistently, and thus makes these types work
  together better.
- it scales the gridUnit with the DPI. The width of the font's bounding
  box doesn't change on the displays I've tried, the height does.
  As a result, gridUnit now scales linearly with the DPI setting.
This commit is contained in:
Sebastian Kügler 2014-01-21 23:47:32 +01:00
parent 095469729a
commit c84e549715

View File

@ -68,7 +68,7 @@ qreal Units::gu(qreal value) const
void Units::themeChanged()
{
const int gridUnit = QFontMetrics(QApplication::font()).boundingRect("M").width();
const int gridUnit = QFontMetrics(QApplication::font()).boundingRect("M").height();
qDebug() << "FontMetrics: " << QApplication::font().pixelSize() << QFontMetrics(QApplication::font()).boundingRect("M");
qDebug() << " MRect" << QFontMetrics(QApplication::font()).boundingRect("M").size();
qDebug() << " like spacing" << QFontMetrics(QApplication::font()).boundingRect("M").size().height();