Some debugging for gridUnit

This commit is contained in:
Sebastian Kügler 2014-01-21 17:55:47 +01:00
parent caa975c7bb
commit 13a6a38628
2 changed files with 8 additions and 0 deletions

View File

@ -51,6 +51,7 @@ Item {
text: "DPI"
onClicked: {
print("DPI Button onClicked");
print(units.gridUnit);
var d = theme.dpi(dpilabel);
dpilabel.text = "DPI: " + d
}

View File

@ -41,6 +41,10 @@ Units::~Units()
qreal Units::gridUnit() const
{
const int gridUnit = QFontMetrics(QApplication::font()).boundingRect("M").width();
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();
return m_gridUnit;
}
@ -65,6 +69,9 @@ qreal Units::gu(qreal value) const
void Units::themeChanged()
{
const int gridUnit = QFontMetrics(QApplication::font()).boundingRect("M").width();
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();
if (gridUnit != m_gridUnit) {
m_gridUnit = gridUnit;
emit gridUnitChanged();