Subclass of QGraphicsView does not work

  • I have an application that I've added a sub-class of QGraphicsView for mouse drag/zoom.
    But now the program will not display images when installed on another computer.
    The previous version installer did work.
    Of course it works on the computer where I built it.
    Can you see something I'm missing?
    Did the sub-classing or the mouse activity require another DLL that I'm not pulling in with the installer?
    No errors. The images do not display.. And yes, I'm pulling in platform and imageformat plugins.
    The previous installer worked on other computers.
    Here's the program:

    As far as I know, Version 1.3 worked on other computers, but version 1.4 does not work for image display when installed on a "fresh" computer.


  • Moderators

    I tried to run it but after I opened it and pressed random button it crashed.

    From the structure of installed files I see that you have misplaced imageformats dir. It should be directly next to your executable (like platforms), not in a "plugins" sub-folder.

  • I tested on another machine with no Qt installed and it worked fine.
    All machines are Win 7 x64. Very strange. 1.3 and 1.4 don't work on one of the machines - for images only, silent failure. And work on 2 others just fine.

  • I tried copying the imageformats folder on the offending machine - copied imageformats dir to directly next to exe - and no joy. No change in behaviour.

    If you have a crash, please post your log file here. Find the log at:

    BTW, I'm not sure that pressing any random button will do anything useful. But please report which "Random Button" you pressed so I can fix any crash. The program is really not that hard to use.
    Woops... Found it.. Pressing the image selection buttons the first off will cause a crash. Shouldn't do that.
    Looks like we need a 1.5. Nothing to do with the problem we are discussing tho.


  • Moderators

    You can use "Dependency Walker": (in the profile mode!) on that machine to check on runtime if it loads images plugins.
    In any case they should be placed like I said. It must be something else.

    [off the main topic]
    As for the crash - the log has no info - it's just a "program start" and a date.
    But it's easily reproducible. Open the program and press "Previous image". That's it.
    Another thing is why does it display license text after the installation step? And why doesn't it cleanup after itself in the AppData when I uninstalled it? I don't like random programs leave stuff behind on my machine and I wouldn't even know about it if you haven't told me.

  • ok Bug fixes are up. Buttons no longer cause crashes before you choose a pair. Version 1.5.
    Thanks for the bug report.
    GTG - I remember dependency walker. But that issue usually causes an error on load. I'll check it when I get back from errand tho. Thanks again.

  • I just checked the program on the failing system with the Dependency Walker. Here are the results:
    Can someone help interpret this?
    Since the program does not fail, I suspect that these errors are spurious.
    BTW, an older program that displays images that was built with Qt4 works just fine on this system. This program was built with the newer Qt5 and does not work.
    I have tried to find any installations of Qt coding environment on this system and none are revealed.
    The only Qt DLLs that I can find are local to the two programs.
    There are no Qt paths in Path variables.
    Any other things that I should check?

  • Moderators

    Am I seeing right that you used 64bit Dependency Walker? It must be version with the same bitness as your program, otherwise it shows a lot of garbage and not all options are available (like profiling).
    Second thing is that I specifically suggested to run the Profile menu option. Plugins, like those for images, are linked at runtime, so they are not shown in your screenshots, which shows static links. When you run profiling it will display in the bottom window names and paths to the modules when they are actually loaded, not only those detected statically like QtCore etc. It should show a full path to the image plugin when it's loaded (it might happen only when you open an image).

  • Moderators

    Ok, I managed to reproduce the issue and I know what's wrong.

    The plugins you distribute somehow don't match the rest of the Qt. Are those from the same Qt installation? I copied imageplugins from the official 5.1.1 MinGW distro (sizes and dates were all different) to the <install_dir>\imageformats\ folder and it works.

  • [quote author="Chris Kawa" date="1394965515"]Ok, I managed to reproduce the issue and I know what's wrong.

    The plugins you distribute somehow don't match the rest of the Qt. Are those from the same Qt installation? I copied imageplugins from the official 5.1.1 MinGW distro (sizes and dates were all different) to the <install_dir>\imageformats\ folder and it works.[/quote]

    Please provide a link to the "Official 5.1.1 MinGW Distro" and I will check.
    This is apparently the one I installed: the only one marked Mingw48. I am using a distro called: qt-windows-opensource-5.1.1-mingw48_opengl-x86-offline downloaded on 10 Sep 2013
    Which sounds like an official Distro to me. Wonder why I would have different image plugins in my version. I'll check.


    • ww

  • Moderators

    I meant an online installer from "here":
    I don't know if and why offline package would differ.

    You mentioned that you updated the project from Qt4. Maybe you replaced all the core dlls but forgot to update image plugins?

  • I found an issue, but it does not help.
    In the kit I'm using for 5.1.1, there are two sets of imageformat plugins. One under QtCreator and a larger set under MinGW. The installer was supplying the smaller set. So I changed it to supply the larger set from MinGW subfolder. No change on my test system. Still doesn't work.

    The link you supply above, I found of course. But that's 5.2 not 5.1.1.
    I might try that, but I think I will want to install and test that on another system rather than just clobbering my current installation, which appears to be working. So are you saying that your fix was to use 5.2 disto plugins with my 5.1.1 binaries? Not clear that I would have guessed that would work.

    So we still don't have a fix for my 5.1.1 kit? And no clue about why only one of my Win7x64 systems has the problem? And yours? Like I said, two others of my systems worked fine with the current installer and the imageformat plugins from QtCreator.

  • Moderators

    No! Don't mix versions.

    Online installer is not for the newest version only. With it you can install several versions with a single Creator with configured kits for them.
    For example I have currently Qt 5.0.0-VS2012, 5.1.1-MinGW4.8, 5.2.1-MinGW4.8 and 5.2.1-VS2013 side by side.

    Don't use Qt dlls from the Qt Creator folder! Creator is a program compiled with a certain version of Qt that doesn't have to match the Qt version you're using in your own programs. I believe in the offline packages Creator is compiled with VS2010 which is totally incompatible with MinGW you're using for your program. That's why your package contains two sets of dlls. One is used by the Creator and the second you use with your program.

    You should only ever distribute dlls from the package you used to compile your program, not the ones creator was compiled with.

  • ok. Apparently Bad User on device.
    My program has another problem with image handling and I was interpreting it wrong.
    (1) The original, and now the other set of imageformat plugins, that are larger, also work. Future installers will use the larger set.
    (2) And the image plugins need to be in program/imageformats. The development system worked fine of course with them in program/plugins/imageformats. And part of the confusion is that PNG is apparently built in so no plugin is required.

    So I'll work on my other problem, but this problem is solved.
    Thanks all.

  • Moderators

    Ok, I'll just try to reiterate and make it clearer because I fear you're a little lost and trying to mix&match until it happens to work.

    You installed qt-windows-opensource-5.1.1-mingw48_opengl-x86-offline.
    I'll assume that you put it in something like C:\Qt.

    You now have the following structure:
    C:\Qt\5.1.1\mingw48_32 - this is the Qt package your program is using
    C:\Qt\Tools\QtCreator - this is the IDE directory, you have no business there
    C:\Qt\Tools\mingw48_32 - this is the compiler directory, also off limits to you

    Only ever distribute any dlls from the bin and plugins sub-dirs of the first dir listed above. Never ever anything else from anywhere else.
    Don't mix Qt core dlls with imageplugins from another just because "it works". Qt versions are to some degree binary compatible and it might by just that lucky for you but the only proper and sure way is to have all dlls from the same place.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.