Make qrc path aliases the same as filesystem ones

This commit is contained in:
miruka 2019-09-01 05:42:51 -04:00
parent ddd1587b7d
commit b867584784
4 changed files with 5 additions and 6 deletions

View File

@ -66,8 +66,7 @@ file_content += '<RCC version="1.0">'
file_content += '<qresource prefix="/">' file_content += '<qresource prefix="/">'
for(file, RESOURCE_FILES) { for(file, RESOURCE_FILES) {
alias = $$replace(file, src/, '') file_content += ' <file alias="$$file">../$$file</file>'
file_content += ' <file alias="$$alias">../$$file</file>'
} }
file_content += '</qresource>' file_content += '</qresource>'

View File

@ -23,11 +23,11 @@ int main(int argc, char *argv[]) {
objectContext->setContextProperty("debugMode", false); objectContext->setContextProperty("debugMode", false);
#endif #endif
QFileInfo qrcPath(":/qml/Window.qml"); QFileInfo qrcPath(":src/qml/Window.qml");
QQmlComponent component( QQmlComponent component(
&engine, &engine,
qrcPath.exists() ? "qrc:/qml/Window.qml" : "src/qml/Window.qml" qrcPath.exists() ? "qrc:/src/qml/Window.qml" : "src/qml/Window.qml"
); );
component.create(objectContext); component.create(objectContext);

View File

@ -163,7 +163,7 @@ class Theme(ConfigFile):
async def default_data(self) -> str: async def default_data(self) -> str:
async with aiofiles.open("src/themes/Default.qpl", "r") as file: async with aiofiles.open("src/themes/Default.qpl") as file:
return await file.read() return await file.read()

View File

@ -53,7 +53,7 @@ Python {
} }
addImportPath("src") addImportPath("src")
addImportPath("qrc:/") addImportPath("qrc:/src")
importNames("python", ["APP"], () => { importNames("python", ["APP"], () => {
loadSettings(() => { loadSettings(() => {
callCoro("saved_accounts.any_saved", [], any => { callCoro("saved_accounts.any_saved", [], any => {