units.dp and units.du be gone
- They're not used - They're conceptually broken and arbitrary to our scaling concepts - The implementation as Q_INVOKABLE isn't very useful
This commit is contained in:
parent
c8ba9746f2
commit
b1bc20259a
@ -136,20 +136,6 @@ int Units::gridUnit() const
|
|||||||
return m_gridUnit;
|
return m_gridUnit;
|
||||||
}
|
}
|
||||||
|
|
||||||
qreal Units::dp(qreal value) const
|
|
||||||
{
|
|
||||||
if (value <= 2.0) {
|
|
||||||
return qRound(value * floor(m_devicePixelRatio));
|
|
||||||
} else {
|
|
||||||
return qRound(value * m_devicePixelRatio);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
qreal Units::gu(qreal value) const
|
|
||||||
{
|
|
||||||
return qRound(m_gridUnit * value);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Units::themeChanged()
|
void Units::themeChanged()
|
||||||
{
|
{
|
||||||
const int gridUnit = QFontMetrics(QApplication::font()).boundingRect("M").height();
|
const int gridUnit = QFontMetrics(QApplication::font()).boundingRect("M").height();
|
||||||
|
@ -94,16 +94,6 @@ public:
|
|||||||
int smallSpacing() const;
|
int smallSpacing() const;
|
||||||
int largeSpacing() const;
|
int largeSpacing() const;
|
||||||
|
|
||||||
/**
|
|
||||||
* @returns the number of pixels value density independent pixels correspond to.
|
|
||||||
*/
|
|
||||||
Q_INVOKABLE qreal dp(qreal value) const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @returns the number of pixels value grid units correspond to.
|
|
||||||
*/
|
|
||||||
Q_INVOKABLE qreal gu(qreal value) const;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @returns the dpi value for the item's screen
|
* @returns the dpi value for the item's screen
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user