1/****************************************************************************
2**
3** Copyright (C) 2016 The Qt Company Ltd.
4** Contact: https://www.qt.io/licensing/
5**
6** This file is part of the QtQuick module of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and The Qt Company. For licensing terms
14** and conditions see https://www.qt.io/terms-conditions. For further
15** information use the contact form at https://www.qt.io/contact-us.
16**
17** GNU Lesser General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 3 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPL3 included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 3 requirements
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24**
25** GNU General Public License Usage
26** Alternatively, this file may be used under the terms of the GNU
27** General Public License version 2.0 or (at your option) the GNU General
28** Public license version 3 or any later version approved by the KDE Free
29** Qt Foundation. The licenses are as published by the Free Software
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31** included in the packaging of this file. Please review the following
32** information to ensure the GNU General Public License requirements will
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34** https://www.gnu.org/licenses/gpl-3.0.html.
35**
36** $QT_END_LICENSE$
37**
38****************************************************************************/
39
40#include "qquickutilmodule_p.h"
41#include "qquickanimation_p.h"
42#include "qquickanimation_p_p.h"
43#include "qquickbehavior_p.h"
44#include "qquicksmoothedanimation_p.h"
45#include "qquickfontloader_p.h"
46#include "qquickfontmetrics_p.h"
47#include "qquickpropertychanges_p.h"
48#include "qquickspringanimation_p.h"
49#include "qquickstategroup_p.h"
50#include "qquickstatechangescript_p.h"
51#include "qquickstate_p.h"
52#include "qquickstate_p_p.h"
53#include "qquicksystempalette_p.h"
54#include "qquicktextmetrics_p.h"
55#include "qquicktransition_p.h"
56#include "qquickanimator_p.h"
57#if QT_CONFIG(shortcut)
58#include "qquickshortcut_p.h"
59#endif
60#include "qquickvalidator_p.h"
61#include <qqmlinfo.h>
62#include <private/qqmltypenotavailable_p.h>
63#include <private/qquickanimationcontroller_p.h>
64#include <QtCore/qcoreapplication.h>
65#include <QtGui/QInputMethod>
66#include <QtGui/QKeySequence>
67
68#if QT_CONFIG(shortcut)
69Q_DECLARE_METATYPE(QKeySequence::StandardKey)
70#endif
71
72void QQuickUtilModule::defineModule()
73{
74#if QT_CONFIG(im)
75 qmlRegisterUncreatableType<QInputMethod>("QtQuick",2,0,"InputMethod",
76 QInputMethod::tr("InputMethod is an abstract class"));
77#endif
78 qmlRegisterUncreatableType<QQuickAbstractAnimation>("QtQuick",2,0,"Animation",QQuickAbstractAnimation::tr("Animation is an abstract class"));
79
80 qmlRegisterType<QQuickBehavior>("QtQuick",2,0,"Behavior");
81 qmlRegisterType<QQuickColorAnimation>("QtQuick",2,0,"ColorAnimation");
82 qmlRegisterType<QQuickSmoothedAnimation>("QtQuick",2,0,"SmoothedAnimation");
83 qmlRegisterType<QQuickFontLoader>("QtQuick",2,0,"FontLoader");
84 qmlRegisterType<QQuickNumberAnimation>("QtQuick",2,0,"NumberAnimation");
85 qmlRegisterType<QQuickParallelAnimation>("QtQuick",2,0,"ParallelAnimation");
86 qmlRegisterType<QQuickPauseAnimation>("QtQuick",2,0,"PauseAnimation");
87 qmlRegisterType<QQuickPropertyAction>("QtQuick",2,0,"PropertyAction");
88 qmlRegisterType<QQuickPropertyAnimation>("QtQuick",2,0,"PropertyAnimation");
89 qmlRegisterType<QQuickRotationAnimation>("QtQuick",2,0,"RotationAnimation");
90 qmlRegisterType<QQuickScriptAction>("QtQuick",2,0,"ScriptAction");
91 qmlRegisterType<QQuickSequentialAnimation>("QtQuick",2,0,"SequentialAnimation");
92 qmlRegisterType<QQuickSpringAnimation>("QtQuick",2,0,"SpringAnimation");
93 qmlRegisterType<QQuickAnimationController>("QtQuick",2,0,"AnimationController");
94 qmlRegisterType<QQuickStateChangeScript>("QtQuick",2,0,"StateChangeScript");
95 qmlRegisterType<QQuickStateGroup>("QtQuick",2,0,"StateGroup");
96 qmlRegisterType<QQuickState>("QtQuick",2,0,"State");
97 qmlRegisterType<QQuickSystemPalette>("QtQuick",2,0,"SystemPalette");
98 qmlRegisterType<QQuickTransition>("QtQuick",2,0,"Transition");
99 qmlRegisterType<QQuickVector3dAnimation>("QtQuick",2,0,"Vector3dAnimation");
100
101#if QT_CONFIG(validator)
102 qmlRegisterType<QValidator>();
103 qmlRegisterType<QQuickIntValidator>("QtQuick",2,0,"IntValidator");
104 qmlRegisterType<QQuickDoubleValidator>("QtQuick",2,0,"DoubleValidator");
105 qmlRegisterType<QRegExpValidator>("QtQuick",2,0,"RegExpValidator");
106#if QT_CONFIG(regularexpression)
107 qmlRegisterType<QRegularExpressionValidator>("QtQuick", 2, 14, "RegularExpressionValidator");
108#endif
109#endif
110
111 qmlRegisterUncreatableType<QQuickAnimator>("QtQuick", 2, 2, "Animator", QQuickAbstractAnimation::tr("Animator is an abstract class"));
112 qmlRegisterType<QQuickXAnimator>("QtQuick", 2, 2, "XAnimator");
113 qmlRegisterType<QQuickYAnimator>("QtQuick", 2, 2, "YAnimator");
114 qmlRegisterType<QQuickScaleAnimator>("QtQuick", 2, 2, "ScaleAnimator");
115 qmlRegisterType<QQuickRotationAnimator>("QtQuick", 2, 2, "RotationAnimator");
116 qmlRegisterType<QQuickOpacityAnimator>("QtQuick", 2, 2, "OpacityAnimator");
117#if QT_CONFIG(quick_shadereffect) && QT_CONFIG(opengl)
118 qmlRegisterType<QQuickUniformAnimator>("QtQuick", 2, 2, "UniformAnimator");
119#endif
120 qmlRegisterType<QQuickStateOperation>();
121
122 qmlRegisterCustomType<QQuickPropertyChanges>("QtQuick",2,0,"PropertyChanges", new QQuickPropertyChangesParser);
123
124#if QT_CONFIG(shortcut)
125 qRegisterMetaType<QKeySequence::StandardKey>();
126 qmlRegisterUncreatableType<QKeySequence, 2>("QtQuick", 2, 2, "StandardKey", QStringLiteral("Cannot create an instance of StandardKey."));
127#endif
128
129 qmlRegisterType<QQuickFontMetrics>("QtQuick", 2, 4, "FontMetrics");
130 qmlRegisterType<QQuickTextMetrics>("QtQuick", 2, 4, "TextMetrics");
131
132#if QT_CONFIG(shortcut)
133 qmlRegisterType<QQuickShortcut>("QtQuick", 2, 5, "Shortcut");
134 qmlRegisterType<QQuickShortcut,1>("QtQuick", 2, 6, "Shortcut");
135
136 qmlRegisterType<QQuickShortcut,9>("QtQuick", 2, 9, "Shortcut");
137#endif
138
139 qmlRegisterUncreatableType<QQuickAbstractAnimation, 12>("QtQuick", 2, 12, "Animation",
140 QQuickAbstractAnimation::tr("Animation is an abstract class"));
141 // 5.13
142 qmlRegisterType<QQuickBehavior, 13>("QtQuick", 2, 13, "Behavior");
143}
144