From df7f3141bddfd84590091612b271521a5d721a37 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Wed, 22 Oct 2014 12:43:42 +0200 Subject: Don't document Context2D's TextMetrics as its own QML type. It can't be instantiated like a QML type, so it's actually better to just document measureText() (which is the only way to construct objects of this type) as returning an object containing some metrics for the current font. This should have no effect on user code. This solves the issue of the new TextMetrics type's documentation not showing up. TextMetrics is a type that *can* be instantiated and is more feature complete. It provides a declarative API for the functions that take arguments in QFontMetrics. Change-Id: I46251e6f3aa7179ab569f5131307181f71043df4 Reviewed-by: J-P Nurmi --- src/quick/items/context2d/qquickcontext2d.cpp | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/src/quick/items/context2d/qquickcontext2d.cpp b/src/quick/items/context2d/qquickcontext2d.cpp index d9ac3abdc3..b1af6f10dd 100644 --- a/src/quick/items/context2d/qquickcontext2d.cpp +++ b/src/quick/items/context2d/qquickcontext2d.cpp @@ -2801,28 +2801,10 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_strokeText(QV4::CallContex } /*! - \qmltype TextMetrics - \inqmlmodule QtQuick - \since 5.0 - \ingroup qtquick-canvas - \brief Provides a Context2D TextMetrics interface - - The TextMetrics object can be created by QtQuick::Context2D::measureText method. - See \l{http://www.w3.org/TR/2dcontext/#textmetrics}{W3C 2d context TextMetrics} for more details. - - \sa Context2D::measureText - \sa width - */ + \qmlmethod object QtQuick::Context2D::measureText(text) -/*! - \qmlproperty int QtQuick::TextMetrics::width - Holds the advance width of the text that was passed to the QtQuick::Context2D::measureText() method. - This property is read only. - */ - -/*! - \qmlmethod variant QtQuick::Context2D::measureText(text) - Returns a TextMetrics object with the metrics of the given text in the current font. + Returns an object with a \c width property, whose value is equivalent to + calling \l {QFontMetrics::width()} with the given \a text in the current font. */ QV4::ReturnedValue QQuickJSContext2DPrototype::method_measureText(QV4::CallContext *ctx) { -- cgit v1.2.3