Use suffix option from the new KProperty instead of units; implement units…

Authored by piggz on Oct 30 2017, 6:15 PM.

Description

Use suffix option from the new KProperty instead of units; implement units locally in KReport

Summary:
+ reuse constants/macros for defaults a lot more
+ add and use more unit conversion helpers (for size and pos in particular)
+ better name some unit conversion functions
+ better code reuse for reading of typical XML elements/attributes
+ switch from using const char* to QString for attribute names because the DOM API uses QString anyway

  • this will help soon to switch from QLatin1String to QStringLiteral

+ fix changing units
+ fix page margins handling

KReportExample and Kexi works

Test Plan:
Run KReportExample and Kexi.

  • Test 1. Try to insert all report elements. Open existing reports in Kexi. Preview them. Expected: correct positions of elements in design view and preview.
  • Test 2. Change page units to all other units. Expected: correct property values and positions of elements in design view and preview -- values and suffixes (units) follow changes and effective positions/sizes are not not affected by current unit settings. Similarly, margin values update properly, custom page width/height update correctly (even if non-custom page size is in use).
  • Test 3. Change page size to custom, change page units to all other units. Expected Design view and preview should show correct size, report elements stay at their positions and have constant sizes regardless of the unit picked.

Reviewers: staniek

Reviewed By: staniek

Tags: KReport

Maniphest Tasks: T6559

Differential Revision: https://phabricator.kde.org/D5441