loadUi from outside directory
-
@JonB Well, The .ui file is outside the folder where I'm trying to load it. Should I start with "C:/Users/..."?
@Qt-Bot05
If that is its absolute path then yes, you can do that, at least try it. However this is not very robust going forward. If you distribute your application to someone else, or you move where it is stored on your own computer, it will break.The first thing is that I presume wherever it is it is within your project. If not you have a problem: how is it related, and how is your app supposed to locate it at runtime? Assuming it is within your project, consider using a relative path. For example, you can [go] upwards via
../something
or you can go downwards viasomething/
. This is preferable because so long as your project structure remains the same if moved or distributed it will continue to work.First get it working maybe with an absolute path to make sure it works, then look at what relative path could be used instead.
-
@Qt-Bot05
If that is its absolute path then yes, you can do that, at least try it. However this is not very robust going forward. If you distribute your application to someone else, or you move where it is stored on your own computer, it will break.The first thing is that I presume wherever it is it is within your project. If not you have a problem: how is it related, and how is your app supposed to locate it at runtime? Assuming it is within your project, consider using a relative path. For example, you can [go] upwards via
../something
or you can go downwards viasomething/
. This is preferable because so long as your project structure remains the same if moved or distributed it will continue to work.First get it working maybe with an absolute path to make sure it works, then look at what relative path could be used instead.
-
@Qt-Bot05
If that is its absolute path then yes, you can do that, at least try it. However this is not very robust going forward. If you distribute your application to someone else, or you move where it is stored on your own computer, it will break.The first thing is that I presume wherever it is it is within your project. If not you have a problem: how is it related, and how is your app supposed to locate it at runtime? Assuming it is within your project, consider using a relative path. For example, you can [go] upwards via
../something
or you can go downwards viasomething/
. This is preferable because so long as your project structure remains the same if moved or distributed it will continue to work.First get it working maybe with an absolute path to make sure it works, then look at what relative path could be used instead.
-
Hi,
The number of points is important.
One = current folder
Two = previous folder
Three = folder named "..." in the current folder. -
@Qt-Bot05
If that is its absolute path then yes, you can do that, at least try it. However this is not very robust going forward. If you distribute your application to someone else, or you move where it is stored on your own computer, it will break.The first thing is that I presume wherever it is it is within your project. If not you have a problem: how is it related, and how is your app supposed to locate it at runtime? Assuming it is within your project, consider using a relative path. For example, you can [go] upwards via
../something
or you can go downwards viasomething/
. This is preferable because so long as your project structure remains the same if moved or distributed it will continue to work.First get it working maybe with an absolute path to make sure it works, then look at what relative path could be used instead.