forked from qt-creator/qt-creator
Added a wizard for QML Runtime Plug-ins.
This commit is contained in:
63
share/qtcreator/templates/wizards/qml-runtime/object.cpp
Normal file
63
share/qtcreator/templates/wizards/qml-runtime/object.cpp
Normal file
@@ -0,0 +1,63 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** Commercial Usage
|
||||
**
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact the sales department at http://qt.nokia.com/contact.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#include <QtCore/QTime>
|
||||
#include <QtDeclarative/qdeclarative.h>
|
||||
|
||||
#include "%ObjectName%.h"
|
||||
|
||||
%ObjectName%::%ObjectName%(QObject *parent):
|
||||
QObject(parent)
|
||||
{
|
||||
timer = new QTimer(this);
|
||||
timer->setInterval(750);
|
||||
connect(timer, SIGNAL(timeout()), this, SLOT(timerFired()));
|
||||
timer->start();
|
||||
}
|
||||
|
||||
QString %ObjectName%::text() const
|
||||
{
|
||||
return theText;
|
||||
}
|
||||
|
||||
void %ObjectName%::setText(const QString &text)
|
||||
{
|
||||
if (theText != text) {
|
||||
theText = text;
|
||||
emit textChanged(theText);
|
||||
}
|
||||
}
|
||||
|
||||
void %ObjectName%::timerFired()
|
||||
{
|
||||
QTime t = QTime::currentTime();
|
||||
setText(t.toString(QLatin1String("HH:mm:ss")));
|
||||
}
|
||||
|
||||
QML_DECLARE_TYPE(%ObjectName%);
|
||||
62
share/qtcreator/templates/wizards/qml-runtime/object.h
Normal file
62
share/qtcreator/templates/wizards/qml-runtime/object.h
Normal file
@@ -0,0 +1,62 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** Commercial Usage
|
||||
**
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact the sales department at http://qt.nokia.com/contact.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef EXAMPLEITEM_H
|
||||
#define EXAMPLEITEM_H
|
||||
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/QTimer>
|
||||
|
||||
class %ObjectName% : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged)
|
||||
|
||||
public:
|
||||
%ObjectName%(QObject *parent = 0);
|
||||
|
||||
QString text() const;
|
||||
void setText(const QString &text);
|
||||
|
||||
signals:
|
||||
void textChanged(const QString &newText);
|
||||
|
||||
private slots:
|
||||
void timerFired();
|
||||
|
||||
private:
|
||||
QString theText;
|
||||
QTimer *timer;
|
||||
|
||||
Q_DISABLE_COPY(%ObjectName%)
|
||||
};
|
||||
|
||||
#endif // EXAMPLEITEM_H
|
||||
52
share/qtcreator/templates/wizards/qml-runtime/plugin.cpp
Normal file
52
share/qtcreator/templates/wizards/qml-runtime/plugin.cpp
Normal file
@@ -0,0 +1,52 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the demonstration applications of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** No Commercial Usage
|
||||
** This file contains pre-release code and may not be distributed.
|
||||
** You may use this file in accordance with the terms and conditions
|
||||
** contained in the Technology Preview License Agreement accompanying
|
||||
** this package.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "%ProjectName%.h"
|
||||
#include "%ObjectName%.h"
|
||||
|
||||
void %ProjectName%::registerTypes(const char *uri)
|
||||
{
|
||||
Q_UNUSED(uri);
|
||||
|
||||
QML_REGISTER_TYPE(%ProjectName%,1,0,%ObjectName%,%ObjectName%);
|
||||
}
|
||||
|
||||
Q_EXPORT_PLUGIN(%ProjectName%);
|
||||
56
share/qtcreator/templates/wizards/qml-runtime/plugin.h
Normal file
56
share/qtcreator/templates/wizards/qml-runtime/plugin.h
Normal file
@@ -0,0 +1,56 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the demonstration applications of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** No Commercial Usage
|
||||
** This file contains pre-release code and may not be distributed.
|
||||
** You may use this file in accordance with the terms and conditions
|
||||
** contained in the Technology Preview License Agreement accompanying
|
||||
** this package.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef EXAMPLECOREPLUGIN_H
|
||||
#define EXAMPLECOREPLUGIN_H
|
||||
|
||||
#include <QtDeclarative/qdeclarative.h>
|
||||
#include <QtDeclarative/QDeclarativeExtensionPlugin>
|
||||
|
||||
class %ProjectName% : public QDeclarativeExtensionPlugin
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
void registerTypes(const char *uri);
|
||||
};
|
||||
|
||||
#endif // EXAMPLECOREPLUGIN_H
|
||||
18
share/qtcreator/templates/wizards/qml-runtime/project.pro
Normal file
18
share/qtcreator/templates/wizards/qml-runtime/project.pro
Normal file
@@ -0,0 +1,18 @@
|
||||
TEMPLATE = lib
|
||||
TARGET = %ProjectName%
|
||||
QT += declarative
|
||||
CONFIG += qt plugin
|
||||
|
||||
TARGET = $$qtLibraryTarget($$TARGET)
|
||||
DESTDIR = %ProjectName%
|
||||
|
||||
# Input
|
||||
SOURCES += \
|
||||
%ProjectName%.cpp \
|
||||
%ObjectName%.cpp
|
||||
|
||||
OTHER_FILES=%ProjectName%/qmldir
|
||||
|
||||
HEADERS += \
|
||||
%ProjectName%.h \
|
||||
%ObjectName%.h
|
||||
1
share/qtcreator/templates/wizards/qml-runtime/qmldir
Normal file
1
share/qtcreator/templates/wizards/qml-runtime/qmldir
Normal file
@@ -0,0 +1 @@
|
||||
plugin %ProjectName%
|
||||
59
share/qtcreator/templates/wizards/qml-runtime/wizard.xml
Normal file
59
share/qtcreator/templates/wizards/qml-runtime/wizard.xml
Normal file
@@ -0,0 +1,59 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** Commercial Usage
|
||||
**
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact the sales department at http://qt.nokia.com/contact.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
Custom project wizard configuration example file. Note that by convention,
|
||||
the project file goes last.
|
||||
The "class" and "firstpage" attributes specify that it is a Qt 4 wizard and
|
||||
leave room for the Qt 4 target page.
|
||||
-->
|
||||
<wizard version="1" kind="project"
|
||||
class="qt4project" firstpage="10"
|
||||
id="QmlRuntimePlugin" category="F.Projects">
|
||||
<description>Creates a plug-in for the QML runtime.</description>
|
||||
<displayName>QML Runtime Plug-in</displayName>
|
||||
<displayCategory>QML Runtime Plug-in</displayCategory>
|
||||
<files>
|
||||
<file source="qmldir" target="%ProjectName%/qmldir"/>
|
||||
<file source="plugin.h" target="%ProjectName%.h"/>
|
||||
<file source="plugin.cpp" target="%ProjectName%.cpp"/>
|
||||
<file source="object.h" target="%ObjectName%.h"/>
|
||||
<file source="object.cpp" target="%ObjectName%.cpp"/>
|
||||
<file source="project.pro" target="%ProjectName%.pro"/>
|
||||
</files>
|
||||
<!-- Create a 2nd wizard page with parameters -->
|
||||
<fieldpagetitle>QML Runtime Plug-in Parameters</fieldpagetitle>
|
||||
<fields>
|
||||
<field mandatory="false" name="ObjectName">
|
||||
<fieldcontrol class="QLineEdit" validator='^[A-Za-z0-9_]+$' defaulttext="ExampleObject"/>
|
||||
<fielddescription>Example Object Class-name:</fielddescription>
|
||||
</field>
|
||||
</fields>
|
||||
</wizard>
|
||||
Reference in New Issue
Block a user