From 94669499fd943fc72095afd739a21cd8e675f14f Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Tue, 5 Aug 2014 17:42:54 +0200 Subject: Add declarative QQuickTextMetrics API from QQuickFontMetrics invokables This allows use of a declarative API for the functions in QFontMetricsF which take parameters. This solves the problem of QML expressions that use QML methods not being re-evaluated when the internal data changes, by allowing the user to set the arguments as properties of a TextMetrics object, that would otherwise have to be passed to QML methods. For example: FontMetrics { id: fontMetrics } property rect r: fontMetrics.boundingRect("Blah") At some point, the font of the FontMetrics object is changed, but r will still represent the original bounding rect. Instead, the user will now write: TextMetrics { id: textMetrics text: "Blah" } property rect r: textMetrics.boundingRect The QML methods remain in QQuickFontMetrics for those who need an imperative API. [ChangeLog][QtQuick] Added QQuickTextMetrics, which provides a declarative API for the functions in QFontMetricsF which take arguments. Change-Id: I019dc4639531906fc751ba61281cc1c695742287 Reviewed-by: J-P Nurmi --- src/quick/util/util.pri | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/quick/util/util.pri') diff --git a/src/quick/util/util.pri b/src/quick/util/util.pri index 35553070dc..76cf1996bc 100644 --- a/src/quick/util/util.pri +++ b/src/quick/util/util.pri @@ -27,7 +27,8 @@ SOURCES += \ $$PWD/qquickanimatorjob.cpp \ $$PWD/qquickanimatorcontroller.cpp \ $$PWD/qquickprofiler.cpp \ - $$PWD/qquickfontmetrics.cpp + $$PWD/qquickfontmetrics.cpp \ + $$PWD/qquicktextmetrics.cpp HEADERS += \ $$PWD/qquickapplication_p.h\ @@ -62,4 +63,5 @@ HEADERS += \ $$PWD/qquickanimatorjob_p.h \ $$PWD/qquickanimatorcontroller_p.h \ $$PWD/qquickprofiler_p.h \ - $$PWD/qquickfontmetrics_p.h + $$PWD/qquickfontmetrics_p.h \ + $$PWD/qquicktextmetrics_p.h -- cgit v1.2.3