QCustomPlot Discussion and Comments

QPrinter No such file or dirReturn to overview

I just can't seem to get qcustomPlot to work in QT5.1.1
Always get the error message: "C1083:CAnnot open include file:'QPrinter': No such file or directory"
I have read multiple threads on the issue and tried the followings:

Instead of using #include <QPrinter> use <QtPrintSupport\qprinter.h>

add QT += printsupport to .pro

I am pretty sure I have tried everything that has been recommended in this and other forums. You're my last chance. Please help me.

So finally I figured out how to handle it. I simply downgraded to QT 5.0.0

This is very strange, since some people report problems with Qt5.1 and some report success. I have nevertheless decided to remove the Qt5.1 compatibility tag in the download section. Full Qt5.1 compatibility will thus return with the next QCustomPlot version (1.1.0), which gets rid of the need for the deprecated macros.

This works for me:

Add to .pro:
QT += printsupport

Found the solution here:

from the link by Skerved: http://qt-project.org/wiki/Transition_from_Qt_4.x_to_Qt5
QPrinter Doesn’t Work
If your code has the following lines:

#include <QPrinter>
#include <QPrintDialog>
add the following to your project file:
QT += printsupport
Again, sometimes it may not work and you would need to be explicit:
#include <QtPrintSupport/QPrinter>
#include <QtPrintSupport/QPrintDialog>
#include <QtPrintSupport/QPrinter> This works for me.

On Windows 7 32 bit, msvc2012, Qt 5.1.1 AND also Qt 5.2.0
The following changes

in MyProject.pro add the line

greaterThan(QT_MAJOR_VERSION, 4): QT += printsupport

in qcustomplot.h

#  include <qnumeric.h>
#  include <QPrinter>
#  include <QtNumeric>
#  include <QtPrintSupport/QPrinter>
#  include <QtPrintSupport/QPrintDialog>

..did work. But before I manually cleaned the entire build directory, I was getting link errors. In general, it seems Qt is not very good at cleaning its build directories. Also works if you're careful not to do a build until AFTER you've added printsupport to the project file.