1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-09-10 12:03:16 +02:00

Bug 425938 - Make Qt5 template work with 5.2. Remove Qt4 template.

Change-Id: I422a907e9db51be26acd0857d3e9e409bbd3ba2e
Reviewed-on: https://git.eclipse.org/r/20728
Tested-by: Hudson CI
Reviewed-by: Doug Schaefer <dschaefer@qnx.com>
IP-Clean: Doug Schaefer <dschaefer@qnx.com>
This commit is contained in:
Doug Schaefer 2014-01-16 16:06:53 -05:00
parent 81ebdf8e82
commit 801c10d789
15 changed files with 27 additions and 307 deletions

View file

@ -5,34 +5,17 @@
<extension
point="org.eclipse.cdt.core.templates">
<template
filterPattern=".*g\+\+"
id="org.eclipse.cdt.qt.core.template.helloWorld.Qt4"
location="templates/project/Qt4/template.xml"
projectType="org.eclipse.cdt.build.makefile.projectType"/>
<template
filterPattern=".*g\+\+"
id="org.eclipse.cdt.qt.core.template.helloWorld.Qt5"
location="templates/project/Qt5/template.xml"
projectType="org.eclipse.cdt.build.makefile.projectType"/>
</extension>
<extension
point="org.eclipse.cdt.core.templateAssociations">
<template id="org.eclipse.cdt.qt.core.template.helloWorld.Qt4">
<toolChain id="cdt.managedbuild.toolchain.gnu.mingw.base"/>
<toolChain id="cdt.managedbuild.toolchain.gnu.cygwin.base"/>
<toolChain id="cdt.managedbuild.toolchain.gnu.base"/>
<toolChain id="cdt.managedbuild.toolchain.gnu.macosx.base"/>
<toolChain id="cdt.managedbuild.toolchain.gnu.solaris.base"/>
<toolChain id="cdt.managedbuild.toolchain.llvm.clang.macosx.base"/>
</template>
<template id="org.eclipse.cdt.qt.core.template.helloWorld.Qt5">
<toolChain id="cdt.managedbuild.toolchain.gnu.mingw.base"/>
<toolChain id="cdt.managedbuild.toolchain.gnu.cygwin.base"/>
<toolChain id="cdt.managedbuild.toolchain.gnu.base"/>
<toolChain id="cdt.managedbuild.toolchain.gnu.macosx.base"/>
<toolChain id="cdt.managedbuild.toolchain.gnu.solaris.base"/>
<toolChain id="cdt.managedbuild.toolchain.llvm.clang.macosx.base"/>
</template>
</extension>

View file

@ -1,17 +0,0 @@
#include "DateTime.hh"
#include <QDateTime>
DateTime::DateTime()
{
startTimer( 500 );
}
DateTime::~DateTime()
{
}
void DateTime::timerEvent( QTimerEvent * )
{
emit changed( QDateTime::currentDateTime().toString( "yyyy-MM-dd hh:mm:ss" ) );
}

View file

@ -1,22 +0,0 @@
#ifndef DATETIME_H
#define DATETIME_H
#include <QObject>
class DateTime : public QObject
{
Q_OBJECT
public:
DateTime();
virtual ~DateTime();
protected:
virtual void timerEvent( QTimerEvent * );
private:
Q_SIGNAL void changed( QString now );
};
#endif

View file

@ -1,29 +0,0 @@
PRO = {{baseName}}.pro
QMAKE = {{qmake.Qt4}}
all: debug release
clean: clean-debug clean-release
build-debug/Makefile: $(PRO)
@mkdir -p $(dir $@)
$(QMAKE) -o $@ $(PRO) CONFIG+=debug
debug: build-debug/Makefile
$(MAKE) -wC build-debug all
clean-debug:
rm -fr build-debug
build-release/Makefile: $(PRO)
@mkdir -p $(dir $@)
$(QMAKE) -o $@ $(PRO) CONFIG+=release
release: build-release/Makefile
$(MAKE) -wC build-release
clean-release:
rm -fr build-release
.PHONY: all clean debug clean-debug release clean-release

View file

@ -1,22 +0,0 @@
#include "DateTime.hh"
#include <QtDeclarative/QDeclarativeContext>
#include <QtDeclarative/QDeclarativeEngine>
#include <QtDeclarative/QDeclarativeView>
#include <QtGui/QApplication>
int main( int argc, char * argv[] )
{
QApplication app( argc, argv );
DateTime datetime;
QDeclarativeView view;
view.rootContext()->setContextProperty( "datetimeModel", &datetime );
view.setSource( QUrl::fromLocalFile( "$(baseName).qml" ) );
app.connect( view.engine(), SIGNAL( quit() ), SLOT( quit() ) );
view.show();
return app.exec();
}

View file

@ -1,7 +0,0 @@
QT += declarative
HEADERS = DateTime.hh
SOURCES = DateTime.cpp {{baseName}}.cpp
RESOURCES =
sources.files = $$SOURCES $$HEADERS $$RESOURCES *.pro

View file

@ -1,38 +0,0 @@
import QtQuick 1.0
Rectangle {
width: 480
height: 320
color: "lightgreen"
MouseArea {
anchors.fill: parent
onClicked: Qt.quit()
}
Text {
id: title
text: "Hello World from Qt4"
font.family: "Helvetica"
font.pointSize: 24
anchors.centerIn: parent
}
Text {
id: datetime
objectName: "datetime"
font.family: "Helvetica"
font.pointSize: 16
anchors {
horizontalCenter: title.horizontalCenter
top: title.bottom
}
Connections {
target: datetimeModel
onChanged: {
datetime.text = now
}
}
}
}

View file

@ -1,14 +0,0 @@
###############################################################################
# Copyright (c) 2013 QNX Software Systems and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v10.html"
###############################################################################
Qt4HelloWorld.label=Qt4 Hello World Project
Qt4HelloWorld.description=A sample Qt4 declarative project
Qt4HelloWorld.basics.label=Basic Settings
Qt4HelloWorld.basics.description=Basic properties of a project
Qt4HelloWorld.qmake.label=Qt4 qmake location
Qt4HelloWorld.qmake.description=Location of the qmake executable

View file

@ -1,103 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<template type="ProjTempl" version="1.0" supplier="Eclipse.org" revision="1.0"
copyright="Copyright (c) 2013 QNX Software Systems and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html"
id="Qt4HelloWorldProject" label="%Qt4HelloWorld.label" description="%Qt4HelloWorld.description" help="help.html">
<property-group id="basics" label="%Qt4HelloWorld.basics.label" description="%Qt4HelloWorld.basics.description" type="PAGES-ONLY" help="help.html">
<property id="qmake.Qt4"
label="%Qt4HelloWorld.qmake.label"
description="%Qt4HelloWorld.qmake.description"
type="browse"
pattern=".*"
default="qmake"
hidden="false"
persist="true"/>
</property-group>
<process type="org.eclipse.cdt.managedbuilder.core.AddLanguageSettingsProvider">
<simple name="projectName" value="$(projectName)"/>
<simple-array name="languageSettingsProviderIds">
<element value="org.eclipse.cdt.qt.core.QtPathsProvider"/>
</simple-array>
</process>
<process type="org.eclipse.cdt.core.SetEnvironmentVariable">
<simple name="projectName" value="$(projectName)"/>
<complex-array name="variables">
<element>
<simple name="name" value="QMAKE"/>
<simple name="value" value="$(qmake.Qt4)"/>
</element>
</complex-array>
</process>
<process type="org.eclipse.cdt.core.AddFiles">
<simple name="projectName" value="$(projectName)"/>
<complex-array name="files">
<element>
<simple name="source" value="baseName.cpp"/>
<simple name="target" value="$(projectName).cpp"/>
<simple name="replaceable" value="true"/>
</element>
<element>
<simple name="source" value="baseName.qml"/>
<simple name="target" value="$(projectName).qml"/>
<simple name="replaceable" value="true"/>
</element>
<element>
<simple name="source" value="DateTime.hh"/>
<simple name="target" value="DateTime.hh"/>
<simple name="replaceable" value="true"/>
</element>
<element>
<simple name="source" value="DateTime.cpp"/>
<simple name="target" value="DateTime.cpp"/>
<simple name="replaceable" value="true"/>
</element>
</complex-array>
</process>
<process type="org.eclipse.cdt.core.AddFiles2">
<simple name="projectName" value="$(projectName)"/>
<simple name="startPattern" value="{{"/>
<simple name="endPattern" value="}}"/>
<complex-array name="files">
<element>
<simple name="source" value="baseName.pro"/>
<simple name="target" value="$(projectName).pro"/>
<simple name="replaceable" value="true"/>
</element>
<element>
<simple name="source" value="Makefile"/>
<simple name="target" value="Makefile"/>
<simple name="replaceable" value="true"/>
</element>
</complex-array>
</process>
<process type="org.eclipse.cdt.ui.OpenFiles">
<simple name="projectName" value="$(projectName)"/>
<complex-array name="files">
<element>
<simple name="target" value="$(projectName).cpp"/>
</element>
</complex-array>
</process>
<process type="org.eclipse.cdt.core.AddNature">
<simple name="projectName" value="$(projectName)"/>
<simple name="natureId" value="org.eclipse.cdt.qt.core.qtNature"/>
</process>
<process type="org.eclipse.cdt.make.core.AddMakeTarget">
<simple name="projectName" value="$(projectName)"/>
<simple name="targetName" value="clean-debug"/>
</process>
<process type="org.eclipse.cdt.make.core.AddMakeTarget">
<simple name="projectName" value="$(projectName)"/>
<simple name="targetName" value="build-debug"/>
<simple name="makeTarget" value="debug"/>
</process>
</template>

View file

@ -1,5 +1,5 @@
#include "DateTime.hh"
#include "DateTime.h"
#include <QDateTime>
DateTime::DateTime()

View file

@ -2,28 +2,19 @@
PRO = {{baseName}}.pro
QMAKE = {{qmake.Qt5}}
all: debug release
all: QtMakefile
$(MAKE) -f QtMakefile
clean: clean-debug clean-release
clean:
rm -fr QtMakefile QtMakefile.debug QtMakefile.release debug release
build-debug/Makefile: $(PRO)
@mkdir -p $(dir $@)
$(QMAKE) -o $@ $(PRO) CONFIG+=debug
QtMakefile:
$(QMAKE) -o QtMakefile $(PRO) CONFIG+=debug_and_release
debug: build-debug/Makefile
$(MAKE) -wC build-debug all
debug: QtMakefile
$(MAKE) -f QtMakefile debug
clean-debug:
rm -fr build-debug
build-release/Makefile: $(PRO)
@mkdir -p $(dir $@)
$(QMAKE) -o $@ $(PRO) CONFIG+=release
release: build-release/Makefile
$(MAKE) -wC build-release
clean-release:
rm -fr build-release
release: QtMakefile
$(MAKE) -f QtMakefile release
.PHONY: all clean debug clean-debug release clean-release

View file

@ -1,5 +1,5 @@
#include "DateTime.hh"
#include "DateTime.h"
#include <QGuiApplication>
#include <QtQuick>
@ -11,7 +11,7 @@ int main( int argc, char * argv[] )
QQuickView view;
view.rootContext()->setContextProperty( "datetimeModel", &datetime );
view.setSource( QStringLiteral( "$(baseName).qml" ) );
view.setSource( QStringLiteral( "src/$(baseName).qml" ) );
view.show();
app.connect( view.engine(), SIGNAL( quit() ), SLOT( quit() ) );

View file

@ -1,5 +1,4 @@
QT += qml quick
HEADERS = DateTime.hh
SOURCES = DateTime.cpp {{baseName}}.cpp
HEADERS = src/DateTime.h
SOURCES = src/DateTime.cpp src/{{baseName}}.cpp
RESOURCES =

View file

@ -21,6 +21,11 @@
</simple-array>
</process>
<process type="org.eclipse.cdt.core.CreateSourceFolder">
<simple name="projectName" value="$(projectName)"/>
<simple name="path" value="src"/>
</process>
<process type="org.eclipse.cdt.core.SetEnvironmentVariable">
<simple name="projectName" value="$(projectName)"/>
<complex-array name="variables">
@ -36,22 +41,22 @@
<complex-array name="files">
<element>
<simple name="source" value="baseName.cpp"/>
<simple name="target" value="$(projectName).cpp"/>
<simple name="target" value="src/$(projectName).cpp"/>
<simple name="replaceable" value="true"/>
</element>
<element>
<simple name="source" value="baseName.qml"/>
<simple name="target" value="$(projectName).qml"/>
<simple name="target" value="src/$(projectName).qml"/>
<simple name="replaceable" value="true"/>
</element>
<element>
<simple name="source" value="DateTime.hh"/>
<simple name="target" value="DateTime.hh"/>
<simple name="source" value="DateTime.h"/>
<simple name="target" value="src/DateTime.h"/>
<simple name="replaceable" value="true"/>
</element>
<element>
<simple name="source" value="DateTime.cpp"/>
<simple name="target" value="DateTime.cpp"/>
<simple name="target" value="src/DateTime.cpp"/>
<simple name="replaceable" value="true"/>
</element>
</complex-array>
@ -79,7 +84,7 @@
<simple name="projectName" value="$(projectName)"/>
<complex-array name="files">
<element>
<simple name="target" value="$(projectName).cpp"/>
<simple name="target" value="src/$(projectName).cpp"/>
</element>
</complex-array>
</process>
@ -91,13 +96,7 @@
<process type="org.eclipse.cdt.make.core.AddMakeTarget">
<simple name="projectName" value="$(projectName)"/>
<simple name="targetName" value="clean-debug"/>
</process>
<process type="org.eclipse.cdt.make.core.AddMakeTarget">
<simple name="projectName" value="$(projectName)"/>
<simple name="targetName" value="build-debug"/>
<simple name="makeTarget" value="debug"/>
<simple name="targetName" value="debug"/>
</process>
</template>