Qt Deployment - QGraphicsView not displaying on other machines - c++

So I've been making a program for my company using Qt 4.8.4 (required). When deploying the project to a different machine, the program runs fine (I included Qtgui4.dll and Qtcore4.dll). However, when trying to view a print preview image using QGraphicsView, no other machine will show it. I even tried installing Qt 4.8.4 on the other machine and building it there to no avail. I use MSVC to compile and have installed Visual Studio on the new machine as well. I also include the imageformats folder when deploying the .exe to other machines.
I am at a loss here. I've researched this for days. I don't understand why it runs perfectly fine on my machine but will not run on others even when I replicate the development environment.
I have attached a picture of it actually working.
On all other machines, the preview image shows blank/white. However, I noticed that the image is built and that it will print. It just will not preview.
I know I haven't included any code but I won't be able to include much as it's for my company. But I have included what I could related to the QGraphicsView.
// Create a handle for the graphics view; fix bug where preview would disappear
// on first view; winId() creates the winId; Needed to initialize first
ui->graphicsView->winId();
/************************************/
if (preview)
preview(ui->graphicsView->winId(), &err);

No solution was found on my end. I finished the application with the stipulation that the OS could not be XP.

Related

Qt app starts on device where it was compiled, but not on others

I built a Qt 5.12 app on Ubuntu then moved it to another computer (the very same Ubuntu system) - and it gave me a "__cxa_throw_bad_array_new_length, version Qt_5" at start (and quit)...
When I try with a default Qt windowed starting project (one window, nothing else) and copy the executable to the other computer (where my app is failing), it works. So I think the problem is not in the project setup and the kit.
Very strange is that several weeks ago everything was fine. I don't have any idea what has changed since. I presume that there is a version conflict with a library, but I am not a linux pro and dont't know how to figure that out.
It would be great if any of you could help. :)

OpenGL code runs perfectly from IDE, CodeXL and GPU PerfStudio, but gives blank screen if started from Windows

I have been improving an OpenGL code of my own since some days, and now I got a terrible surprise: My code works properly if run from inside CodeBlocks IDE (by Menu-> Build -> Run), but if I open it from the Windows Explorer, the program will still open and issue messages on the console as if it would be running properly, but I just get a blank screen.
I have trying re-building the code to see if the problem disappears from Windows, or to see if it also affects the run from inside CodeBlocks, but the outcome is still the same.
Some days ago (before much of the code change), I could start the program from both Windows and CodeBlocks and run perfectly in both cases, so this is totally surprising for me now.
I use GLFW3 and GLEW and I am linking to the following libraries:
C:\msys64\mingw64\lib\libglew32.dll.a
C:\msys64\mingw64\lib\libglfw3.a
opengl32
C:\msys64\mingw64\lib\libsfml-system.dll.a (I use the clock of this library)
gdi32
On the meantime I have deinstalled and installed msys64, but this didnt affect my other OpenGL projects linking the same libraries, so I suppose this is not the source of the problem
How would I proceed to debug such an issue? I have no clue about how to start troubleshooting this, so any comment on what extra info I should post is welcome.
Update: If I open the application from the GPU PerfStudio and CodeXL, everything works just fine, but not when I open via Windows Explorer.
How would I proceed to debug such an issue?
When I deal with bugs like this I use a tool called CodeXL. You can download the latest version here. It automatically breaks on any OpenGL error and shows you which of your OpenGL function calls caused it.
It is free and it works also with non-AMD GPUs.
It should not take you long time to learn how to use it: you just create a new project, give it path to your project folder and .exe and hit run. (make sure that Debug->Breakpoints->Break on OpenGL error is checked)
//Moreover, it visualizes your buffers, shows you your loaded textures, etc.. Definitely check it if you plan to program more Windows+OpenGL in the future.

Exe is running fine when run with VisualStudio2008 (Release Build) but if I run from Folder directly It crash at only one button

I am using QT,ITK,VTK and build theses libraries in X64.
I am developing an application in X64 using VisualStudio2008 .
This application loading the Image data and also provide around 10 buttons for different functionality when I am running it into debug/Release mode from Visual Studio it works fine, But If I run it from Folder or after making setup by clicking on exe it run fine with all the the features except one that is crashing in mid of the process and it is very random crash .
sometime it crash, sometimes not with the same data and if crash then also not in specific location sometime at
VTKImageData->DeepCopy(data),
ITKConnectorType::Pointer ItkConnector= ITKConnectorType::New();
after displaying QT widget on mainwindow.
But all the other widget functionality are working fine.
Please Help me. Thanks in advance.

Deploying Qt Qml App to Windows shows me a blank window

After suffer with a lot of problems trying to deploy a Qt/Qml app to Windows 8, as I described in this question: Deploying Qt Qml app to Windows 8 shows me a blank window
I could make it work copying the Qt5Widgets.dll... but it was only working in my own development machine (installing it there, but yet my own machine).
Then I tried to install it in another machine (a VM running Windows 7).. and at first I got error of missing platform plugin... ok, I copied qwindows.dll to appDir/platforms, and it seems to resolved this problem.
But then I got another missing dlls errors (the ones related to VS2010), then I installed the Visual Studio 2010 redistributable package... ok, now the app starts, but with a blank window :(
The qml files and everything are in a resources file, so it should be in the binary.
And I've no idea where to go from there to find this issue.
Any idea what can I do? The weird thing is that it was installed fine in my own development machine.
And my conclusion is that deployment of Qt in OS X is much easier.
I've solved the problem with these steps:
check your qml files path. For example default generated code is the following:
QtQuick2ApplicationViewer viewer;
viewer.setMainQmlFile(QStringLiteral("qml/test/main.qml"));
So qmls should be in "qml/test" folder
check the missing dlls:
download VmMap tool from Windows Sysinternals suite (http://technet.microsoft.com/en-us/sysinternals/dd535533)
compile and run your app in qt creator to get it working like it should
run VmMap and open your running app's process.
sort the lower window by 'Details' - so you'll see all loaded DLLs sorted by path.
copy the missing dlls. It should work now!
I've had also a lot of trouble deploying Qml apps with a blank window too.
In general this site gives useful hints:
https://qt-project.org/doc/qt-5.1/qtdoc/deployment-windows.html
The blank window issue was caused be two different things in my case:
The relative path to the qml files were not correct. I've solved this by storing the qml files in a resource file and then calling them from there.
It seems to be a problem if the application is located on a network drive. I haven't found a solution for that except copying the application to a local folder.
In general I think deploying is a big big pain :-/

Phonon problem in Windows 7 with code compiled in XP

I have some code compiled using Visual Studio 2010 (C++), with Qt for the GUI and Phonon to show some videos.
I compile and run the code in a Windows XP machine and everything works fine. The videos and controls are shown correctly, and the same in other Windows XP machines. But at the moment that I try to use a Windows 7 machine, the video is not shown. Phonon controls are loaded, I can adjust the size of the Phonon VideoWidget but nothing is shown. I am using the SetFile method to indicate the file location and I have also tried (of course, with no luck) with setCurrentSource in the MediaObject (it works, though, in Windows XP).
I have tried different locations of files (absolute/relative) but nothing seems to work. Also, in XP when a video is not found an alert message is shown while in Windows 7 there is no error message, but also no video is shown. If I try to open the videos with other players, they work fine (I tried also with videos with different formats).
Any idea on what can be wrong? Is there something that I am missing with Phonon and Windows 7? Thanks!
When deploying your application to a different computer, make sure you don't forget to copy the Phonon backend. Not just the DLL contained in it (the ds backend for me), but also the directory itself.
That is
-Application Directory
¦-myexe.exe
¦-phonon_backend
¦-phonon_ds94.dll
Furthermore the Phonon backend on Windows (and Mac I think) makes use of the QtOpenGL module. So don't forget to copy this either. It can go inside the application directory.
In any case you could help yourself out a bit by adding a small bit of code that shows (perhaps writes to a file) which mimetypes are available. If it doesn't spit out anything, there is a problem with your backend. (Well, that of your application...)
This is what I had to do when I used Phonon to play video inside my application. Since I only quickly added this some time ago to my application, I'm not 100% sure that this is the only (or even the proper) way to do this, so anyone who has different insights feel free to comment on this.