Commit 1cca48fb authored by Erik Verbruggen's avatar Erik Verbruggen

Added a wizard for QML Runtime Plug-ins.

parent fdf28b5e
/**************************************************************************
**
** 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%);
/**************************************************************************
**
** 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
/****************************************************************************
**
** 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%);
/****************************************************************************
**
** 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
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
<?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>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment