Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't find properties defined on other qml file #32

Open
hilpara opened this issue Feb 5, 2025 · 0 comments
Open

Can't find properties defined on other qml file #32

hilpara opened this issue Feb 5, 2025 · 0 comments

Comments

@hilpara
Copy link

hilpara commented Feb 5, 2025

I'm trying to use style in main qml. From the Qt side, they propose to use singleton with QtObject

Style.qml
pragma Singleton
import QtQuick 2.0

QtObject {
    property color headerColor: "yellow"
}
Main.qml
import QtQuick
import QtQuick.Controls
import "styles"

ApplicationWindow {
    id: window
    width: 1280
    height: 800
    visible: true

    header: Rectangle {
        id: header
        height: 40
        color: Style.headerColor
    }
}

If I run the program normal, it works. But if I run with QHot, I will get ReferenceError: Style is not defined or Unable to assign [undefined] to QColor. I did try without singleton, but it doesn't help. I did add the path to Style.qml also to qhot-profile.json import-path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant