How to remove QOpenGLContext::swapBuffers() called without corresponding makeCurrent() - qt

How can I stop this warning in Qt 5.4.1 in Debug/Release mode.
QOpenGLContext::swapBuffers() called without corresponding makeCurrent()
It only appears in debug mode, but release mode is fine with VS2010.
It appears in both modes (Debug & Release) with QtCreator.
I have tried so many ways to remove it but no success, searched google but couldn't find any useful info.
Plateform: Windows 8.1- VS2010- Qt_Creator Nvidia GTX 765
Thanks.

Serious answer: By filing a bug report with the Qt developers. Calling SwapBuffers on a drawable without a OpenGL context bound to it is perfectly fine. Actually SwapBuffers does not belong to the OpenGL context but to the window, so having that method placed in QGLContext is a big design failure itself.
Personal rant (in the hope some Qt devs are going to see it, eventually):
These guys (like every other toolkit developer community I got the impression) really need some summer school in how OpenGL works and what you should and should not do. I know of no toolkit that gets OpenGL context management right. If developing a toolkit wasn't such a huge amount of work I'd go "Fine, I'll develop my own GUI toolkit, with Blackjack and hookers…"

You should fix your code, instead of suppressing warning. You may show an SSCCE, if you want some hints from community.
But if you still want to suppress warnings, you need to follow Qt documentation

Related

Qt6 integration of 3dconnexion spacemouse devices

hope this finds you well.
I have been wondering if there are any updates regarding qt integration of the spacemouse sdk.
I found this old post https://forum.3dconnexion.com/viewtopic.php?f=19&t=4968 but all the source code files are not present anymore and I don't think I'm skilled enough to rewrite it given the information present in the forum (here's the updated link to the post https://www.codegardening.com/post/2011/2011-02-05-using-the-3dconnexion-mouse-with-a-qt-application/) and honestly it looks strange to me that Qt has not yet made any integration packages for 3d connexion devices.
I am using Visual Studio 16 on a Windows machine in a Qt6 VTK9.2 OpenCV project
I have tried the basic windows way using window handlers but I can't make it work (no input read) as soon as I pass the handler to the qMainWindow as HWND(mainWindow.winId()), while it works fine if I create a dedicated window to read the data.
Could you please give me some suggestions or point me to some resources?

Qt5 directshow plugin (dsengine.dll) is not built under Windows7

I’ve tried to build the directshow multimedia plugin in Qt5 under Windows7, however, there is a problem that qedit.h is not found, as this file was removed from WindowsSDK 7.1 (which is the one I am required to use to build Qt5).
So I tried to follow this post here.
Just adding this qedit.h (from what I see it just needs the IID_ISampleGrabber and CLSID_SampleGrabber and that’s it) and recompiling. It linked alright, but when I run my application, if I try to play video it just doesn’t do a damn thing, and if I try to access the camera it just quits the application right away. Since I have no idea about the inner workings of DS, I don’t know how legitimate this fix is.
How do I fix this?
Thanks.

Exceptions in Qt under Windows (mingw)

I'm writing an application that uses Qt, and I'd like to make it available to Windows users. I'm using mingw. I want to configure Qt with -exceptions as well as -static. Is this possible? I've found a post on a blog that states that static builds with mingw and exceptions will cause memory leaks:
http://blog.lugru.com/2010/04/static-qt-compilation-and-mingwm10-dll-mingw-confusion/
Some of my code throws exceptions, which should be handled in the GUI part of my code by displaying an error dialog (meaning: I don't want to remove all exceptions from my code).
I tried to build Qt with both -static and -exceptions and it didn't seem to work (I still got error messages about exceptions when I tried to compile my code). I won't rule out the possibility that I somehow messed that up, but if these options are mutually exclusive, it would be nice to know before I spend all day compiling Qt again. Thanks!

Adding Qt Sources to QtCreator 2.4.1

I am currently using QtCreator 2.4.1 with Qt 4.7.4 development libraries (in Ubuntu) and am trying to track down a bug which after profiling with valgrind seems to occur internally within QGraphicsView::paintEvent(…) method
To help isolate this problem I would like to step into the Qt sources. Having done some searching through both the Qt forums and stack overflow and have not being able to find a way to integrate the sources with my version of QtCreator.
I have currently tried downloading the sources via the QtSDK manager and adding a “Source Path Mapping” within Tools->Options->Debugger. I am sure that this step is where I am making a mistake as I am unable to even switch to source when viewing internal Qt header files i.e. from QGraphicsView.h
I have so far tried adding the following Source Path Mappings
Source Path=/var/tmp/qt-src
TargetPath=/home/paul/QtSDK/QtSources/4.7.4
and
Source Path=/var/tmp/qt-src
TargetPath=/home/paul/QtSDK/QtSources/4.7.4/src
Neither works.
I have also tried building Qt directly from source, adding this to my "Qt versions" list within Qt Creator and creating a new project configuration using this version. This also did not work.
Likewise I have tried adding the src folders to my gdbinit file. This also fails to work.
I am completely lost with this.
Paul
Someone asked a similar question here: Need to step into Qt sources (my IDE is Qt Creator).
Someone else asked about Valgrind errors with Qt here: Suppression files for Qt memory leaks with Valgrind
And here is a little more info about Using Valgrind with Qt Creator along with some explanation about how to read the results. Its a little dated from late 2010.
Related Suggestions
I wouldn't debug the QGraphicsView class just because of all the effort to make it work or find the problem might be for nothing... Qt is moving to using the SceneGraph as the backend for QML and the rendering engine for QGraphicsView might become obsolete.
Updating to the latest stable build of the Qt libraries may make a big difference for QGraphicsView.
If you post the valgrind error you are getting to the Qt Trolls, someone might be able to explain what is going on for you.
There are other debugging techniques besides the traditional debugger. I've been programming in Qt in Windows (without valgrind) and with a large multi-threaded application, that loads a bunch of Dll's. I've had to put some faith into the Object Tree Model clean up and work on all the new calls I put in. Most of the time I just use QDebug to find errors. Then I am also using a combination of qInstallMessageHandler() with QDebug to implement decent logging for the hard to track bugs.
See also Qt Debugging Techniques.

What should expericenced Unix programmer to be aware of using Microsoft Tools?

I come from UNIX world, I'm quite familiar with Linux, Solaris, Cygwin
and MinGW development. Recently I ported one of my
big projects (cppcms) to support MSVC,
including building static and dynamic libraries with CMake.
And I get all the time absolutely weird issues:
I had CMake build issues because Windows programming
lacks naming convention
for import and static libraries.
Now I discovered that I should use different versions of ICU (debug/release builds) according to the
actual build I do (Debug/RelWithDebInfo -- should use Debug ICU, Release release ICU) and so I should
change actual conventions for searching libraries according to debug/release mode only under MSVC.
Otherwise application just would not start giving a error on missing DLL.
I don't have any such issues under Mingw or Cygwin with GCC, Open Solaris with Sun Studio or Linux with gcc or intel compilers.
And I still have numerous wired issues and wired bugs and very strange behavior -- even some trivial things do not work
under MSVC builds, when everything works absolutely fine under Solaris/Linux/Cygwin/Mingw using GCC from 3.4 up to 4.4,
Sun Studio and Intel compilers). But not under MSVC.
To be honest, I have no idea how to deal with Last one! Because it looks like for me more like environment issues.
I know that the question is not really well defined. I think I'm quite experienced
developer and I know how to write portable and good C++ code. But using Microsoft native
tools drives me crazy with issues I just don't know how to solve.
Question: What should experienced Unix programmer with quite good base in Win32 API should know when it
starts using Genuine Microsoft Tools?
P.S.: Can someone explain why "Release With Debug Info" requires Debug version of MSVC runtime? And why there two versions of runtime exist at all?
P.P.S.: Please note I don't have issues with Win32 API, in fact Windows GCC build works absolutely fine.
Clarifications:
I'm looking for pitfalls that programmer that come from Unix world would may fall into.
For example, when moving from Linux to Solaris: make sure you compile code with -mt or
-pthreads when using multi threaded programs, linking with -lpthread is not enough.
P.S.: Can someone explain why "Release
With Debug Info" requires Debug
version of MSVC runtime?
It doesn't.
And why there
two versions of runtime exist at all?
Because the debug version does more error checking.
And I still have numerous wired issues
and wired bugs and very strange
behavior -- even some trivial things
do not work under MSVC builds,
* What am I doing wrong?
Not telling us what "wired issues and wired bugs and very strange behavior" you get.
* Where should I start?
By telling us the specific errors and problems you encounter.
* What do I miss?
Reading the documentation and learning the tools.
If your question is "What do I read to become a good Windows programmer?" then my answer is: Everything from Jeff Richter, as a start.
There is no magic bullet which will automatically make you an experienced Windows developer. Windows is a very different land compared to Unix. There are lots of quirks, weird behavior, and stuff which is just plain different. The only way to get out with your sanity intact is to tackle the transition one small problem at a time. Concentrate on a specific problem and try to understand the problem. Don't just "get it to work", but really understand what is happening. A good book about Windows programming will help.
There are huge amounts of Windows knowledge and experience accumulated in the SO community, but the only way to access it is to ask concrete questions about specific problems.
The release and debug versions of DLL's use different ways of allocating memory, that is why it is not advisable to mix release and debug versions. If you allocate something in a debug mode DLL and pass it back to the application which was compiled in release mode you may get into trouble.
In the case of your naming issues you may want to have different directories where you place your static / dll's. You can do do this in visual studio by using the configuration manager, not sure how it is under the express version.
I think you need to try and actually understand the new toolset rather than just try and squish it into your current understanding of your existing tools. For that, the best way, IMHO, is for you to try and start to use Visual Studio as Microsoft intended and then once you can build a simple project in the IDE you can move to building it using your preferred make system but do so with an understanding of how the IDE is using its make system to set things up for that build (which WILL work).
So, for example, for part 1 of your question you want to create a simple static library project and a simple dll project and look at the linker options tabs. Jump to the 'Command line' view and you'll see that a DLL uses the /OUT linker option to set the name and location of the dll file and the /LIB linker option to set the name and location of the import library. With a static library only the /OUT option is used and it indicates the name of the static lib. It's true that if you're building a static lib and a DLL from the same source and you have both the /LIB for the dll set to MyCrossPlatformCode.lib and /OUT set to MyCrossPlatformCode.dll then you may have problems if you also build a static lib with an /OUT switch of MyCrossPlatformCode.lib... Simply don't do that; either build the static libs to a different output directory (which is what OpenSSL does), or, better (IMHO), mangle the names somewhat so that you have MyCrossPlatformCode.lib/.dll and MyCrossPlatformCode_static.lib (which is what STLPort does).
Note that you might also want to mangle in (or account for) building with different versions of the Microsoft tool chain (so you might end up with stlport_vc8_x64d_static.5.1, perhaps).
An alternative approach, if you really can't face the thought of understanding your toolset, is that you could take a look at some of the popular open source systems that build quite fine on Windows and Unix systems; OpenSSL and STLPort for a start, perhaps.

Resources