I have a Qt application which utilizes SQLite as a database. In the Qt Creator environment all my queries are executing perfectly and everything is fine but when i run the executable in my project folder no query is executing and i receive an error "No query,unable to fetch row". My database is open so i don't know what the issue is. Is there a reason for this?
You should place your SQLite database file alongside your executable. Also:
On Windows:
Place QtSql4.dll alonside your executable
place qsqlite4.dll in a folder named "sqldrivers" beside your
executable
These dll files are in your installed Qt Directory in bin folder.
On Linux:
Place libQtSql.so.4 alonside your executable
place libqsqlite.so in a folder named "sqldrivers" beside your
executable
These so files are in your installed Qt Directory in lib folder or in director "/usr/lib/i386-linux-gnu".
Related
Currently I have to manually copy the platforms and imageformats plugin folders to the directory containing the .exe that MSVC compiled. This is very tedious as the output folders often get deleted if you're working on your CMakeLists.txt or changing compilation target.
Now qt_generate_deploy_app_script seems like an official Qt solution to solve this problem, but it does not work.
I have added the CMake bits to my CMakeLists.txt as stated
qt_generate_deploy_app_script(
TARGET HiveWE
FILENAME_VARIABLE deploy_script
NO_UNSUPPORTED_PLATFORM_ERROR
)
install(SCRIPT ${deploy_script})
I can see some generated deploy scripts appear under build\x64-RelWithDebInfo\.qt, but they do not seem to be run as no DLL folders get copied to where my .exe is.
Am I misinterpreting what qt_generate_deploy_app_script should do or is it simply broken?
If you want to Creat exe in windows From Qt project you should use windeployqt
To Deploy and create Exe output with QT in windows you should follow this way:
put your compiler path in your system path. for example, if you use mingw81_64, you should set it. something like Qt/tools/mingw81_64/bin
copy exe file that provides after building in release mode in one
folder and run mingw81_64 cmd (it has separate cmd) and cd to that
folder path
windeployqt app.exe
you are using Cmake So first create one release output and then use step 3.
This command will get all dll needs for your app and your exe will work .
if you use qml
windeployqt --qmldir (the path of its directory ) app.exe
and also see these youtube videos for more info:
https://www.youtube.com/watch?v=LdSTgR0xJco
https://www.youtube.com/watch?v=hCXAgB6y8eA
Actually, I'm trying to add new language to Streama Media Server. I downloaded source code, added new language file (as guided here). After that, I want to build a jar with that project, I build it with IntelliJ Idea 2021.1 (here is how I did). So, When I run that jar file (in Ubunt 20.04), it fails and gives this error: Screenshot
When you have made adjustments to the source code, it is likely that you will want to create a new .jar file and deploy it on your server. For this, you can use a simple command:
# for unix based systems
**./gradlew assemble**
# for windows
**./gradlew.bat assemble**
This will create 2 new .jar files under build/libs,
streama-{version}.jar
streama-{version}.jar.original
all you will need is the streama-{version}.jar.
This file is an executable, so you can just copy it into your deployment directory / your server and start it as usual.
Using Qt Creator IDE and C++ code I created an app and put the file Qt_Calculator.exe into a folder named Result on my Windows desktop. I used Qt Installer Framework 2.01 to make an installer for my app.
I used a CMD command as below:
C:\Users\Abbasi\Desktop\package_directory\packages\com.vendor.product\data>
C:\Qt\QtIFW2.0.1\bin\binarycreator.exe -c
C:\Users\Abbasi\Desktop\package_directory\config\config.xml -p
C:\Users\Abbasi\Desktop\package_directory\packages
C:\Users\Abbasi\Desktop\Result\Qt_Calculator.exe
I have a package_directory folder that contains this.
The config folder has a config.xml that contains this.
The packages folder has a com.vendor.product folder that in turn it also has two folders, data and meta. The data folder contains this.
The meta folder has four files: installscript.qs, License.txt, package.xml and pageform.ui
The package.xml contains this.
And installscript.qs this.
By installscript.qs I want to create an installer so that it can be installed in C:\ProgramFiles folder and creates a shortcut of the app on my desktop.
It doesn't work well and I should change the code inside installscript.qs but don't know what code should be added/removed so that the installer works that way.
Have you ever used Qt Installer Framework to create an installer?
Thanks in advance.
sometimes when I rename the path to a qt project, it cannot be run even though I clean qmake and rebuild it!!! the path does not contain any space. and the project is completely correct and I know that the error is for path renaming , for example when I rename :
D:/abd/projects/LAND_2/Land_QT/...
to
D:/abd/projects/LAND_2/Land2_QT_SA/...
it cannot be build and says that some include file is missing(but the file is there!).
what is the problem?
I work with dynamic qt5.2 on windows 7.
Edit:
when I copy the project folder to a new directory( a path upper than current path) then the project can be build and run.
When you rename the path to the project, go to the project folder and delete the file with .pro.user extension. Open the project and Qt will ask you to configure the project. Choose the required kit, build and run the project.It should build successfully now
If you have changed path multiple times the .pro.user file is created multiple times delete all files with this extension and compile
i wrote a program in Qt-Creator 1.3.1 and Qt 4.6.2
and realy dont figure out how to create a simple .exe file for the program i just wrote...
i rather do it with the Qt-Creator if it's possible
In Qt Creator, when you build (Ctrl+B) your project, it always creates a .exe that is executed when you run the app from Qt Creator (Ctrl+R or the big play button).
If you want to find this .exe, you should look in the folder where your .pro (the project file) is located in the folder debug (or release depending on your build configuration).
#Live is right. See in release or debug dir. But if you move the .exe and want to execute you will get notofications about DLL's that miss. You can find them from yout Qt installation dir. Put next to your exe file all required DLL's and you're done! The DLL files will tell your your exe file while you execute it!