get rid of displayAspectRatio
this property is broken by design: units doesn't know anything about views, therefore it can't know what is the current screem BUG:333068
This commit is contained in:
parent
ba4e6825a4
commit
06d8fea792
@ -46,7 +46,6 @@ Units::Units (QObject *parent)
|
|||||||
{
|
{
|
||||||
m_iconSizes = new QQmlPropertyMap(this);
|
m_iconSizes = new QQmlPropertyMap(this);
|
||||||
updateDevicePixelRatio();
|
updateDevicePixelRatio();
|
||||||
updateDisplayAspectRatio();
|
|
||||||
updateSpacing();
|
updateSpacing();
|
||||||
|
|
||||||
//iconLoaderSettingsChanged();
|
//iconLoaderSettingsChanged();
|
||||||
@ -140,25 +139,11 @@ int Units::devicePixelIconSize(const int size) const
|
|||||||
// FIXME: Add special casing for < 64 cases: align to kiconloader size
|
// FIXME: Add special casing for < 64 cases: align to kiconloader size
|
||||||
}
|
}
|
||||||
|
|
||||||
qreal Units::displayAspectRatio() const
|
|
||||||
{
|
|
||||||
return m_displayAspectRatio;
|
|
||||||
}
|
|
||||||
|
|
||||||
qreal Units::devicePixelRatio() const
|
qreal Units::devicePixelRatio() const
|
||||||
{
|
{
|
||||||
return m_devicePixelRatio;
|
return m_devicePixelRatio;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Units::updateDisplayAspectRatio()
|
|
||||||
{
|
|
||||||
QRect geometry = QGuiApplication::primaryScreen()->virtualGeometry();
|
|
||||||
|
|
||||||
m_displayAspectRatio = geometry.width() / geometry.height();
|
|
||||||
|
|
||||||
emit displayAspectRatioChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Units::updateDevicePixelRatio()
|
void Units::updateDevicePixelRatio()
|
||||||
{
|
{
|
||||||
// Using QGuiApplication::devicePixelRatio() gives too coarse values,
|
// Using QGuiApplication::devicePixelRatio() gives too coarse values,
|
||||||
|
@ -83,11 +83,6 @@ class Units : public QObject
|
|||||||
*/
|
*/
|
||||||
Q_PROPERTY(qreal devicePixelRatio READ devicePixelRatio NOTIFY devicePixelRatioChanged)
|
Q_PROPERTY(qreal devicePixelRatio READ devicePixelRatio NOTIFY devicePixelRatioChanged)
|
||||||
|
|
||||||
/**
|
|
||||||
* The ratio between the screen width and height of the main screen.
|
|
||||||
*/
|
|
||||||
Q_PROPERTY(qreal displayAspectRatio READ displayAspectRatio NOTIFY displayAspectRatioChanged)
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* units.longDuration should be used for longer, screen-covering animations, for opening and
|
* units.longDuration should be used for longer, screen-covering animations, for opening and
|
||||||
* closing of dialogs and other "not too small" animations
|
* closing of dialogs and other "not too small" animations
|
||||||
@ -116,11 +111,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
qreal devicePixelRatio() const;
|
qreal devicePixelRatio() const;
|
||||||
|
|
||||||
/**
|
|
||||||
* @return The ratio between physical and device-independent pixels.
|
|
||||||
*/
|
|
||||||
qreal displayAspectRatio() const;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return map with iconsizes, indexed by name
|
* @return map with iconsizes, indexed by name
|
||||||
*/
|
*/
|
||||||
@ -152,7 +142,6 @@ public:
|
|||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void devicePixelRatioChanged();
|
void devicePixelRatioChanged();
|
||||||
void displayAspectRatioChanged();
|
|
||||||
void gridUnitChanged();
|
void gridUnitChanged();
|
||||||
void iconSizesChanged();
|
void iconSizesChanged();
|
||||||
void spacingChanged();
|
void spacingChanged();
|
||||||
@ -165,7 +154,6 @@ private Q_SLOTS:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void updateDevicePixelRatio();
|
void updateDevicePixelRatio();
|
||||||
void updateDisplayAspectRatio();
|
|
||||||
void updateSpacing();
|
void updateSpacing();
|
||||||
/**
|
/**
|
||||||
* @return The dpi-adjusted size for a given icon size
|
* @return The dpi-adjusted size for a given icon size
|
||||||
@ -176,7 +164,6 @@ private:
|
|||||||
|
|
||||||
int m_gridUnit;
|
int m_gridUnit;
|
||||||
qreal m_devicePixelRatio;
|
qreal m_devicePixelRatio;
|
||||||
qreal m_displayAspectRatio;
|
|
||||||
qreal m_dpi;
|
qreal m_dpi;
|
||||||
|
|
||||||
QQmlPropertyMap *m_iconSizes;
|
QQmlPropertyMap *m_iconSizes;
|
||||||
|
Loading…
Reference in New Issue
Block a user