some changes from the upstream wip-branch

- remove the singleton usage, this will need a bit more magic in the
  background. Not a huge problem since we're only using one instance
  anyway, and the object itself is rather light
- hardcode gridUnit for now. I'd like to use TextMetrics or FontMetrics
  there directly, but I'm not sure we can depend on Qt 5.4 and QtQuick
  2.5.

Signed-off-by: Sebastian Kügler <sebas@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Sebastian Kügler 2015-11-06 21:50:52 +00:00 committed by Dirk Hohndel
parent c8227e200d
commit 5fb054a17c
3 changed files with 12 additions and 11 deletions

View file

@ -12,6 +12,7 @@
</qresource> </qresource>
<qresource prefix="/qml/theme"> <qresource prefix="/qml/theme">
<file alias="Theme.qml">theme/Theme.qml</file> <file alias="Theme.qml">theme/Theme.qml</file>
<file alias="qmldir">theme/qmldir</file>
<file alias="Units.qml" >theme/Units.qml</file> <file alias="Units.qml" >theme/Units.qml</file>
</qresource> </qresource>
</RCC> </RCC>

View file

@ -19,7 +19,7 @@
import QtQuick 2.0 import QtQuick 2.0
pragma Singleton //pragma Singleton
/*! /*!
\qmltype Theme \qmltype Theme
@ -30,7 +30,7 @@ pragma Singleton
See \l {http://www.google.com/design/spec/style/color.html#color-ui-color-application} for See \l {http://www.google.com/design/spec/style/color.html#color-ui-color-application} for
details about choosing a color scheme for your application. details about choosing a color scheme for your application.
*/ */
Object { QtObject {
id: theme id: theme
property color textColor: Qt.rgba(0,0,0, 0.54) property color textColor: Qt.rgba(0,0,0, 0.54)

View file

@ -17,13 +17,13 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
import QtQuick 2.0 import QtQuick 2.5
import QtQuick.Window 2.2 import QtQuick.Window 2.2
pragma Singleton //pragma Singleton
Object { QtObject {
id: units id: units
/** /**
@ -31,7 +31,7 @@ Object {
* Given the screen has an accurate DPI settings, it corresponds to a width of * Given the screen has an accurate DPI settings, it corresponds to a width of
* the capital letter M * the capital letter M
*/ */
property int gridUnit: textSpacer.height property int gridUnit: 20
/** /**
* units.iconSizes provides access to platform-dependent icon sizing * units.iconSizes provides access to platform-dependent icon sizing
@ -50,7 +50,7 @@ Object {
* Not devicePixelRation-adjusted:: * Not devicePixelRation-adjusted::
* * desktop * * desktop
*/ */
property QtObject iconSizes: Object { property QtObject iconSizes: QtObject {
property int small: 16 * devicePixelRatio property int small: 16 * devicePixelRatio
property int smallMedium: 22 * devicePixelRatio property int smallMedium: 22 * devicePixelRatio
property int medium: 32 * devicePixelRatio property int medium: 32 * devicePixelRatio
@ -95,8 +95,8 @@ Object {
*/ */
property int shortDuration: 150 property int shortDuration: 150
Text { // property QtObject fontMetrics: FontMetrics {
id: textSpacer // //id: textSpacer
text: "M" // //text: "M"
} // }
} }