C++ (Qt)
QPainter painter(this);
QRect mRect(painter.viewport());
painter.setBrush(Qt::white);
painter.setPen(QPen(Qt::green,3,Qt::DashDotDotLine));
painter.drawRect(mRect);
painter.drawLine(0,0,mRect.width(),mRect.height());
painter.drawLine(mRect.width(),0,0,mRect.height());
painter.setBrush(Qt::NoBrush);
painter.setPen(QPen(Qt::blue,3));
painter.drawEllipse(mRect);
painter.setPen(Qt::black);
painter.setFont(QFont("Arial Black",20,QFont::Normal));
painter.drawText(mRect,Qt::AlignCenter,"Printer Draw Test");
вот есть такой код, но после нажатия на печать в диалоге, выводит сообщение:
"QPainter::begin: Paint device returned engine == 0, type: 1
QPainter::viewport: Painter not active
QPainter::setBrush: Painter not active
QPainter::setPen: Painter not active"