Qt build for Wince works, but no plugins or import work - qt

I've got Qt build for a CE 6 custom sdk. I can use VS2005 and a KITL connection and run several of the Qt examples successfully on the device. I can also run examples if I copy all of the Qt dll's into a directory with the .exe on a USB drive and attach it to the device.
However, it seems that anything that uses QTDIR to find the location doesn't work (plugins and QML imports). I was able to get some QML examples to work if I included the qml in the project as a resource file.
Nothing I've tried works (including copying the plugins/imports to a directory with the dlls). I can't set QTDIR, as wince doesn't have environment settings.
I was able to get a little further with a static build vs. shared, but I believe that "nice stuff" like QtWebkit and QtMobility won't be available for static builds.
Is there some secret to deployment on wince that I'm missing?

Tracked it down. In src/corelib/io/qfilesystemiterator_win.cpp there is a code chunk:
if (QSysInfo::windowsVersion() >= QSysInfo::WV_WINDOWS7) {
dwAdditionalFlags = 2; // FIND_FIRST_EX_LARGE_FETCH
infoLevel = 1 ; // FindExInfoBasic;
}
The enums for windowsVersion for wince (6.0) are different, causing this to trigger as true instead of false. Wrapping the above code in
#ifndef Q_OS_WINCE
...
#endif
fixes the problem.
Note, I found a git repo for Windows Embedded Compact 7 patches that (as of 4.8.0) is not included in Qt. This fix is one of the changes. Check out https://qt.gitorious.org/qt/jaanttils-qt/graph/WEC7_Patches if you are working on 4.8 and wince (even CE 6). I needed a handful of changes on top, but I think they were specific to the sdk I'm using.

Related

Qt error with reMarkable tablet app

I have a reMarkable tablet , which I mostly love except for the lack of linux support (surprising given it is a linux-based OS). However, I've managed to find a version of a linux application that is now unofficial. This github is actually a Qt docker app, but if you look in the code for the 'Dockerfile' you can find where to download the app, which is apparently still on the server even though there's not a link from the main web page. Anyway, I downloaded it and got it mostly working, figuring out a few dependencies based on same Dockerfile code. But, I can't seem to get file dialogs to work, which is the main reason for using the app.
The error I get is:
ERROR: No native FileDialog implementation available.
Qt Labs Platform requires Qt Widgets on this setup.
Add 'QT += widgets' to .pro and create QApplication in main().
I'm not a Qt developer, so I'm lost. I'd love to get this to work. Thanks.
In the .pro file of you project you should add this line QT += widgets
or just add widgets to the line with QT += ...
Qt can use native file dialogs on some platforms, and will fall back to its own implementation if none is available. But that requires that the application is built including the QtWidgets module, and using a QApplication.
If you don't have the source code of the app and a possiblity to rebuild it, there's no chance to fix this from a binary

Impossible to deploy Qt applications

I am having serious troubles in trying to deploy my new application built with Qt. The program runs fine when started from Qt Creator (all builds: debug, profile, release), but it crashes when started by double clicking on the .exe. An error dialog pops up with the following message:
?defaultTypeFor#QTimer##CA?AW4TimerType#Qt##H#Z could not be located
in the dynamic link library
C:\Users\SDT1\Documents\Scanner\Scanner_deploy\Scanner.exe
I am using Qt 5.8.0 and I am building the project with MSVC2015_64 bit. I am using windeployqt.exe from
C:\Qt\5.8\msvc2015_64\bin
to dinamically link the Qt libraries.
This problem started happening since I moved from the old connect syntax (with the macros SIGNAL and SLOT) to the new one with function pointers. I also started using QTimer::singleShot instead of QMetaObject::invokeMethod, and not surprising the error involves QTimer. However, the program works just fine from inside Qt Creator and I can't figure out where the issue is, since I am using windeployqt to get the right dlls.
Also, why my .exe is referred to as "dinamic link library" in the error message? It's an .exe!
Ok I solved the issue, but I'm still not sure what was going wrong: my Path variable was pointing to the folder of Qt version 5.7 (the only other version I have). I changed it to 5.8, rebooted and redeployed and it DIDN'T work. Then, I deleted the build folder, rebuilt and re-deployed and it DID work. So, the problem was with the build.
I don't know how this can happen. I changed back the Path to Qt 5.7 and rebooted to make some tests. The problem appeared again, but I don't understand how the Path affects the build. Despite having Qt 5.7 in the Path, in Qt Creator the Compile Output shows all the Qt stuff pointing to the 5.8 folder (qmake.exe, uic.exe, include folders, ...). There is no reference to version 5.7. Only jom.exe is not from the Qt 5.8 folder, since it is in the Qt Creator folder. Maybe it's it that loads something from Qt 5.7, by looking at the Path? Who knows......

Qt 5.1.0 has supported static compile ? How to?

From wiki we know
“Support for static Qt builds making it possible to address those use cases that cannot use dynamic linking”
I have tired adding CONFIG += static , but not gonna work .
How to compile code staticaly without compile the whole qt project ?
before Qt5.1.0 we all can compile the code statically after build the qt project
but this time ,qt 5.1.0 wiki said new features include “Support for static Qt”
You need to do a static build of Qt before you can build statically linked applications with it. You have to specify -static when you configure it prior to building. None of the existing pre-built packages supports static linking out of the box.
Keep in mind there is a restriction - you cannot use static linking in commercial applications unless you have a commercial license. But it is ok for testing purposes and open source stuff.
As far as I know this was always possible with Qt?!

Does Qt creator by default statically or dynamically link it's libraries?

I'm developing a closed source application and to do so in accordance with the LGPL I have to dynamically link Qt's libraries to my application. Does Qt do this by default or do I have to take steps to do so? If that's the case how would I go about doing it?
Qt uses dynamic linking by default.
You'll notice this immediately during deployment to a non-developer machine, because your code will not run without the Qt libraries.
If your concern is the LGPL, just be careful when compiling Qt itself. Most LGPL violations with Qt are not because of static linking (since dynamic is the default), but for compiling Qt with non-default parameters.
LGPL is not just that the library must be provided along your binaries, but also that you specify how your users can build themselves the LGPL part. If you compile Qt yourself and do not use the pre-compiled binaries from the website, you must document that part of your build configuration in your release!
As soon as you get something running on your program, start preparing a release version for a non-developer environment without Qt installed. Your program should fail as soon as you delete the DLLs that you must copy along your program (or whatever format your OS uses).
It does it by default, statically linking seems to be quite involved judging by the many questions on the site regarding it.

QPixmap image loading problem

Basically I am trying to load the image as a texture using QPixmap:
texture[T_WALL] = bindTexture(QPixmap(":/images/wall.png"), GL_TEXTURE_2D);
The code works on my development machine, but not in the vm / other pcs without QT. Initially I was using jpegs and just assumed that I messed up the plugins, but as I understand, no plugins are needed for png files so I have no idea where the problem is.
Results are the same when loading local files and using Qt resources.
I am deploying libgcc_s_dw2-1.ddl, mingwm10.dll, QtCore4.dll, QtGui4.dll, QtOpenGL4.dll. Do I need anything else?
Try adding an imageformats directory to your application directory and put qmng4.dll there. See my answer to the question Qt dll deployment on windows
If it still does not work, get the Sysinternals suite which contains dgbview.exe that allows you to watch qDebug messages (even for release builds).

Resources