Пантер к сожалению без изменений прежние ошибки
adish.cpp: In member function ‘void Adish::print(int)’:
adish.cpp:608: error: aggregate ‘QPrinter printer’ has incomplete type and cannot be defined
adish.cpp:609: error: incomplete type ‘QPrinter’ used in nested name specifier
adish.cpp:610: error: incomplete type ‘QPrinter’ used in nested name specifier
adish.cpp:612: error: incomplete type ‘QPrinter’ used in nested name specifier
adish.cpp:613: error: incomplete type ‘QPrinter’ used in nested name specifier
adish.cpp:617: error: ‘QPrintPreviewDialog’ was not declared in this scope
adish.cpp:617: error: expected `;' before ‘previewD’
adish.cpp:621: error: ‘previewD’ was not declared in this scope
adish.cpp:625: error: ‘previewD’ was not declared in this scope
adish.cpp:627: error: ‘previewD’ was not declared in this scope
adish.cpp: In member function ‘void Adish::preview1(QPrinter*)’:
adish.cpp:1203: error: no matching function for call to ‘QPainter::begin(QPrinter*&)’
вот мой код
в проекте
QT += xml \
sql \
gui \
core \
в заголовке
#include "QPainter"
#include <QtGui/QPrinter>
#include <QtGui/QPrintPreviewDialog>
в void
QPrinter printer;
printer.setOrientation(QPrinter::Portrait);
printer.setPageSize(QPrinter::A4);
printer.setPaperSize(QSize(210,297),QPrinter::Millimeter);
printer.setPageMargins(15,10,0,0,QPrinter::Millimeter);
QPrintPreviewDialog previewD( &printer, this);
if(a==0)
{
connect( &previewD, SIGNAL(paintRequested(QPrinter *) ), SLOT(preview(QPrinter *)));
}
if(a==1)
{
connect( &previewD, SIGNAL(paintRequested(QPrinter *) ), SLOT(preview1(QPrinter *)));
}
previewD.showMaximized();
previewD.setWindowState(Qt::WindowMaximized);
previewD.setWindowTitle("Предпросмотр");
previewD.exec();