Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/box2dmousejoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include "game.h"

#if QT_VERSION >= 0x050000
#include <QtQuick/QQuickCanvas>
#include <QtQuick/QQuickWindow>
#else
#include <QtGui/QApplication>
#endif
Expand Down Expand Up @@ -150,7 +150,7 @@ void Box2DMouseJoint::synchronize()
QPoint mousePos;

#if QT_VERSION >= 0x050000
mousePos = canvas()->mapFromGlobal(QCursor::pos());
mousePos = window()->mapFromGlobal(QCursor::pos());
#else
m_mousePos = QCursor::pos();
QWidget *widget = QApplication::widgetAt(m_mousePos);
Expand Down
4 changes: 2 additions & 2 deletions src/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include "scene.h"

#if QT_VERSION >= 0x050000
#include <QtQuick/QQuickCanvas>
#include <QtQuick/QQuickWindow>
#else
#include <QtGui/QApplication>
#endif
Expand Down Expand Up @@ -107,7 +107,7 @@ void Game::update()
QPointF Game::mouse()
{
#if QT_VERSION >= 0x050000
return canvas()->mapFromGlobal(QCursor::pos());
return window()->mapFromGlobal(QCursor::pos());
#else
m_mousePos = QCursor::pos();
QWidget *widget = QApplication::widgetAt(m_mousePos);
Expand Down
2 changes: 2 additions & 0 deletions src/plugins.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,6 @@ void Plugins::registerTypes(const char *uri)
qmlRegisterType<Fixture>("QuasiGame", 1, 0, "QuasiFixture");
}

#if QT_VERSION <= 0x048000
Q_EXPORT_PLUGIN2(QuasiGame, Plugins);
#endif
3 changes: 3 additions & 0 deletions src/plugins.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ class Plugins : public QDeclarativeExtensionPlugin
#endif
{
Q_OBJECT
#if QT_VERSION >= 0x050000
Q_PLUGIN_METADATA(IID "QuasiGame" FILE "plugins.json")
#endif

public:
void registerTypes(const char *uri);
Expand Down
3 changes: 3 additions & 0 deletions src/plugins.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"Keys": ["QuasiGame"]
}
14 changes: 11 additions & 3 deletions src/scriptbehavior.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@

#if QT_VERSION >= 0x050000
#include <QtQml/QQmlExpression>
#include <QtQml/QQmlComponent>
#include <QtQml/QQmlEngine>
#else
#include <QtDeclarative/QDeclarativeExpression>
#endif
Expand Down Expand Up @@ -56,15 +58,21 @@ void ScriptBehavior::setScript(const QQmlScriptString &script)
void ScriptBehavior::setScript(const QDeclarativeScriptString &script)
#endif
{
if (m_script.script() != script.script()) {
#if QT_VERSION >= 0x050000
if (m_script.stringLiteral() != script.stringLiteral()){ // XXX scripts are not working on Qt5 D:
m_script = script;

if (m_expression)
delete m_expression;

#if QT_VERSION >= 0x050000
m_expression = new QQmlExpression(m_script.context(), m_script.scopeObject(), m_script.script());
m_expression = new QQmlExpression(m_script);
#else
if (m_script.script() != script.script()) {
m_script = script;

if (m_expression)
delete m_expression;

m_expression = new QDeclarativeExpression(m_script.context(), m_script.scopeObject(), m_script.script());
#endif

Expand Down
2 changes: 2 additions & 0 deletions src/src.pro
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ SOURCES += entity.cpp \
fixture.cpp \
material.cpp

OTHER_FILES += plugins.json

QMAKE_POST_LINK = $$QMAKE_COPY $$PWD/qmldir $$OUT_PWD/imports/QuasiGame

!isEmpty(QTPATH): target.path = $$QTPATH/imports/$$TARGETPATH
Expand Down