QWebview examples: only runs in specific directory - qt

I'm trying to create a Qt app with a webview. I started out with a very simple UI with nothing more than a QWebview. When trying ui->webview->SetUrl("http://google.com"); the application crashes on something with openssl.
Auto configuration failed
3348:error:0200107B:system library:fopen:Unknown error:.\crypto\bio\bss_file.c:169:fopen('c:cygwinhomeAdministrateurbuildslavefull-windows_xp_32buildgpac_extra_libs/c:cygwinhomeAdministrateurbuildslavefull-windows_xp_32buildgpac_extra_libs/ssl/openssl.cnf','rb')
3348:error:2006D002:BIO routines:BIO_new_file:system lib:.\crypto\bio\bss_file.c:174:
3348:error:0E078002:configuration file routines:DEF_LOAD:system lib:.\crypto\conf\conf_def.c:199:
I continues trying the examples. Domtraversal is one of the easier applications so i tried to build and run this. It works.
Changed the url to "https://gmail.com" which also works (so no ssl issues there).
When i run the debug or release .exe it works normally (qt's bin path is in my path var so there are no dll problems), but when i move the executable to say, my Desktop it does not run.
I've tried several different things:
when i have any tree with the same amount of folders up to "build-domtraversal-Desktop_Qt_5_0_2_MSVC2010_32bit-Debug" as the folder it is build in continues by release with the executable in it (so: c:/test/test/test/test/test/test/build-domtraversal-Desktop_Qt_5_0_2_MSVC2010_32bit-Debug/release/app.exe) it works
When i add folders inside the release folder (...-Debug/release/test/test/app.exe) it works
When i change the name of either "build-domtraversal-Desktop_Qt_5_0_2_MSVC2010_32bit-*" or release folders it does not work (exept for the end of the build folder name)
When i change the name of the app itself it works.
When i change the folder structure to D:/* it does not work
When i turn off shadow build it does not work anymore in debug mode either. Unless i move the output .exe back into a folder structure where it did work.
There must be a path somewhere in the .pro.user or somewhere else i haven't thought about. Can anyone point me in the right direction? Cause right now I'm starting to believe in magic...

Related

Ctrl-r do not run when the build directory has been changed

By default the build directory of a project is a sibling, withing the same directory than the project himself.
To have a better organisation in my backup process, I have moved the defaut build path in a directory which is sibling of the parent directory of all my projects. The compilation default path has been updated accordingly.
Now I only backup my projects, without the builds.
The problem I'm facing now is about the execute key combo Ctrl-r for which I get the compilation progress bar, but in fact, the project is not compiled now. This is confirmed because the compiled files do not update within the buid directory.
The only way, now, to update compilation is through the menu Build-> build all. It works but without key binding and I need after to execute.
Is there a way to recover Ctrl-r when changing the build directory path ?
Thanks for help
When you run a project from Qt Creator, it gets rebuilt only if needed, as clearly stated here:
Run configurations start the application in the location where it was
copied by the deploy configuration. By default, when you select the
Run function, Qt Creator builds the project, deploys it to the device
defined in the kit, and runs it there. However, if you have not made
any changes to the project since you last built and deployed it, Qt
Creator simply runs it again.
The only way to force build is to issue the rebuild command explicitely (you can use the Ctrl-B shortcut for that purpose).
If the default build directory is changed (in Tools>Options>Build & Run>General) this setting will apply (as a default) for subsequently created projects. Existing projects will keep their build directory, as specified in the project Build Settings.
You may also want to check if the options
Always build project before deploying it
Always deploy project before running it
in Tools>Options>Build & Run>General are set.
Sometimes, editing a header file does not trigger a build, even if the file is included in some cpp file. To solve this issue in Qt Creator, just add a line like this to the pro file:
DEPENDPATH += path/to/the/header(s)

Build directory for Qt Creator IDE

I am trying to populate a QTableview with some data. When developing under Qt Creator, data is read from build directory. Running the program each time, the QTableview keeps getting repopulated with previous data.
If I manually change the build directory each time before run, doesn't happen. But how do I solve the problem without manually changing the build directory every time I want a fresh run?
In your project directory there is a file name ProjectName.pro.user.
This file creating when you configure your project. it's XML file.
you can find this line on *.user files:
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:/Users/probook/Documents/Qt/testProject/Build/Windows/Debug</value>
This line define build directory address for debug. there is a same line for Release and Profile in that file.
You can also use Qt creator to define(customize) relative directory build:
goto Qt creator, Tools, Options..., Build & Run, General, Default build directory.
More info:
Qt Creator stores user-specific project settings in a .pro.user file. You can share these settings between several projects as a .pro.shared file. It has the same XML structure as a .pro.user file, but only contains the settings to share.
Based on comment, issue seems to be data which gets saved to build directory. And solution would be to remove it before running the application.
You can add Custom Process Step, either under Projects - Build Settings -
Build Steps, or under Projects - Run Settings - Deployment, and just delete the desired data files. Exact command depends on operating system.
An alternative might be to add a command line switch, something like --development-erase-saved-data, to the application itself, and erase the files (or just not read them, or whatever). Then add that command line switch to Projects - Run Settings - Run Steps - Command Line Arguments for desired build configurations.
Adding support for this in the application itself is easier to maintain, and is almost automatically cross-platform. However, it might be a feature you don't want in the application, though in that case you might only enable it for Debug builds (with #ifdef).
As a side note, saving data to executable directory is not a good idea these days. You might want to save it for example to location returned by
QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)
(See here for more info.)

Getting an all-white screen on deploying Qt Quick demo app Minehunt

To test the deployment process I am trying to deploy the included demo app Minehunt. I am able to get it to run, no crashing or errors, but the screen is all white.
I believe this generally means that I am missing plugins. Dependency walker reports no problems, and I even tried including ALL the plugins from the Qt MingW plugins directory, but no such luck.
Here is what I am including so far; Can anyone advise what else I need to add to get it to run?
Your dlls don't look bad at all. I think, too, that it's your plugins. Even if they are there, there is a good chance, that your program don't find them. Qt is a bit picky where to look by default. You might try qt.conf. This is a small textfile you must create in the folder where your executable lies. It contains the path to your Qt plugins.
For instance, in one of my projects I have the followin folder layout:
Appfolder
plugin
qt
plugins
imageformats
sqldrivers
myapp.exe
qt.conf
...many dlls...
Then I added a qt.conf file to the Appfolder, which has the following content:
[Paths]
Plugins = plugins/qt/plugins
My program is Qt 4, but I don't think this aspect of plugin deployment changed in Qt5.
All my qt dlls are in qt. And I add the following PATH: SET PATH=.\plugins;.\plugins\qt;%PATH%. Works like a charm on any Windows I ever tried.
Edit:
I then created a .bat file, which does:
SET PATH=.\plugins;.\plugins\qt;%PATH%
cd Appfolder
start myapp
This was an ugly quick fix, which I did not have the time to replace with something better, yet.
If application runs and shows blank screen then that usually indicates two things :
All the dependencies (dlls) are probably present and detected properly.
Most probably whats missing is the presence of qml files at the correct location.
In your main.cpp check the path of qml file which you would have given, and see if relatively that folder is present at the same location corresponding to your executable.
Also, instead of running the executable by double clicking, run it through the command line. It might print some messages if it is not able to locate some images/files/other dependencies etc according to the specified paths.
Edit 1 :
Add this flag in the .pro file :
CONFIG += console
It will give the exact debug message in a console once you run the application.

Why Files misteriously disappear from xcode with this strange symptom?

I use time machine and drop box to synchronize stuffs.
Recently I found that some files are gone.
However, the project compiles just fine as if the file is there. My friend cannot compile though.
This is very frustating. I got to find the missing files and then restore it from time machine and then readd that to xcode. I don't even know what files are missing.
I used dropbox and time machine. Looks like file disappear, the file names becomes "red" in xcode for a while and then poof it's gone. Xcode automatically remove the files from the project. The project still compiles fine which is frustating. If the project doesn't compile, I will know ah this file is missing.
Looks like somehow xcode still have the file but doesn't show it. Files is not on finder either.
What could possibly be the explanation and how to fix that.
I have clean projects to make sure that my computer do not use cached files.
It still compile fines in my computer
The file is still missing in project navigator
My friends' computer that uses the EXACT same files (connected to drop box) cannot compile
For example, xcdatamodeld files are crucial. In my computer it still run fine without that file even though that file is obviously needed. Xcode behaves as if the file is there all along.
My friends' try to compile the project and crash.
Also there is a PNG file. In my computer it runs fine with the icons showing up. In my friends computer the icons doesn't show up at all.
For anyone who still have the problem, in my case Xcode6. It turns out somehow the "Show only files with source control status" and "Show recent file button" is enable. It located in the bottom of left sidebar.
This somehow happen after I update os to Yosemite.
Cheers
Go to the project navigator (top left folder symbol). Files that are not found by XCode are displayed in red. But since your project compiles fine, there should not be any that are required. Now click one of the "missing" files to activate it. Open the utility area on the right side, and show file inspector. Under "location" you find the full path of this file. Probably, your XCode project uses just references to these "missing" files that are stored somewhere else, and not in your project folder.
I had the same problem ..then I added the files explicitly into our project…which resulted into Duplicate Symbols error …we solved that by following….
In Your Project go to targets-
At the bottom Bar of your Targets there are three options..
1.Add Target
2. Validate Settings
3. Build RUle..
Click on validate Settings….it will ask for you to remove the Duplicated files from the project do it…ur project would run fine

How can I debug a working directory *.aspx.cs file when running the main project in ASP.NET (using Visual Studio (2010))?

Okay, first things first, I don't usually develop ASP.NET applications and nor do I regularly use Visual Studio. I'm not entirely sure if the title to this question makes a whole lot of sense, so let me try to expand a little:
I'm working for a client whose website is split into two projects. The main project and the working directory project within. The file I'm working on lays within the working directory project.
I only have access to the database which the main project runs from; not the database the working directory project requires - therefore, I can't simply run the working directory project. After copying the *.aspx file into the same location on the main project I'm able to get the page up and running by running the main project (which somehow includes the *.aspx.cs and *.aspx.resx.files from the working directory project).
I need to debug the *.aspx.cs file in the working directory project, but as the working directory project isn't running I can't simply add a breakpoint to it.
How can I debug the *.aspx.cs file included from the working directory when only able to run the main project?
Does the method in the main project you want to look at get called by a method in the section you can see? If so, you can "Step into" that method while in debug. Place a break point in Method A that calls Method B. Then, use "Step Into". I believe the shortcut is F8. Step into is used to follow the sequential steps of your method while stepping into every method/function that gets called.
I managed to debug this in the end by simply putting some invalid code in the working directory file. The running main solution then picked up on this invalid code and took me to the file (which is nowhere to be found in the project itself!). I was then able to debug as I needed.
Figured I'd leave this here for reference in case anyone else is having the same problem.

Resources