Qt 4.8.6 VS2010 only works in Release Mode, needs QApplication before QPaintDevice for QWidget

  • Hello Qt Qomrades,

    Let me spin you a tale about the developer who tried to play God.

    I'm working on a project that requires use of some plotting functionality, and figured Qt and QCustomPlot would be a great addition. I worked on creating a "Qt Patch" that would only include the files needed for basic functionality of Qt and, moreover, exactly what QCustomPlot needed to operate-as the project already includes a wrapped version of Qt to push GUI. After some trial and error, consternation, and more than my fair share of swearing, I got to the point where my console would display the error:
    @QWidget: Must construct a QApplication before a QPaintDevice@

    while in Debug mode. On a whim (and after several days of that error message haunting my dreams) I flipped over to Release mode and glory glory hallelujah it compiled, ran, and showed me a plot. Like an idiot, I took this as the Deus Ex Machina it seemed like it was and pushed forward with my project. But now the dark times are upon me again-and I need NEED debug functionality.

    Here's my process:
    1.) Develop the code in QtCreator. Get the graph working there.
    2.) Take the functionality that allowed for my graph logic and render from QtC and move it into VS2010, aka my project. Move the moc_qcustomplot.cpp file as well. No ui_, .pro, or anything else come with, as the UI and such are handled locally, and I don't ever need to rebuild qcustomplot.cpp/.h
    3.) Render the graph, using the wrappers from my project:
    @Wrapper::Widget *pWidget = new Wrapper::Widget(this);
    /The below is part of my project's libraries, which returns a QWidget from its own Widget object/
    QWidget *pWid = new QWidget(pWidget->GetQWidget());
    customplot = new QCustomPlot(pWid);
    //Fiddly bits that use customplot to render my magnificent graphs@

    In release, this works. In debug, I get the aforementioned error. My true question is-are there qXXX_debug.h files somewhere? Am I missing something from my "QTPatch" file? Included is some relevant (and basically all of my) QT code inside my project as well as the list of my "QTPatch" included files, both .h and .lib files. I am unable to create a "new" qt project using the VSplugin or anything of the sort, and this has to be within the confines of my project's existing structure.

    Any help would be greatly appreciated and if you can get me set on the right path I will forever inscribe your name on the wall of my heart of hearts, as well as shout it from the rooftops and probably name a variable after you. A really important one. Perhaps a vector.


    /QTPatch means that I cut these out of Qt/4.8.6/src(or gui), and then put them in a new file in my project and redid the dependencies so they linked to each other properly. this was done for QCustomPlot functionality./
    o CoreLib
     Kernel
    • qobject.h
    • qobjectdefs.h
    • QCoreEvent.h
    • QPointer.h
    • Qmimedata.h
    • Qvariant.h
    • Qmetatype.h
    • Qmath.h
     Global
    • qnamespace.h
    • qglobal.h
    • qconfig.h
    • qfeatures.h
     Tools
    • Qstring
    • Qchar.h
    • Qbytearray.h
    • QScopedPointer.h
    • Qlist.h
    • Qiterator.h
    • Qalgorithms.h
    • Qmargins.h
    • Qrect.h
    • Qsize.h
    • Qpoint.h
    • Qpointf.h
    • QSharedPointer.h
    • Qshareddata.h
    • Qsharedpointer_impl.h
    • Qpair.h
    • Qstringlist.h
    • Qregexp.h
    • Qstringmatcher.h
    • Qline.h
    • Qmap.h
    • Qhash.h
    • Qset.h
    • Qdatetime.h
    • Qlocale.h
    • Qcontiguouscache.h
    • Qstack.h
    • Qcache.h
    • Qhash.h
    • qvector.h
     Thread
    • Qatomic.h
    • Qbasicatomic.h
     I/O
    • Qdatastream.h
    • qIODevice.h
    • qfile.h
    • qdebug.h
    • qtextstream.h
     Arch
    • Qatomic_arch.h
    • Qatomic_windows.h
    • Qatomic_x86_64.h
    o GUI
     Kernel
    • Qwidget.h
    • Qwindowdefs.h
    • Qpalette.h
    • Qsizepolicy.h
    • Qcursor.h
    • Qkeysequence.h
    • Qevent.h
    • Qmime.h
    • Qdrag.h
     Painting
    • Qpainter.h
    • Qtransform.h
    • Qpen.h
    • Qpaintdevice.h
    • Qregion.h
    • Qbrush.h
    • Qcolor.h
    • Qrgb.h
    • Qmatrix.h
    • Qpolygon.h
    • Qpainterpath.h
    • Qprinter.h
    • Qprintengine.h
    • Qprintengine_win.h
     Text
    • Qfont.h
    • Qfontmetrics.h
    • Qfontinfo.h
     Image
    • Qimage.h
    • QPixmap.h
     Math3d
    • Qvector2d.h@

Log in to reply

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