KakelApp::KakelApp() { // Create and Load the QMLDocument, using build patterns. QmlDocument *qml = QmlDocument::create("asset:///main.qml"); if (!qml->hasErrors()) { setNumMoves(0); mNumTiles = 4; // Set the context property we want to use from inside the QML file. Functions exposed // via Q_INVOKABLE will be found with the property and the name of the function. qml->setContextProperty("kakel", this); // The application Page is created from the QML file. mAppPage = qml->createRootObject<Page>(); findPlayAreaAndInitialize(mAppPage); if (mAppPage) { // Finally the main scene for the application is set to the Page. Application::instance()->setScene(mAppPage); } } }
//Initialisieren der Variablen 'Score', 'numMoves' von Spieler void Player::initialization() { setScore(2); setNumMoves(4); }
void KakelApp::resetTiles() { // Reset the tiles. setNumMoves(0); findPlayAreaAndInitialize(mAppPage); }