Merge lp:~zsombi/ubuntu-ui-toolkit/screenDprChange into lp:ubuntu-ui-toolkit/staging

Proposed by Zsombor Egri
Status: Rejected
Rejected by: Zsombor Egri
Proposed branch: lp:~zsombi/ubuntu-ui-toolkit/screenDprChange
Merge into: lp:ubuntu-ui-toolkit/staging
Diff against target: 42 lines (+11/-0)
2 files modified
src/Ubuntu/Components/plugin/ucunits.cpp (+9/-0)
src/Ubuntu/Components/plugin/ucunits.h (+2/-0)
To merge this branch: bzr merge lp:~zsombi/ubuntu-ui-toolkit/screenDprChange
Reviewer Review Type Date Requested Status
Cris Dywan Needs Information
PS Jenkins bot continuous-integration Approve
Review via email: mp+269182@code.launchpad.net

Commit message

Temporary solution: react on screen changes when external display is connected.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Cris Dywan (kalikiana) wrote :

Is this a solution for bug 1510968?

What about test cases? If not automatic, is there a manual test?

review: Needs Information
Revision history for this message
Zsombor Egri (zsombi) wrote :

> Is this a solution for bug 1510968?
>
> What about test cases? If not automatic, is there a manual test?

This was used in the Convergence sprint in London (around September) and we agreed t is not a good practice. I forgot to delete it...

Unmerged revisions

1620. By Zsombor Egri

debug include removed

1619. By Zsombor Egri

react on screen change when external display is connected

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/Ubuntu/Components/plugin/ucunits.cpp'
2--- src/Ubuntu/Components/plugin/ucunits.cpp 2015-07-10 14:58:54 +0000
3+++ src/Ubuntu/Components/plugin/ucunits.cpp 2015-08-26 09:46:49 +0000
4@@ -103,9 +103,18 @@
5 m_gridUnit = getenvFloat(ENV_GRID_UNIT_PX, DEFAULT_GRID_UNIT_PX);
6 } else {
7 m_gridUnit = DEFAULT_GRID_UNIT_PX * m_devicePixelRatio;
8+ connect(qGuiApp, &QGuiApplication::screenAdded, this, &UCUnits::updateDprOnScreenChange);
9 }
10 }
11
12+void UCUnits::updateDprOnScreenChange(QScreen *screen)
13+{
14+ Q_UNUSED(screen);
15+ m_devicePixelRatio = qGuiApp->devicePixelRatio();
16+ m_gridUnit = DEFAULT_GRID_UNIT_PX * m_devicePixelRatio;
17+ Q_EMIT gridUnitChanged();
18+}
19+
20 /*!
21 \qmlproperty real Units::gridUnit
22
23
24=== modified file 'src/Ubuntu/Components/plugin/ucunits.h'
25--- src/Ubuntu/Components/plugin/ucunits.h 2015-05-22 18:51:25 +0000
26+++ src/Ubuntu/Components/plugin/ucunits.h 2015-08-26 09:46:49 +0000
27@@ -23,6 +23,7 @@
28 #include <QtCore/QHash>
29 #include <QtCore/QUrl>
30
31+class QScreen;
32 class UCUnits : public QObject
33 {
34 Q_OBJECT
35@@ -51,6 +52,7 @@
36 protected:
37 QString suffixForGridUnit(float gridUnit);
38 float gridUnitSuffixFromFileName(const QString &fileName);
39+ Q_SLOT void updateDprOnScreenChange(QScreen *screen);
40
41 private:
42 float m_devicePixelRatio;

Subscribers

People subscribed via source and target branches