Merge lp://qastaging/~ubuntu-sdk-team/ubuntu-ui-toolkit/dpr into lp://qastaging/ubuntu-ui-toolkit

Proposed by Gerry Boland
Status: Superseded
Proposed branch: lp://qastaging/~ubuntu-sdk-team/ubuntu-ui-toolkit/dpr
Merge into: lp://qastaging/ubuntu-ui-toolkit
Prerequisite: lp://qastaging/ubuntu-ui-toolkit/staging
Diff against target: 245 lines (+61/-29)
5 files modified
modules/Ubuntu/Components/plugin/ucqquickimageextension.cpp (+10/-3)
modules/Ubuntu/Components/plugin/ucubuntushape.cpp (+8/-10)
modules/Ubuntu/Components/plugin/ucunits.cpp (+37/-12)
modules/Ubuntu/Components/plugin/ucunits.h (+5/-3)
ubuntu-sdk.pro (+1/-1)
To merge this branch: bzr merge lp://qastaging/~ubuntu-sdk-team/ubuntu-ui-toolkit/dpr
Reviewer Review Type Date Requested Status
Ubuntu SDK team Pending
Review via email: mp+256469@code.qastaging.launchpad.net

This proposal has been superseded by a proposal from 2015-04-16.

Description of the change

[RFC] Compensate for Qt's device pixel ratio multiplier

The UITK has flexible UI scaling support through the use of Grid Units, where one can set a grid unit to be an integer number of pixels, and the whole UI adopts to suit this. GRID_UNIT_PX=10 is the way to set this.

Qt however has its own scaling solution: QScreen::devicePixelRatio->qreal which is a multiplier applied internally to all sizing/positioning calculations. Only integer values are well supported, so 1,2,3... are the options, resulting in a x2, x3 scaling of the entire UI. For linux and X11, devicePixelRatio is specified with QT_DEVICE_PIXEL_RATIO=2. In this case, if a QML item is set to have height 100, it will be drawn 200 pixels high (but QML has no idea of this, it is still 100 in height)

This latter solution works for all Qt apps, whereas Grid units only apply to UITK-based apps. For a HighDPI desktop, we want to use both solutions.

However these two scaling solutions are cumulative. Should one set
QT_DEVICE_PIXEL_RATIO=2 GRID_UNIT_PX=10
then a box of height units.gu(1) will be drawn 20 physical pixels high.

The intention of this MR is to guarantee that GRID_UNIT_PX corresponds to physical pixels, no matter what QScreen::devicePixelRatio returns. To do this, it divides units.{gu,dp} by devicePixelRatio, so that when Qt multiplies it by devicePixelRatio again on draw, the desired physical pixel size is obtained.

To test, open the gallery with these 2 different envs:
QT_DEVICE_PIXEL_RATIO=1 GRID_UNIT_PX=10
QT_DEVICE_PIXEL_RATIO=2 GRID_UNIT_PX=10

Some visual inconsistencies are exact font rendering sizes and some rounding issues causing off-by-one positioning errors.

To post a comment you must log in.
1172. By Gerry Boland

Cleanup debug output and re-enable tests

1173. By Gerry Boland

Remove translation changes in trunk to clean up diff with staging

1174. By Gerry Boland

UbuntuShape fixes for low GU values

1175. By Gerry Boland

More correct fix for UbuntuShape at different DPR, edges should render nicely now

1176. By Gerry Boland

Add tests to ensure units.gu and units.dp are being calculated correctly

1177. By Gerry Boland

No need to pass svg to scaling image provider for non-unit DPR. Expand on a comment explaining an odd line

1178. By Gerry Boland

Merge current staging branch

1179. By Gerry Boland

Revert 1173

1180. By Gerry Boland

Fix bad math

1181. By Gerry Boland

Merge staging

1182. By Gerry Boland

Update Ubuntu shape overlay for device pixel ratio too

1183. By Gerry Boland

In UbuntuShape, refactor DPR calculations to have radius in device pixels, simplifies updateGeometry

1184. By Gerry Boland

UCUnits - deconstify value params

1185. By Gerry Boland

Read device pixel ratio from QGuiApplication, instead of reading the env var

1186. By Gerry Boland

Rely on DPR from qGuiApp, do not read env var in UCUnits directly. Requires refactoring tests into separate binaries to be able to set that env var

1187. By Gerry Boland

Fix bug in SCI file rewriter for DPR>1

1188. By Gerry Boland

Merge trunk

1189. By Gerry Boland

Unnecessary copy of dpr value removed

1190. By Gerry Boland

[tests] added a custom minimal QPA plugin which includes device pixel support, to enable testing of dpr stuff

1191. By Gerry Boland

Merge trunk

1192. By Gerry Boland

Using custom QPA plugin, now have device pixel ratio unit tests passing

1193. By Gerry Boland

Add explanation text about DPR and GU

1194. By Gerry Boland

Consolidate the vocabulary a bit

1195. By Gerry Boland

Add missing build dependencies

1196. By Gerry Boland

Bump version

1197. By Gerry Boland

Merge staging and fix conflicts

1198. By Gerry Boland

Revert rev 1196

1199. By Gerry Boland

Merge staging, fix a conflict

1200. By Gerry Boland

Undo changes to paths for gallery launcher

1201. By Gerry Boland

Merge staging

1202. By Gerry Boland

Fix build fail - variable inited twice

1203. By Gerry Boland

Merge staging again

1204. By Gerry Boland

Merge staging again

1205. By Gerry Boland

Revert accidental changes to examples/ubuntu-ui-toolkit-gallery/po/nl.po

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches

to status/vote changes: