aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/controls/controls.pri2
-rw-r--r--src/controls/qquickcontrol.cpp112
-rw-r--r--src/controls/qquickcontrol_p.h8
-rw-r--r--src/controls/qquickcontrol_p_p.h11
-rw-r--r--src/controls/qquicktextarea.cpp61
-rw-r--r--src/controls/qquicktextarea_p.h5
-rw-r--r--src/controls/qquicktextarea_p_p.h85
-rw-r--r--src/controls/qquicktextfield.cpp63
-rw-r--r--src/controls/qquicktextfield_p.h5
-rw-r--r--src/controls/qquicktextfield_p_p.h88
-rw-r--r--tests/auto/controls/data/tst_control.qml250
11 files changed, 655 insertions, 35 deletions
diff --git a/src/controls/controls.pri b/src/controls/controls.pri
index af65c841..e7e8f65d 100644
--- a/src/controls/controls.pri
+++ b/src/controls/controls.pri
@@ -31,7 +31,9 @@ HEADERS += \
$$PWD/qquicktabbar_p.h \
$$PWD/qquicktabbutton_p.h \
$$PWD/qquicktextarea_p.h \
+ $$PWD/qquicktextarea_p_p.h \
$$PWD/qquicktextfield_p.h \
+ $$PWD/qquicktextfield_p_p.h \
$$PWD/qquicktogglebutton_p.h \
$$PWD/qquicktoolbar_p.h \
$$PWD/qquicktoolbutton_p.h
diff --git a/src/controls/qquickcontrol.cpp b/src/controls/qquickcontrol.cpp
index 1b41c352..e91149e3 100644
--- a/src/controls/qquickcontrol.cpp
+++ b/src/controls/qquickcontrol.cpp
@@ -37,6 +37,12 @@
#include "qquickcontrol_p.h"
#include "qquickcontrol_p_p.h"
+#include <QtGui/qguiapplication.h>
+#include "qquicktextarea_p.h"
+#include "qquicktextarea_p_p.h"
+#include "qquicktextfield_p.h"
+#include "qquicktextfield_p_p.h"
+
QT_BEGIN_NAMESPACE
/*!
@@ -143,6 +149,78 @@ void QQuickControlPrivate::resizeContent()
}
}
+/*!
+ \internal
+
+ Returns the font that the control w inherits from its ancestors and
+ QGuiApplication::font.
+*/
+QFont QQuickControlPrivate::naturalControlFont(const QQuickItem *q)
+{
+ QFont naturalFont = QGuiApplication::font();
+ QQuickItem *p = q->parentItem();
+ while (p) {
+ if (QQuickControl *qc = qobject_cast<QQuickControl *>(p)) {
+ naturalFont = qc->font();
+ break;
+ }
+
+ p = p->parentItem();
+ }
+
+ naturalFont.resolve(0);
+ return naturalFont;
+}
+
+/*!
+ \internal
+
+ Determine which font is implicitly imposed on this control by its ancestors
+ and QGuiApplication::font, resolve this against its own font (attributes from
+ the implicit font are copied over). Then propagate this font to this
+ control's children.
+*/
+void QQuickControlPrivate::resolveFont()
+{
+ Q_Q(const QQuickControl);
+ QFont naturalFont = QQuickControlPrivate::naturalControlFont(q);
+ QFont resolvedFont = font.resolve(naturalFont);
+ setFont_helper(resolvedFont);
+}
+
+/*!
+ \internal
+
+ Assign \a font to this control, and propagate it to all children.
+*/
+void QQuickControlPrivate::updateFont(const QFont &f)
+{
+ Q_Q(QQuickControl);
+ font = f;
+
+ QQuickControlPrivate::updateFontRecur(q, f);
+
+ emit q->fontChanged();
+}
+
+void QQuickControlPrivate::updateFontRecur(QQuickItem *i, const QFont &f)
+{
+ foreach (QQuickItem *child, i->childItems()) {
+ if (QQuickControl *qc = qobject_cast<QQuickControl *>(child)) {
+ QQuickControlPrivate *qcp = qc->d_func();
+ qcp->resolveFont();
+ } else if (QQuickTextArea *qta = qobject_cast<QQuickTextArea *>(child)) {
+ QQuickTextAreaPrivate *qtap = QQuickTextAreaPrivate::get(qta);
+ qtap->resolveFont();
+ } else if (QQuickTextField *qtf = qobject_cast<QQuickTextField *>(child)) {
+ QQuickTextFieldPrivate *qtfp = QQuickTextFieldPrivate::get(qtf);
+ qtfp->resolveFont();
+ } else {
+ QQuickControlPrivate::updateFontRecur(child, f);
+ }
+ }
+}
+
QQuickControl::QQuickControl(QQuickItem *parent) :
QQuickItem(*(new QQuickControlPrivate), parent)
{
@@ -153,6 +231,40 @@ QQuickControl::QQuickControl(QQuickControlPrivate &dd, QQuickItem *parent) :
{
}
+void QQuickControl::itemChange(QQuickItem::ItemChange change, const QQuickItem::ItemChangeData &value)
+{
+ Q_D(QQuickControl);
+ QQuickItem::itemChange(change, value);
+ if (change == ItemParentHasChanged)
+ d->resolveFont();
+}
+
+QFont QQuickControl::font() const
+{
+ Q_D(const QQuickControl);
+ return d->font;
+}
+
+void QQuickControl::setFont(const QFont &f)
+{
+ Q_D(QQuickControl);
+ if (d->font == f)
+ return;
+
+ // Determine which font is inherited from this control's ancestors and
+ // QGuiApplication::font, resolve this against \a font (attributes from the
+ // inherited font are copied over). Then propagate this font to this
+ // control's children.
+ QFont naturalFont = QQuickControlPrivate::naturalControlFont(this);
+ QFont resolvedFont = f.resolve(naturalFont);
+ d->setFont_helper(resolvedFont);
+}
+
+void QQuickControl::resetFont()
+{
+ setFont(QFont());
+}
+
/*!
\qmlproperty real QtQuickControls2::Control::availableWidth
diff --git a/src/controls/qquickcontrol_p.h b/src/controls/qquickcontrol_p.h
index 9da4235e..9b2ede50 100644
--- a/src/controls/qquickcontrol_p.h
+++ b/src/controls/qquickcontrol_p.h
@@ -58,6 +58,7 @@ class QQuickControlPrivate;
class Q_QUICKCONTROLS_EXPORT QQuickControl : public QQuickItem
{
Q_OBJECT
+ Q_PROPERTY(QFont font READ font WRITE setFont RESET resetFont NOTIFY fontChanged)
Q_PROPERTY(qreal availableWidth READ availableWidth NOTIFY availableWidthChanged FINAL)
Q_PROPERTY(qreal availableHeight READ availableHeight NOTIFY availableHeightChanged FINAL)
Q_PROPERTY(qreal padding READ padding WRITE setPadding RESET resetPadding NOTIFY paddingChanged FINAL)
@@ -75,6 +76,10 @@ class Q_QUICKCONTROLS_EXPORT QQuickControl : public QQuickItem
public:
explicit QQuickControl(QQuickItem *parent = Q_NULLPTR);
+ QFont font() const;
+ void setFont(const QFont &);
+ void resetFont();
+
qreal availableWidth() const;
qreal availableHeight() const;
@@ -115,6 +120,7 @@ public:
void setContentItem(QQuickItem *item);
Q_SIGNALS:
+ void fontChanged();
void availableWidthChanged();
void availableHeightChanged();
void paddingChanged();
@@ -132,6 +138,8 @@ Q_SIGNALS:
protected:
QQuickControl(QQuickControlPrivate &dd, QQuickItem *parent);
+ void itemChange(ItemChange change, const ItemChangeData &value) Q_DECL_OVERRIDE;
+
void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
diff --git a/src/controls/qquickcontrol_p_p.h b/src/controls/qquickcontrol_p_p.h
index 273ca6c9..2861c067 100644
--- a/src/controls/qquickcontrol_p_p.h
+++ b/src/controls/qquickcontrol_p_p.h
@@ -69,6 +69,17 @@ public:
void resizeBackground();
void resizeContent();
+ void updateFont(const QFont &);
+ static void updateFontRecur(QQuickItem *item, const QFont &);
+ inline void setFont_helper(const QFont &f) {
+ if (font.resolve() == f.resolve() && font == f)
+ return;
+ updateFont(f);
+ }
+ void resolveFont();
+ static QFont naturalControlFont(const QQuickItem *);
+
+ QFont font;
bool hasTopPadding;
bool hasLeftPadding;
bool hasRightPadding;
diff --git a/src/controls/qquicktextarea.cpp b/src/controls/qquicktextarea.cpp
index a670f893..b9e4e4f8 100644
--- a/src/controls/qquicktextarea.cpp
+++ b/src/controls/qquicktextarea.cpp
@@ -35,12 +35,14 @@
****************************************************************************/
#include "qquicktextarea_p.h"
-#include "qquickpressandholdhelper_p.h"
+#include "qquicktextarea_p_p.h"
+#include "qquickcontrol_p.h"
+#include "qquickcontrol_p_p.h"
+#include <QtGui/qguiapplication.h>
#include <QtQuick/private/qquickitem_p.h>
#include <QtQuick/private/qquicktext_p.h>
#include <QtQuick/private/qquickclipnode_p.h>
-#include <QtQuick/private/qquicktextedit_p_p.h>
QT_BEGIN_NAMESPACE
@@ -64,20 +66,6 @@ QT_BEGIN_NAMESPACE
\sa TextField, {Customizing TextArea}
*/
-class QQuickTextAreaPrivate : public QQuickTextEditPrivate
-{
- Q_DECLARE_PUBLIC(QQuickTextArea)
-
-public:
- QQuickTextAreaPrivate() : background(Q_NULLPTR), placeholder(Q_NULLPTR) { }
-
- void resizeBackground();
-
- QQuickItem *background;
- QQuickText *placeholder;
- QQuickPressAndHoldHelper pressAndHoldHelper;
-};
-
void QQuickTextAreaPrivate::resizeBackground()
{
Q_Q(QQuickTextArea);
@@ -106,6 +94,47 @@ QQuickTextArea::~QQuickTextArea()
}
/*!
+ \internal
+
+ Determine which font is implicitly imposed on this control by its ancestors
+ and QGuiApplication::font, resolve this against its own font (attributes from
+ the implicit font are copied over). Then propagate this font to this
+ control's children.
+*/
+void QQuickTextAreaPrivate::resolveFont()
+{
+ Q_Q(const QQuickTextArea);
+ QFont naturalFont = QQuickControlPrivate::naturalControlFont(q);
+ QFont resolvedFont = sourceFont.resolve(naturalFont);
+ setFont_helper(resolvedFont);
+}
+
+QFont QQuickTextArea::font() const
+{
+ Q_D(const QQuickTextArea);
+ return d->sourceFont;
+}
+
+void QQuickTextArea::setFont(const QFont &font)
+{
+ Q_D(QQuickTextArea);
+ if (d->sourceFont == font)
+ return;
+
+ // Determine which font is inherited from this control's ancestors and
+ // QGuiApplication::font, resolve this against \a font (attributes from the
+ // inherited font are copied over). Then propagate this font to this
+ // control's children.
+ QFont naturalFont = QQuickControlPrivate::naturalControlFont(this);
+ QFont resolvedFont = font.resolve(naturalFont);
+ d->setFont_helper(resolvedFont);
+
+ QQuickTextEdit::setFont(font);
+
+ emit fontChanged();
+}
+
+/*!
\qmlproperty Item QtQuickControls2::TextArea::background
This property holds the background item.
diff --git a/src/controls/qquicktextarea_p.h b/src/controls/qquicktextarea_p.h
index f952f304..239fa559 100644
--- a/src/controls/qquicktextarea_p.h
+++ b/src/controls/qquicktextarea_p.h
@@ -60,6 +60,7 @@ class QQuickMouseEvent;
class Q_QUICKCONTROLS_EXPORT QQuickTextArea : public QQuickTextEdit
{
Q_OBJECT
+ Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY fontChanged) // override
Q_PROPERTY(QQuickItem *background READ background WRITE setBackground NOTIFY backgroundChanged FINAL)
Q_PROPERTY(QQuickText *placeholder READ placeholder WRITE setPlaceholder NOTIFY placeholderChanged FINAL)
@@ -67,6 +68,9 @@ public:
explicit QQuickTextArea(QQuickItem *parent = Q_NULLPTR);
~QQuickTextArea();
+ QFont font() const;
+ void setFont(const QFont &font);
+
QQuickItem *background() const;
void setBackground(QQuickItem *background);
@@ -74,6 +78,7 @@ public:
void setPlaceholder(QQuickText *placeholder);
Q_SIGNALS:
+ void fontChanged();
void backgroundChanged();
void placeholderChanged();
void pressAndHold(QQuickMouseEvent *event);
diff --git a/src/controls/qquicktextarea_p_p.h b/src/controls/qquicktextarea_p_p.h
new file mode 100644
index 00000000..83194ef1
--- /dev/null
+++ b/src/controls/qquicktextarea_p_p.h
@@ -0,0 +1,85 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKTEXTAREA_P_P_H
+#define QQUICKTEXTAREA_P_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQuick/private/qquicktextedit_p_p.h>
+#include <QtQuickControls/private/qquickpressandholdhelper_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickTextAreaPrivate : public QQuickTextEditPrivate
+{
+ Q_DECLARE_PUBLIC(QQuickTextArea)
+
+public:
+ QQuickTextAreaPrivate() : background(Q_NULLPTR), placeholder(Q_NULLPTR) { }
+
+ static QQuickTextAreaPrivate *get(QQuickTextArea *item) {
+ return static_cast<QQuickTextAreaPrivate *>(QObjectPrivate::get(item)); }
+
+ void resizeBackground();
+
+ inline void setFont_helper(const QFont &f) {
+ // In QQuickTextEditPrivate, sourceFont was used, instead of font...
+ if (sourceFont.resolve() == f.resolve() && sourceFont == f)
+ return;
+ sourceFont = f;
+ }
+ void resolveFont();
+
+ QQuickItem *background;
+ QQuickText *placeholder;
+ QQuickPressAndHoldHelper pressAndHoldHelper;
+};
+
+Q_DECLARE_TYPEINFO(QQuickTextAreaPrivate, Q_COMPLEX_TYPE);
+
+QT_END_NAMESPACE
+
+#endif // QQUICKTEXTAREA_P_P_H
diff --git a/src/controls/qquicktextfield.cpp b/src/controls/qquicktextfield.cpp
index e8b4086c..01b26cf7 100644
--- a/src/controls/qquicktextfield.cpp
+++ b/src/controls/qquicktextfield.cpp
@@ -35,13 +35,14 @@
****************************************************************************/
#include "qquicktextfield_p.h"
-#include "qquickpressandholdhelper_p.h"
+#include "qquicktextfield_p_p.h"
+#include "qquickcontrol_p.h"
+#include "qquickcontrol_p_p.h"
#include <QtCore/qbasictimer.h>
#include <QtQuick/private/qquickitem_p.h>
#include <QtQuick/private/qquicktext_p.h>
#include <QtQuick/private/qquickclipnode_p.h>
-#include <QtQuick/private/qquicktextinput_p_p.h>
QT_BEGIN_NAMESPACE
@@ -82,23 +83,6 @@ QT_BEGIN_NAMESPACE
position of the press, and which button is pressed.
*/
-class QQuickTextFieldPrivate : public QQuickTextInputPrivate
-{
- Q_DECLARE_PUBLIC(QQuickTextField)
-
-public:
- QQuickTextFieldPrivate()
- : background(Q_NULLPTR)
- , placeholder(Q_NULLPTR)
- { }
-
- void resizeBackground();
-
- QQuickItem *background;
- QQuickText *placeholder;
- QQuickPressAndHoldHelper pressAndHoldHelper;
-};
-
void QQuickTextFieldPrivate::resizeBackground()
{
Q_Q(QQuickTextField);
@@ -127,6 +111,47 @@ QQuickTextField::~QQuickTextField()
}
/*!
+ \internal
+
+ Determine which font is implicitly imposed on this control by its ancestors
+ and QGuiApplication::font, resolve this against its own font (attributes from
+ the implicit font are copied over). Then propagate this font to this
+ control's children.
+*/
+void QQuickTextFieldPrivate::resolveFont()
+{
+ Q_Q(QQuickTextField);
+ QFont naturalFont = QQuickControlPrivate::naturalControlFont(q);
+ QFont resolvedFont = sourceFont.resolve(naturalFont);
+ setFont_helper(resolvedFont);
+}
+
+QFont QQuickTextField::font() const
+{
+ Q_D(const QQuickTextField);
+ return d->sourceFont;
+}
+
+void QQuickTextField::setFont(const QFont &font)
+{
+ Q_D(QQuickTextField);
+ if (d->sourceFont == font)
+ return;
+
+ // Determine which font is inherited from this control's ancestors and
+ // QGuiApplication::font, resolve this against \a font (attributes from the
+ // inherited font are copied over). Then propagate this font to this
+ // control's children.
+ QFont naturalFont = QQuickControlPrivate::naturalControlFont(this);
+ QFont resolvedFont = font.resolve(naturalFont);
+ d->setFont_helper(resolvedFont);
+
+ QQuickTextInput::setFont(font);
+
+ emit fontChanged();
+}
+
+/*!
\qmlproperty Item QtQuickControls2::TextField::background
This property holds the background item.
diff --git a/src/controls/qquicktextfield_p.h b/src/controls/qquicktextfield_p.h
index a3b0fa8d..6f22cdd5 100644
--- a/src/controls/qquicktextfield_p.h
+++ b/src/controls/qquicktextfield_p.h
@@ -60,6 +60,7 @@ class QQuickMouseEvent;
class Q_QUICKCONTROLS_EXPORT QQuickTextField : public QQuickTextInput
{
Q_OBJECT
+ Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY fontChanged) // override
Q_PROPERTY(QQuickItem *background READ background WRITE setBackground NOTIFY backgroundChanged FINAL)
Q_PROPERTY(QQuickText *placeholder READ placeholder WRITE setPlaceholder NOTIFY placeholderChanged FINAL)
@@ -67,6 +68,9 @@ public:
explicit QQuickTextField(QQuickItem *parent = Q_NULLPTR);
~QQuickTextField();
+ QFont font() const;
+ void setFont(const QFont &font);
+
QQuickItem *background() const;
void setBackground(QQuickItem *background);
@@ -74,6 +78,7 @@ public:
void setPlaceholder(QQuickText *placeholder);
Q_SIGNALS:
+ void fontChanged();
void backgroundChanged();
void placeholderChanged();
void pressAndHold(QQuickMouseEvent *mouse);
diff --git a/src/controls/qquicktextfield_p_p.h b/src/controls/qquicktextfield_p_p.h
new file mode 100644
index 00000000..ceefb91e
--- /dev/null
+++ b/src/controls/qquicktextfield_p_p.h
@@ -0,0 +1,88 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKTEXTFIELD_P_P_H
+#define QQUICKTEXTFIELD_P_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQuick/private/qquicktextinput_p_p.h>
+#include <QtQuickControls/private/qquickpressandholdhelper_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickTextFieldPrivate : public QQuickTextInputPrivate
+{
+ Q_DECLARE_PUBLIC(QQuickTextField)
+
+public:
+ QQuickTextFieldPrivate()
+ : background(Q_NULLPTR)
+ , placeholder(Q_NULLPTR)
+ { }
+
+ static QQuickTextFieldPrivate *get(QQuickTextField *item) {
+ return static_cast<QQuickTextFieldPrivate *>(QObjectPrivate::get(item)); }
+
+ void resizeBackground();
+
+ inline void setFont_helper(const QFont &f) {
+ // In QQuickTextInputPrivate, sourceFont was used, instead of font...
+ if (sourceFont.resolve() == f.resolve() && sourceFont == f)
+ return;
+ sourceFont = f;
+ }
+ void resolveFont();
+
+ QQuickItem *background;
+ QQuickText *placeholder;
+ QQuickPressAndHoldHelper pressAndHoldHelper;
+};
+
+Q_DECLARE_TYPEINFO(QQuickTextFieldPrivate, Q_COMPLEX_TYPE);
+
+QT_END_NAMESPACE
+
+#endif // QQUICKTEXTFIELD_P_P_H
diff --git a/tests/auto/controls/data/tst_control.qml b/tests/auto/controls/data/tst_control.qml
index d8b1e3df..003a74a7 100644
--- a/tests/auto/controls/data/tst_control.qml
+++ b/tests/auto/controls/data/tst_control.qml
@@ -264,4 +264,254 @@ TestCase {
control.destroy()
}
+
+ Component {
+ id: component2
+ Control {
+ id: item2
+ objectName: "item2"
+ property alias item2_2: _item2_2;
+ property alias item2_3: _item2_3;
+ property alias item2_4: _item2_4;
+ property alias item2_5: _item2_5;
+ font.family: "Arial"
+ Control {
+ id: _item2_2
+ objectName: "_item2_2"
+ Control {
+ id: _item2_3
+ objectName: "_item2_3"
+ }
+ }
+ TextArea {
+ id: _item2_4
+ objectName: "_item2_4"
+ text: "Text Area"
+ }
+ TextField {
+ id: _item2_5
+ objectName: "_item2_5"
+ text: "Text Field"
+ }
+ }
+ }
+
+ function test_font() {
+ var control2 = component2.createObject(testCase)
+ verify(control2)
+ verify(control2.item2_2)
+ verify(control2.item2_3)
+ verify(control2.item2_4)
+ verify(control2.item2_5)
+
+ compare(control2.font.family, "Arial")
+ compare(control2.item2_2.font.family, control2.font.family)
+ compare(control2.item2_2.font.pointSize, control2.font.pointSize)
+ compare(control2.item2_2.font.weight, control2.font.weight)
+ compare(control2.item2_3.font.family, control2.font.family)
+ compare(control2.item2_3.font.pointSize, control2.font.pointSize)
+ compare(control2.item2_3.font.weight, control2.font.weight)
+ compare(control2.item2_4.font.family, control2.font.family)
+ compare(control2.item2_4.font.pointSize, control2.font.pointSize)
+ compare(control2.item2_4.font.weight, control2.font.weight)
+ compare(control2.item2_5.font.family, control2.font.family)
+ compare(control2.item2_5.font.pointSize, control2.font.pointSize)
+ compare(control2.item2_5.font.weight, control2.font.weight)
+
+ control2.font.pointSize = 48
+ compare(control2.item2_2.font.pointSize, 48)
+ compare(control2.item2_3.font.pointSize, 48)
+ compare(control2.item2_4.font.pointSize, 48)
+ compare(control2.item2_5.font.pointSize, 48)
+
+ control2.font.bold = true
+ compare(control2.item2_2.font.weight, Font.Bold)
+ compare(control2.item2_3.font.weight, Font.Bold)
+ compare(control2.item2_4.font.weight, Font.Bold)
+ compare(control2.item2_5.font.weight, Font.Bold)
+
+ control2.item2_2.font.pointSize = 36
+ compare(control2.item2_2.font.pointSize, 36)
+ compare(control2.item2_3.font.pointSize, 36)
+
+ control2.item2_2.font.weight = Font.Light
+ compare(control2.item2_2.font.pointSize, 36)
+ compare(control2.item2_3.font.pointSize, 36)
+
+ compare(control2.item2_3.font.family, control2.item2_2.font.family)
+ compare(control2.item2_3.font.pointSize, control2.item2_2.font.pointSize)
+ compare(control2.item2_3.font.weight, control2.item2_2.font.weight)
+
+ control2.font.pointSize = 50
+ compare(control2.item2_2.font.pointSize, 36)
+ compare(control2.item2_3.font.pointSize, 36)
+ compare(control2.item2_4.font.pointSize, 50)
+ compare(control2.item2_5.font.pointSize, 50)
+
+ control2.item2_3.font.pointSize = 60
+ compare(control2.item2_3.font.pointSize, 60)
+
+ control2.item2_3.font.weight = Font.Normal
+ compare(control2.item2_3.font.weight, Font.Normal)
+
+ control2.item2_4.font.pointSize = 16
+ compare(control2.item2_4.font.pointSize, 16)
+
+ control2.item2_4.font.weight = Font.Normal
+ compare(control2.item2_4.font.weight, Font.Normal)
+
+ control2.item2_5.font.pointSize = 32
+ compare(control2.item2_5.font.pointSize, 32)
+
+ control2.item2_5.font.weight = Font.DemiBold
+ compare(control2.item2_5.font.weight, Font.DemiBold)
+
+ compare(control2.font.family, "Arial")
+ compare(control2.font.pointSize, 50)
+ compare(control2.font.weight, Font.Bold)
+
+ compare(control2.item2_2.font.family, "Arial")
+ compare(control2.item2_2.font.pointSize, 36)
+ compare(control2.item2_2.font.weight, Font.Light)
+
+ compare(control2.item2_3.font.family, "Arial")
+ compare(control2.item2_3.font.pointSize, 60)
+ compare(control2.item2_3.font.weight, Font.Normal)
+
+ compare(control2.item2_4.font.family, "Arial")
+ compare(control2.item2_4.font.pointSize, 16)
+ compare(control2.item2_4.font.weight, Font.Normal)
+
+ compare(control2.item2_5.font.family, "Arial")
+ compare(control2.item2_5.font.pointSize, 32)
+ compare(control2.item2_5.font.weight, Font.DemiBold)
+
+ control2.destroy()
+ }
+
+ Component {
+ id: component3
+ Control {
+ id: item3
+ objectName: "item3"
+ property alias item3_2: _item3_2;
+ property alias item3_3: _item3_3;
+ property alias item3_4: _item3_4;
+ property alias item3_5: _item3_5;
+ property alias item3_6: _item3_6;
+ property alias item3_7: _item3_7;
+ font.family: "Arial"
+ Item {
+ id: _item3_2
+ objectName: "_item3_2"
+ Control {
+ id: _item3_3
+ objectName: "_item3_3"
+ Item {
+ id: _item3_6
+ objectName: "_item3_6"
+ Control {
+ id: _item3_7
+ objectName: "_item3_7"
+ }
+ }
+ }
+ TextArea {
+ id: _item3_4
+ objectName: "_item3_4"
+ text: "Text Area"
+ }
+ TextField {
+ id: _item3_5
+ objectName: "_item3_5"
+ text: "Text Field"
+ }
+ }
+ }
+ }
+
+ function test_font_2() {
+ var control3 = component3.createObject(testCase)
+ verify(control3)
+ verify(control3.item3_2)
+ verify(control3.item3_3)
+ verify(control3.item3_4)
+ verify(control3.item3_5)
+
+ compare(control3.font.family, "Arial")
+ compare(control3.item3_3.font.family, control3.font.family)
+ compare(control3.item3_3.font.pointSize, control3.font.pointSize)
+ compare(control3.item3_3.font.weight, control3.font.weight)
+ compare(control3.item3_4.font.family, control3.font.family)
+ compare(control3.item3_4.font.pointSize, control3.font.pointSize)
+ compare(control3.item3_4.font.weight, control3.font.weight)
+ compare(control3.item3_5.font.family, control3.font.family)
+ compare(control3.item3_5.font.pointSize, control3.font.pointSize)
+ compare(control3.item3_5.font.weight, control3.font.weight)
+ compare(control3.item3_7.font.family, control3.font.family)
+ compare(control3.item3_7.font.pointSize, control3.font.pointSize)
+ compare(control3.item3_7.font.weight, control3.font.weight)
+
+ control3.font.pointSize = 48
+ compare(control3.item3_3.font.pointSize, 48)
+ compare(control3.item3_4.font.pointSize, 48)
+ compare(control3.item3_5.font.pointSize, 48)
+
+ control3.font.bold = true
+ compare(control3.item3_3.font.weight, Font.Bold)
+ compare(control3.item3_4.font.weight, Font.Bold)
+ compare(control3.item3_5.font.weight, Font.Bold)
+
+ compare(control3.item3_3.font.family, control3.font.family)
+ compare(control3.item3_3.font.pointSize, control3.font.pointSize)
+ compare(control3.item3_3.font.weight, control3.font.weight)
+ compare(control3.item3_7.font.family, control3.font.family)
+ compare(control3.item3_7.font.pointSize, control3.font.pointSize)
+ compare(control3.item3_7.font.weight, control3.font.weight)
+
+ control3.item3_3.font.pointSize = 60
+ compare(control3.item3_3.font.pointSize, 60)
+
+ control3.item3_3.font.weight = Font.Normal
+ compare(control3.item3_3.font.weight, Font.Normal)
+
+ control3.item3_4.font.pointSize = 16
+ compare(control3.item3_4.font.pointSize, 16)
+
+ control3.item3_4.font.weight = Font.Normal
+ compare(control3.item3_4.font.weight, Font.Normal)
+
+ control3.item3_5.font.pointSize = 32
+ compare(control3.item3_5.font.pointSize, 32)
+
+ control3.item3_5.font.weight = Font.DemiBold
+ compare(control3.item3_5.font.weight, Font.DemiBold)
+
+ control3.font.pointSize = 100
+ compare(control3.font.pointSize, 100)
+ compare(control3.item3_3.font.pointSize, 60)
+ compare(control3.item3_4.font.pointSize, 16)
+ compare(control3.item3_5.font.pointSize, 32)
+
+ compare(control3.font.family, "Arial")
+ compare(control3.font.pointSize, 100)
+ compare(control3.font.weight, Font.Bold)
+
+ compare(control3.item3_3.font.family, "Arial")
+ compare(control3.item3_3.font.pointSize, 60)
+ compare(control3.item3_3.font.weight, Font.Normal)
+ compare(control3.item3_7.font.family, control3.item3_3.font.family)
+ compare(control3.item3_7.font.pointSize, control3.item3_3.font.pointSize)
+ compare(control3.item3_7.font.weight, control3.item3_3.font.weight)
+
+ compare(control3.item3_4.font.family, "Arial")
+ compare(control3.item3_4.font.pointSize, 16)
+ compare(control3.item3_4.font.weight, Font.Normal)
+
+ compare(control3.item3_5.font.family, "Arial")
+ compare(control3.item3_5.font.pointSize, 32)
+ compare(control3.item3_5.font.weight, Font.DemiBold)
+
+ control3.destroy()
+ }
}