{"action":"created","issue":{"url":"https://api.github.com/repos/White-Oak/qml-rust/issues/1","repository_url":"https://api.github.com/repos/White-Oak/qml-rust","labels_url":"https://api.github.com/repos/White-Oak/qml-rust/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/White-Oak/qml-rust/issues/1/comments","events_url":"https://api.github.com/repos/White-Oak/qml-rust/issues/1/events","html_url":"https://github.com/White-Oak/qml-rust/issues/1","id":173511329,"number":1,"title":"Allow loading from resource","user":{"login":"nbigaouette","id":112988,"avatar_url":"https://avatars.githubusercontent.com/u/112988?v=3","gravatar_id":"","url":"https://api.github.com/users/nbigaouette","html_url":"https://github.com/nbigaouette","followers_url":"https://api.github.com/users/nbigaouette/followers","following_url":"https://api.github.com/users/nbigaouette/following{/other_user}","gists_url":"https://api.github.com/users/nbigaouette/gists{/gist_id}","starred_url":"https://api.github.com/users/nbigaouette/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nbigaouette/subscriptions","organizations_url":"https://api.github.com/users/nbigaouette/orgs","repos_url":"https://api.github.com/users/nbigaouette/repos","events_url":"https://api.github.com/users/nbigaouette/events{/privacy}","received_events_url":"https://api.github.com/users/nbigaouette/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-08-26T18:11:25Z","updated_at":"2016-08-26T18:22:45Z","closed_at":null,"body":"The `QmlEngine::load_file()` method assumes a `file:///` protocol ([see qmlengine.rs line 51](https://github.com/White-Oak/qml-rust/blob/master/src/qmlengine.rs#L48-L54)).\r\n\r\nThis breaks loading a QML file from the resource system using `qrc:/` \"protocol\".\r\n\r\nThe protocol should be left to the user imo...\r\n\r\nDOtherSide supports `qrc:/`, [see its test_dotherside.cpp line 263](https://github.com/filcuc/DOtherSide/blob/master/test/test_dotherside.cpp#L263-L265)."},"comment":{"url":"https://api.github.com/repos/White-Oak/qml-rust/issues/comments/242812743","html_url":"https://github.com/White-Oak/qml-rust/issues/1#issuecomment-242812743","issue_url":"https://api.github.com/repos/White-Oak/qml-rust/issues/1","id":242812743,"user":{"login":"nbigaouette","id":112988,"avatar_url":"https://avatars.githubusercontent.com/u/112988?v=3","gravatar_id":"","url":"https://api.github.com/users/nbigaouette","html_url":"https://github.com/nbigaouette","followers_url":"https://api.github.com/users/nbigaouette/followers","following_url":"https://api.github.com/users/nbigaouette/following{/other_user}","gists_url":"https://api.github.com/users/nbigaouette/gists{/gist_id}","starred_url":"https://api.github.com/users/nbigaouette/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nbigaouette/subscriptions","organizations_url":"https://api.github.com/users/nbigaouette/orgs","repos_url":"https://api.github.com/users/nbigaouette/repos","events_url":"https://api.github.com/users/nbigaouette/events{/privacy}","received_events_url":"https://api.github.com/users/nbigaouette/received_events","type":"User","site_admin":false},"created_at":"2016-08-26T18:22:45Z","updated_at":"2016-08-26T18:22:45Z","body":"Note that I need this feature to load my `main.qml` file. I load it for now using a plain path.\r\n\r\nI want to include all my QML files as resources so I do not depend on running the application in the source folder. As such, I include them all as Qt resources. For this, I created a `.pro` file with the following:\r\n```\r\nTEMPLATE = lib\r\nRESOURCES = myapp.qrc\r\nCONFIG += staticlib\r\n```\r\nand place all my QML files in the resource file `myapp.qrc` as such:\r\n```\r\n<RCC>\r\n    <qresource prefix=\"/\">\r\n        <file>qml/Component1.qml</file>\r\n        <file>qml/Component2.qml</file>\r\n       ...\r\n    </qresource>\r\n</RCC>\r\n```\r\n\r\nThen, a `build.rs` file tells rustc to run `qmake` on that Qt project file, which creates a static library containing all QML files as resources. I just need to link that lib to the rust binary (again, done in `build.rs`).\r\n\r\nBeing able to load using `qrc:/` is required for my code since I use a singleton to dispatch some signals.\r\n\r\nThis singleton \"looses\" its singleton nature if I load files through `qrc:/` _and_ directly. I can see this by printing `this` from a method in the QML singleton: I will get two different addresses...\r\n"}}
{"actor":{"display_login":"nbigaouette"}}