Messed Up Layout in Deployed Qt Application on Windows 10 - qt

When I launch my deployed application from the .exe file the layout is messed up. When I launch the app from Qt Creator, the layout is fine.
Here are the details about how I deployed my app. I am using Qt 5.5 and MinGW 32 bit 4.9.2. I am running Windows 10.
First in Qt Creator I built for release.
Next, I opened the Qt 5.5 for Desktop (MinGW 4.9.2 32 bit) console.
I navigated to my project folder and ran
windeployqt.exe --release ./APPNAME.exe
It copied all the necessary .dll and created some folders as expected.
Now when I run the app, it seems to work just fine. But the layouts are all wrong. Again, when launching the app from Qt Creator it looks great! Proper spacing and sizing of my widgets. When I launch the .exe every thing is smooshed, the ratios of my sliders are all wrong, and some text is hidden because of crowding.
What could cause this bad layout? Am I missing some dependency somehow?

I figured out my own question. The issue was not my build or my layout but that many sizePolicy parameters don't seem to take effect when launching the app from QtCreator. Not 100% sure on the explanation but I think that when launching the .exe the OS is managing interpreting some of those size policy parameters and it does it differently (perhaps more strictly it appears) than QtCreator does. (To be clear I'm not talking about how the app looks in the Design tab. I'm actually talking about launching the app from within QtCreator)
So to fix the appearance of the app I have to play around with the size policies and parameters, build, and then launch the app from the executable.

Related

How to run javafx with maven desktop application from a jar file outside Netbeans 11 on my laptop or another ones?

I am working on Netbeans apache 11.1. I developed so many desktop programs using java and could run them almost on any computer. But when I moved to JavaFX technology with maven I wanted to redevelop almost the same desktop apps using JavaFX, and everything worked fine into Netbeans 11.1. The problem is when I want to jar my apps and distribute them outside of Netbeans they actually do not work.
I tried everything I did in the past (which worked just fine) for instance: adding Class-Path and setting Main-Class to manifest but still does not work. I searched through a lot of forums and sites but still cannot run my app outside of Netbeans.
My code is as any code combination of JavaFX, Maven, CSS, and FXML. Everything works just fine into Netbeans. The problem is outside of it.
Although I've added openjfx-12.0.2_windows-x64_bin-sdk to windows environment path, when I attempted to run jar that's been generated by Netbeans using cmd I just get this ERROR: javafx runtime components are missing, and are required to run this application. ANY HELP PLEASE?
I don't know if I'm understanding your problem right (if not I'm sorry).
Runnable JAR JavaFX
What once helped me, was create a new run configuration (in intellij) with the main class and the JRE. After that I created a Run Maven Goal with the command line
assembly:single

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......

How can I compile Qt app in Linux using Windows style?

I'm developing a Qt Widgets application and due to compile performance issues, I started developing it in Linux Ubuntu instead of Windows. The problems is that, when compiled and run, the app appears with traditional Ubuntu style instead of Windows (7) style. Since the app is only for Windows, I'ld like to know how can I compile it inside Linux Ubuntu but making it appear with Windows style.
I tried using QApplication::setStyle(QStyleFactory::create("QWindowsStyle")); in main.cpp, without success. I guess the QtAssistant docs just aren't clear enough on how can I do this change. Any help will be appreciated.
Could you by any chance be using a Qt package that is compiled without the style? Can you try running QStyleFactory::keys() to verify that the style exists?
It can't be done, since the style's elements are rendered by Windows (or OS X), not by Qt. Qt's style implementation asks the OS libraries to provide bitmaps of those elements. If you wanted to, you could modify the style to use a disk cache for static items. You could then use the style on all platforms. The problem is that these OS-provided bitmaps are a part of the OS and thus non-redistributable.
The only plastform-specific style that at least used to be available everywhere was the old Windows 95 style, in times of Qt 3. I'm not sure what its current status is.
First check out put of QStyleFactory::keys()
then set the look by calling
qApp->setStyle("Windows");
This command will give you windows 98 look. If you want windows vista look you should configure qt sources with -style-windowsvista and rebuild all sources.
UPDATE
according to http://doc.qt.io/qt-5/qstylefactory.html#details qt style is not platform independent. So IT IS IMPOSSIBLE to have that native look in not windows platform. It's worth mentioning that in windows also Windows SDK itself is required in order to build sources of Qt otherwise your application will look like windows 98 in windows 7.

Netbeans Platform Installer and JOGL

I'm trying to build an application that uses both Netbeans Platform and JOGL. So far, it runs fine from within Netbeans, but once I try to create an application that can run externally, I get some problems. The application will start (judging from the splash screen), but a window never displays, and I never get an error message. As soon as I remove the JOGL module (leaving only straight Swing code), everything works fine.
Project Setup:
1 Library Module for JOGL, including the dll's (for Windows 7 64 bit only), in the library/modules/lib folder
1 Module for a window displaying a GLJPanel, rendering a simple image with an animator
1 Module with a simple form in Swing
Has anybody seen this before?
Edit: apparently the trick in this case (using native libs when building Netbeans Platform executables) is placing the native libs in the project's root folder.
If this were not about netbean platform executables, a more generic comment is to make sure the native libs (dlls) are picked up correctly. Try adding the
-Djava.library.path=/path/to/libs option when you run it.

After deploying Qt app with macdeployqt (Qt 4.7.3) the app is broken

Until now deploying my Application with macdeployqt worked fine, but after upgrading to Qt 4.7.3 (Mac Qt SDK 1.1 Release Candidate) my program is broken after the deployment. This are the issues:
all icons and resource images are gone (do not show up in the toolbar)
windows don't open anymore
Cmd+Q does not quit the app
What buzzes me is that i don't understand what causes all these problems, since macdeployqt simply copies the frameworks (QtGui, QtCore, QtSql, QtNetwork in my case) into the app bundle and rewrites the links of the binary and the deployed frameworks by using otool and install_name_tool. All icons and images are compiled into the binary, so the only thing i can think of is that rewriting the links (stored as strings?) overwrites data in the data section of the binary and/or code section.
What can I do to make macdeployqt work again?
EDIT: This problem also appears in a very simple test app with just one tool button that contains an icon. After macdeployqt this icon is not visible anymore.
EDIT: If would be helpful to know if anyone can reproduce the problem.
The macdeployqt-version that comes shipped with QtSDK seems to be broken.
Remove QtSDK and install the libraries from the framework-only version (http://qt.nokia.com/downloads/qt-for-open-source-cpp-development-on-mac-os-x). The macdeployqt included there should work.
A bug regarding this problem is already filed for that in the Qt-Bugtracker -> http://bugreports.qt-project.org/browse/QTBUG-17959

Resources