PDA

View Full Version : Is loading a built exe from QT Creator different from loading from file system?



andygongyb
27th July 2012, 00:49
I'm writing a desktop app that connects to my company's intranet. The page I'm trying to load is HTTP, but it will redirect to a login site that uses HTTPS. The app loads the page well when launched from QT Creator (both redirection and authentication succeeded, and the page is shown correctly), but when I run the app from file system (all DLLs are put into the folder correctly), the loading fails (QWebView's loadFinished(bool) signal is emitted with a false, which is a rare case as I learned online). I can catch the first 302 redirection status from QNetworkManager's SIGNAL(finished(QNetworkReply*)), but when the second time the signal is captured, the status becomes invalid. From QNetworkReply's documentation I read that "If the connection was not HTTP-based, this attribute will not be present." I don't know why. In addition, not SSL error signal is emitted. Since the app runs well from QT Creator. I believe it should be due to some difference in environment when launching. Anyone have a clue? Thanks!

Edit:
FYI QT creator is not running with privilege. One thing is that the app runs ok from FS several days ago but fails now. (I tried the backed up build from several days ago recently but with no luck) I don't know if that's some server side problem since I tried on multiple computers, which all managed to run the app before. But the most weird thing is why it has no problem when launching from IDE.

StrikeByte
31st July 2012, 14:50
Did you copy the correct version of the dll's? i had a similar problem a while ago but then I realized i just installed a newer version of qt and I still used the older dlls for the app

tescrin
31st July 2012, 16:00
In my experience with simply loading images, the .exe when ran has the base folder as the folder IT is in; where when you open the project and run it the base directory is where the .project file you opened was.

I.E. if you have a path that's specific to where your project file was: E.G. C:\Derp\ProjFoo and you have your files you need in Derp the project would reference ..\ for where they are. However, when the exe builds in C:\Derp\ProjFoo\Release it's searching ProjFoo for the files that use the term "..\".

I'm not sure of the *why* exactly, but in my experience it took awhile to figure out why it would "forget" all the graphics I had added in designer that didn't use a resource file.


I imagine you simple need to have a .qrc file include these .dlls in it's listed resources so the .exe knows where to find them, but I'm just guessing (and a bit noobish with this.)


EDIT:
My instance was I was getting ready to demo a shiny new GUI so some supervisors and when running through the .exe (since I hadn't used a resource file) I was losing all my resources. Had to learn that fix real quick lol

IMO, move the exe to your project's base directory and run it; if it runs you know you have some local paths that need to be done more creatively in order to be correctly referenced. Personally I use a set of global paths if I'm unsure where things will end up; I figured I can always build an install that updates those paths based on the install_dir later

StrikeByte
2nd August 2012, 13:46
In my experience with simply loading images, the .exe when ran has the base folder as the folder IT is in; where when you open the project and run it the base directory is where the .project file you opened was.

I.E. if you have a path that's specific to where your project file was: E.G. C:\Derp\ProjFoo and you have your files you need in Derp the project would reference ..\ for where they are. However, when the exe builds in C:\Derp\ProjFoo\Release it's searching ProjFoo for the files that use the term "..\".

I'm not sure of the *why* exactly, but in my experience it took awhile to figure out why it would "forget" all the graphics I had added in designer that didn't use a resource file.


I imagine you simple need to have a .qrc file include these .dlls in it's listed resources so the .exe knows where to find them, but I'm just guessing (and a bit noobish with this.)


EDIT:
My instance was I was getting ready to demo a shiny new GUI so some supervisors and when running through the .exe (since I hadn't used a resource file) I was losing all my resources. Had to learn that fix real quick lol

IMO, move the exe to your project's base directory and run it; if it runs you know you have some local paths that need to be done more creatively in order to be correctly referenced. Personally I use a set of global paths if I'm unsure where things will end up; I figured I can always build an install that updates those paths based on the install_dir later

you can change the working directory (base path) for a project
click on project in the Qt creator
click on run (on the top of the window)
change the working directory (for instance to the location where you build your app or some entierly other directory)