Lady Be Good
Lady Be Good

Reputation: 271

Qt QML problem about importing a .STL file

I am trying to import a .stl file into main.qml file. I have some code that uses a FileDialog to set SceneLoader's source. I don't want to use a FileDialog. Instead of FileDialog I try to use a direct source that doesn't ask the users for a .stl file directory. Code that I am using for the import a .stl file

    header: ToolBar
    {
        ToolButton
        {
            text: ".stl file"
            onPressed:
            {
                fileDialog.open()
            }
        }
    }
    FileDialog
    {
        id: fileDialog
        onAccepted:
        {
            sceneLoader.source = fileDialog.fileUrl
        }
    }
.
.
.
components: [
                    SceneLoader
                    {
                        id: sceneLoader
                    }
                ]

This works great. Instead of this, I try this code:

               components: [
                    SceneLoader
                    {
                        id: sceneLoader
                        source: "C:\\Users\Halil\yedekleme\Belgeler\\r.stl"
                    }
                ]         


But it doesn't work. The error is: Failed to download scene at QUrl("c:%5CUsersHalilyedeklemeBelgeler%5Cr.stl")

And now I checked the escape sequences, maybe it causes an error, but as I see it looks fine. And now I am confused about what I am doing wrong?

Upvotes: 2

Views: 461

Answers (1)

AlGrenadine
AlGrenadine

Reputation: 79

Try source: "file://C:/Users/Halil/yedekleme/Belgeler/r.stl" or escape the \ correctly, it seems you only put one \ in your path

Upvotes: 1

Related Questions