Skip to content

Commit 284853a

Browse files
author
Roger Zanoni
committed
Merge pull request #27 from kenvandine/qt5_only
Dropped Qt4 support
2 parents 40fb573 + 03fe29a commit 284853a

40 files changed

+17
-355
lines changed

README

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,20 @@ A simple Qt-based 2D game engine.
66

77
1.1) Dependencies
88

9-
* Qt4.x or Qt5
10-
Qt4 download: http://qt.nokia.com/downloads/
9+
* Qt5
1110
Qt5 source repository: https://qt.gitorious.org/qt/qt5
1211

1312
* Box2D >= 2.2.1
1413
http://box2d.org
1514

16-
If you are using Qt5, we strongly recommend you to install Qt5 to a different prefix from Qt4.
17-
If you have Qt4 installed at /usr, we suggest one of the following prefixes:
18-
19-
* /opt/Qt5
20-
* /usr/local/Qt5
21-
2215
1.2) Building
2316

2417
Available QMake parameters:
2518

2619
* QTPATH (Optional)
2720
Prefix where Qt has been installed. It is required to install
2821
Quasi's QML import plugin and related files.
29-
The default path is /usr/lib/qt
22+
The default path is /usr/lib/qt5
3023

3124
* BOX2DPATH (Optional)
3225
Path to Box2D installation. If your Linux distro packaging system

demos/basketball/GameWindow.qml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ QuasiGame {
4848
Image {
4949
id: backboardHandler
5050
anchors.bottom: parent.bottom
51-
source: ":/images/backboardhandler.png"
51+
source: "qrc:/images/backboardhandler.png"
5252
}
5353

5454
QuasiMaterial {
@@ -100,7 +100,7 @@ QuasiGame {
100100
anchors.left: basketHandler.right
101101
anchors.top: basketHandler.top
102102
z: 10
103-
source: ":/images/basket.png"
103+
source: "qrc:/images/basket.png"
104104
}
105105

106106
QuasiEntity {
@@ -183,7 +183,7 @@ QuasiGame {
183183
Image {
184184
id: ballImage
185185
anchors.fill: parent
186-
source: ":/images/ball.png"
186+
source: "qrc:/images/ball.png"
187187
smooth: true
188188
}
189189

@@ -206,9 +206,9 @@ QuasiGame {
206206
score++;
207207
console.log("score = " + score);
208208
}
209-
basket.source = ":/images/scorebasket.png"
209+
basket.source = "qrc:/images/scorebasket.png"
210210
} else {
211-
basket.source = ":/images/basket.png"
211+
basket.source = "qrc:/images/basket.png"
212212
}
213213
}
214214
}
@@ -287,7 +287,7 @@ QuasiGame {
287287
width: 50
288288
height: 50
289289

290-
source: ":/images/" + type + "ball.png"
290+
source: "qrc:/images/" + type + "ball.png"
291291
}
292292
}
293293
}

demos/paratrooper/GameWindow.qml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ QuasiGame {
111111

112112
Image {
113113
id: sun
114-
source: ":/sun.png"
114+
source: "qrc:/sun.png"
115115
anchors.top: parent.top
116116
anchors.horizontalCenter: parent.horizontalCenter
117117
anchors.margins: -sun.height / 2
@@ -248,7 +248,7 @@ QuasiGame {
248248

249249
Image {
250250
id: target
251-
source: ":/target.png"
251+
source: "qrc:/target.png"
252252
width: sourceSize.width / 2
253253
height: sourceSize.height / 2
254254
anchors.centerIn: parent

demos/paratrooper/Paratrooper.qml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import QtQuick 1.1
1+
import QtQuick 2.0
22
import QuasiGame 1.0
33

44
QuasiEntity {
@@ -99,7 +99,7 @@ QuasiEntity {
9999
id: paratrooperImage
100100
width: sourceSize.width / 2
101101
height: sourceSize.height / 2
102-
source: ":/paratrooper.png"
102+
source: "qrc:/paratrooper.png"
103103
smooth: true
104104
anchors.horizontalCenter: parent.horizontalCenter
105105
anchors.bottom: parent.bottom

examples/examples.pri

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
CONFIG += qt
22

3-
contains(QT_VERSION, ^5.*) {
4-
QT += quick
5-
} else {
6-
QT += declarative
7-
}
3+
QT += quick
84

95
contains(USE_OPENGL, 1) {
106
QT += opengl

examples/launcher/launcher.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,7 @@
44
#include <QtCore/QObject>
55
#include <QtCore/QFile>
66

7-
#if QT_VERSION >= 0x050000
87
#include <QtQml/QQmlContext>
9-
#else
10-
#include <QtDeclarative/QDeclarativeContext>
11-
#endif
128

139
class Launcher : public QObject
1410
{
@@ -21,11 +17,7 @@ public slots:
2117
QString qmlData() const
2218
{
2319
QString import("import QuasiGame 1.0\n");
24-
#if QT_VERSION >= 0x050000
2520
import += "import QtQuick 2.0\n";
26-
#else
27-
import += "import QtQuick 1.1\n";
28-
#endif
2921
QFile qmlFile(":/GameWindow.qml");
3022
if (!qmlFile.open(QIODevice::ReadOnly)) {
3123
qWarning("Error opening GameWindow.qml");

examples/launcher/launcher.qrc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<!DOCTYPE RCC><RCC version="1.0">
22
<qresource>
3-
<file>main-qt4.qml</file>
4-
<file>main-qt5.qml</file>
3+
<file>main.qml</file>
54
<file>main.js</file>
65
</qresource>
76
</RCC>

examples/launcher/main-qt4.qml

Lines changed: 0 additions & 10 deletions
This file was deleted.

examples/launcher/main.cpp

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,10 @@
2323

2424
#include <QtCore/qglobal.h>
2525

26-
#if QT_VERSION >= 0x050000
2726
#include <QtGui/QGuiApplication>
2827
#include <QtQml/QQmlContext>
2928
#include <QtQml/QQmlEngine>
3029
#include <QtQuick/QQuickView>
31-
#else
32-
#include <QtGui/QApplication>
33-
#include <QtDeclarative/QDeclarativeContext>
34-
#include <QtDeclarative/QDeclarativeView>
35-
#include <QtDeclarative/QDeclarativeEngine>
36-
#endif
3730

3831
#ifdef QT_OPENGL_LIB
3932
#include <QtOpenGL/QGLWidget>
@@ -44,24 +37,15 @@ int main(int argc, char *argv[])
4437
QByteArray data = "1";
4538
qputenv("QML_IMPORT_TRACE", data);
4639

47-
#if QT_VERSION >= 0x050000
4840
QGuiApplication app(argc, argv);
4941
QQuickView view;
50-
#else
51-
QApplication app(argc, argv);
52-
QDeclarativeView view;
53-
#endif
5442

5543
Launcher launcher;
5644

5745
view.engine()->rootContext()->setContextProperty("launcher", &launcher);
5846
view.engine()->addImportPath("../../src/imports");
5947

60-
#if QT_VERSION >= 0x050000
61-
view.setSource(QUrl("qrc:/main-qt5.qml"));
62-
#else
63-
view.setSource(QUrl("qrc:/main-qt4.qml"));
64-
#endif
48+
view.setSource(QUrl("qrc:/main.qml"));
6549

6650
#ifdef QT_OPENGL_LIB
6751
view.setViewport(new QGLWidget);
File renamed without changes.

0 commit comments

Comments
 (0)