#Appload - Switching between pages

1 messages ยท Page 1 of 1 (latest)

ancient stag
#

StackView
Loader
visible
createObject

None of this works in reMarkable (appload).
In the console on the iMac all 3 methods work correctly.
Any idea how to get around this? I don't want to write all the pages to a single *qml file.

snow laurel
#

Loader does work

#

How are you running this?

#

Ah, maybe do not supply absolute paths, if you're doing so

#

Appload internally remaps a lot of things

ancient stag
#

example.qml

import QtQuick.Controls 2.5

Rectangle {
    anchors.fill: parent

    signal close
    function unloading() {
        console.log("We're unloading!");
    }

    height: 500
    width: 500
    visible: true

    Loader {
        id: pageLoader
        anchors.fill: parent
        source: "Page2.qml"
    }
}

Page2.qml

import QtQuick 2.5
import QtQuick.Controls 2.5

Item {
    Rectangle {
        width: parent.width
        height: parent.height
        color: "lightblue"

        Text {
            anchors.centerIn: parent
            text: "This is page 2"
            font.pixelSize: 20
        }
    }
}

#

In VS Code works fine. In reMarkable not working.

#

I seen just white page.

snow laurel
#

Just to make sure, you did add Page2.qml to the qrc file, right?

ancient stag
#

Oh, shit. So big my fail.
Thank you so much man.
I hope, this is helpful for other people ๐Ÿ™‚

snow laurel
#

It's no problem ๐Ÿ™‚

fair heath
#

Sorry for having summoned an old thread but I'm having the exact same issue, where my StackView is blank. This is my ui.qml, and below is my .qrc

import QtQuick 2.5
import QtQuick.Controls 2.5
import QtQuick.Layouts 2.5
import net.asivery.AppLoad 1.0

Rectangle {
    id: root
    anchors.fill: parent
    color: "white"
    
    // Helper function to send messages to backend
    function sendBackendMessage(type, content) {
        appload.sendMessage(type, content);
    }

    AppLoad {
        id: appload
        applicationID: "reMarkacord"

        Component.onCompleted: {
            sendMessage(10000, "Init");
        }

        onMessageReceived: (type, contents) => {
            console.log("QML Received: " + type);
            
            // Handle Init/Ready
            if (type === 201) {
                console.log("Backend is ready");
                // If backend says it's ready, we might want to refresh the current view
                return;
            }

            var data = [];
            try {
                 if (contents !== "") {
                     data = JSON.parse(contents);
                 }
            } catch (e) {
                console.log("JSON parse error: " + e);
                return;
            }

            // Forward data to current view
            if (stackView.currentItem && stackView.currentItem.updateData) {
                stackView.currentItem.updateData(type, data);
            }
        }
    }

    StackView {
        id: stackView
        anchors.fill: parent
        initialItem: "/ui/GuildsList.qml"
    }
}
<RCC>
    <qresource>
        <file>ui/ui.qml</file>
        <file>ui/GuildsList.qml</file>
        <file>ui/ChannelsList.qml</file>
        <file>ui/MessagesList.qml</file>
    </qresource>
</RCC>