mirror of
https://github.com/QuasarApp/Snake.git
synced 2025-05-08 23:49:42 +00:00
Add BaseClass
This commit is contained in:
commit
2784ad3d6d
14
back-end/baseclass.cpp
Normal file
14
back-end/baseclass.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
#include "baseclass.h"
|
||||
|
||||
BaseClass::BaseClass() :
|
||||
name("BaseClass") {
|
||||
|
||||
}
|
||||
|
||||
BaseClass::~BaseClass() {
|
||||
|
||||
}
|
||||
|
||||
QString BaseClass::getName() const {
|
||||
return name;
|
||||
}
|
16
back-end/baseclass.h
Normal file
16
back-end/baseclass.h
Normal file
@ -0,0 +1,16 @@
|
||||
#ifndef BASECLASS_H
|
||||
#define BASECLASS_H
|
||||
#include <QString>
|
||||
|
||||
class BaseClass
|
||||
{
|
||||
private:
|
||||
QString name;
|
||||
public:
|
||||
BaseClass();
|
||||
virtual void render() = 0;
|
||||
virtual ~BaseClass();
|
||||
QString getName() const;
|
||||
};
|
||||
|
||||
#endif // BASECLASS_H
|
16
back-end/main.cpp
Normal file
16
back-end/main.cpp
Normal file
@ -0,0 +1,16 @@
|
||||
#include <QGuiApplication>
|
||||
#include <QQmlApplicationEngine>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
|
||||
QGuiApplication app(argc, argv);
|
||||
|
||||
QQmlApplicationEngine engine;
|
||||
engine.load(QUrl(QStringLiteral("qrc:/front-end/main.qml")));
|
||||
if (engine.rootObjects().isEmpty())
|
||||
return -1;
|
||||
|
||||
return app.exec();
|
||||
}
|
9
front-end/main.qml
Normal file
9
front-end/main.qml
Normal file
@ -0,0 +1,9 @@
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Window 2.2
|
||||
|
||||
Window {
|
||||
visible: true
|
||||
width: 640
|
||||
height: 480
|
||||
title: qsTr("Hello World")
|
||||
}
|
5
qml.qrc
Normal file
5
qml.qrc
Normal file
@ -0,0 +1,5 @@
|
||||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file>front-end/main.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
33
snake.pro
Normal file
33
snake.pro
Normal file
@ -0,0 +1,33 @@
|
||||
QT += quick
|
||||
CONFIG += c++11
|
||||
|
||||
# The following define makes your compiler emit warnings if you use
|
||||
# any feature of Qt which as been marked deprecated (the exact warnings
|
||||
# depend on your compiler). Please consult the documentation of the
|
||||
# deprecated API in order to know how to port your code away from it.
|
||||
DEFINES += QT_DEPRECATED_WARNINGS
|
||||
|
||||
# You can also make your code fail to compile if you use deprecated APIs.
|
||||
# In order to do so, uncomment the following line.
|
||||
# You can also select to disable deprecated APIs only up to a certain version of Qt.
|
||||
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||
|
||||
SOURCES += \
|
||||
back-end/main.cpp \
|
||||
back-end/baseclass.cpp
|
||||
|
||||
RESOURCES += qml.qrc
|
||||
|
||||
# Additional import path used to resolve QML modules in Qt Creator's code model
|
||||
QML_IMPORT_PATH =
|
||||
|
||||
# Additional import path used to resolve QML modules just for Qt Quick Designer
|
||||
QML_DESIGNER_IMPORT_PATH =
|
||||
|
||||
# Default rules for deployment.
|
||||
qnx: target.path = /tmp/$${TARGET}/bin
|
||||
else: unix:!android: target.path = /opt/$${TARGET}/bin
|
||||
!isEmpty(target.path): INSTALLS += target
|
||||
|
||||
HEADERS += \
|
||||
back-end/baseclass.h
|
Loading…
x
Reference in New Issue
Block a user