Qt5.1.1 drag and drop problem



  • I was trying to run the example in

    http://qt-project.org/faq/answer/how_can_i_do_drag_and_drop_in_a_widget

    The example runs properly and display the text content.

    However, if I change line 67 and 73 from
    qDebug("Contents: %s", de->mimeData()->text().toLatin1().data());
    into
    qDebug() << de->mimeData()->urls();
    and drag either a file from file explorer or a url from web browser, the program always hangs and displays about 15 lines of
    First-chance exception at 0x759DC41F (KernelBase.dll) in MyDialog.exe: 0x8007000E: Not enough storage is available to complete this operation.

    Could someone help solve this problem and display the urls in mime data properly?

    In fact, the demo "dropsite" in the Qt5.1.1 distribution does not work either. After I drag either a file from file explorer or a url from web browser and drop it to the dropsite program, it just shows "Cannot display data". Even if the "Format" column shows a long list including "text/uri-list", all "Content" columns are empty.

    For the environment, I have installed qt-windows-opensource-5.1.1-msvc2012-x86-offline.exe and qt-vs-addin-1.2.2-opensource.exe with VS 2012 Premium on Windows 7.

    Thanks.



  • Could someone help this? It is quite frustrating since the problem appears after we upgrade Qt for 4 to 5.


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Can you test it with the latest 5.2.0 ?



  • Thanks for the hint.

    I just installed 5.2.0 beta1. Still no luck and dropsite example does not work. All dropped items show empty Content column.


  • Lifetime Qt Champion

    What windows version are you on ?

    Just tested the faq example with Win7, 5.1.1 mingw edition and it's working fine. Could you also test that version to see whether it's a Visual Studio specific behavior ?



  • I am on Windows 7 x64 Enterprise SP1.

    Will try mingw edition and see how it goes. Thanks.



  • Tried mingw32 version of Qt5.2.0 beta1. Same problem. The dropsite example shows empty "Content" column.



  • I noticed during installation it failed to install vc redistribute sp1, probably because I already have sp4 in system. I am not sure if that caused this problem. This happened to both vs2012 and mingw versions.


  • Lifetime Qt Champion

    That might not help indeed. You should then build Qt with your current setup (qtbase would be enough for the test) to see if it behaves better.



  • It took a few hours to build Qt 5.1.1 from source. When I loaded it into VS2012, it always complains about OpenGL problem, even if I included "include/QtANGLE".

    error C2065: 'GL_RGBA8' : undeclared identifier c:\qt\qt5.1.1\qtbase\src\gui\opengl\qopenglframebufferobject.h
    error C2065: 'GL_RGBA8' : undeclared identifier c:\qt\qt5.1.1\qtbase\src\gui\opengl\qopenglframebufferobject.h
    error C2039: 'glClearDepth' : is not a member of 'global namespace'' c:\qt\qt5.1.1\qtbase\src\gui\opengl\qopenglfunctions.h error C3861: 'glClearDepth': identifier not found c:\qt\qt5.1.1\qtbase\src\gui\opengl\qopenglfunctions.h error C2039: 'glDepthRange' : is not a member of 'global namespace'' c:\qt\qt5.1.1\qtbase\src\gui\opengl\qopenglfunctions.h
    error C3861: 'glDepthRange': identifier not found c:\qt\qt5.1.1\qtbase\src\gui\opengl\qopenglfunctions.h

    When I built Qt from source, I used "-opengl desktop" option. And it seems outside VS2012, it did not complain OpenGL.



  • I also reinstall VS 2012 without SP. This time qt-windows-opensource-5.1.1-msvc2012-x86-offline.exe installs without any error messages. However, dropsite still does not work.

    Now I am wondering if drag and drop really works in 5.1.1 or not. :(



  • Have to roll back to Qt 4.8.1. Everything works. Too bad.


  • Lifetime Qt Champion

    What did you drop on the widget ? I've just tested the dropsite example again (still with MinGW) and dropped a couple of files on it and its working.



  • I dropped a file from file explorer. Also multiple files worked.

    Now I am wondering if there is some dll corrupted or incompatible with Qt in my Windows 7 system. Is there any way to ensure all dependent dlls have proper version?


  • Lifetime Qt Champion

    You can try Dependency Walker on your executable. If it can find Qt libraries it means that there's a set of them on your system in your PATH that might be interfering



  • Thank for the tip!

    Finally I found out my firewall blocks some access permission of the compiled binaries. After adding the binaries into exception list, it works fine if I compiled using command line tools (qmake, jom).

    The version I am using now is

    • qt-windows-opensource-5.1.1-msvc2012_opengl-x86_64-offline.exe
    • qt-vs-addin-1.2.2-opensource.exe.

    I assume I should not use QtANGLE lib. In VS2012, I tried to remove preprocessor definition "QT_OPENGL_ES_2" and "QT_OPENGL_ES_2_ANGLE", and compile the code. Now I got error:

    LNK1104: cannot open file 'libEGLd.lib'

    Could you give some hint how I can solve this problem? I tried to search the forum, but no luck.



  • Also according to makespecs/win32-msvc2012/qmake.conf, the error message means QMAKE_LIBS_OPENGL_ES2_DEBUG was used for linking. However, I would expect QMAKE_LIBS_OPENGL should be used.


  • Lifetime Qt Champion

    Indeed, there might be a packaging or naming issue, did you try the angle package ?



  • There is no include/QtANGLE directory in the installed directory. Could you let me know how I can try angle package?



  • BTW, I did see GL lib files defined by QMAKE_LIBS_OPENGL under C:\Program Files (x86)\Windows Kits\8.0\Lib\win8\um\x86 and C:\Program Files (x86)\Windows Kits\8.0\Lib\win8\um\x64. Not sure how I can force to link against QMAKE_LIBS_OPENGL.

    QMAKE_LIBS_OPENGL = glu32.lib opengl32.lib gdi32.lib user32.lib


  • Lifetime Qt Champion

    Are you sure you are using the OpenGL Qt version ? Did you uninstall the other versions before installing that one ?



  • Yes, I have uninstalled previous versions and even deleted the leftover directories.

    After installation, qt-windows-opensource-5.1.1-msvc2012-x86_64-offline.exe has QtANGLE directory, while qt-windows-opensource-5.1.1-msvc2012_opengl-x86_64-offline.exe hasn't.

    I assume qt-windows-opensource-5.1.1-msvc2012_opengl-x86_64-offline.exe is the OpenGL Qt version. And that is the one I installed.


  • Lifetime Qt Champion

    Indeed, if the name doesn't contain OpenGL it's an ANGLE build


Log in to reply
 

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