mabg
mabg

Reputation: 2092

Qmlscene dummydata

I have this qml:

main.qml:

import QtQuick 2.4
import QtQuick.Controls 1.3

Item {
    property alias text: t.text
    anchors.fill: parent
    Text {
        id: t
    }
}

What must I put in the dummydata directory to show Hello on the text item?

Upvotes: 1

Views: 735

Answers (2)

mabg
mabg

Reputation: 2092

Finally the response is to change the approach, like is discussed on qtcentre, qmlscene dummydata question, so I'll rewrite my code.

Upvotes: 0

Mitch
Mitch

Reputation: 24406

I'm not sure what you're trying to do with the property alias, but here's an example that works:

dummydata/myDummyData.qml:

import QtQml 2.0

QtObject {
    property string text: "Hello"
}

main.qml:

import QtQuick 2.0

Item {
    width: 640
    height: 480

    Text {
        text: myDummyData.text
    }
}

Upvotes: 2

Related Questions