[Qt-interest] Trouble with QPrintPreviewWidget
Marcelo Estanislau Geyer
estanisgeyer at hotmail.com
Tue Dec 9 16:26:21 CET 2008
Hi friends,
I'm having some difficulties with the QPrintPreviewWidget.
I'm trying to create some reports, but in different distributions (in
special, Fedora 9 and Kubuntu 8.10) preview the contents of the leaves
off the page and others do not come to occupy the entire page. Sending
a small sample code:
ReportTest.h:
#ifndef REPORTTEST_H
#define REPORTTEST_H
#include <QPrintPreviewWidget>
#include <QWidget>
#include <QPrinter>
#include <QPainter>
#include <QRect>
class ReportTest: public QWidget
{
Q_OBJECT
public:
ReportTest(QWidget *parent = 0);
QPrinter *printer;
private:
private slots:
void print(QPrinter *printer);
protected:
};
#endif
ReportTest.cpp:
#include "ReportTest.h"
ReportTest::ReportTest(QWidget *parent)
:QWidget(parent)
{
printer = new QPrinter;
printer->setOutputFormat(QPrinter::NativeFormat);
printer->setOrientation(QPrinter::Portrait);
printer->setPaperSize(QPrinter::A4);
printer->setFullPage(TRUE);
QPrintPreviewWidget *printPreview = new QPrintPreviewWidget(printer);
connect(printPreview, SIGNAL(paintRequested(QPrinter*)), this, SLOT(print(QPrinter*)));
printPreview->show();
printPreview->fitInView();
}
void ReportTest::print(QPrinter *printer)
{
QPainter painter(printer);
painter.setRenderHints(QPainter::Antialiasing |
QPainter::TextAntialiasing |
QPainter::SmoothPixmapTransform, true);
QRect rect(QPoint(30, 30), QSize(750, 30));
painter.drawRect(rect);
//printer->newPage();
}
The list support to send images? I have images in running this problem in kubuntu and fedora.Thanks,
Marcelo E. GeyerBrazil
_________________________________________________________________
Instale a Barra de Ferramentas com Desktop Search e ganhe EMOTICONS para o Messenger! É GRÁTIS!
http://www.msn.com.br/emoticonpack
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20081209/65adc33e/attachment.html
More information about the Qt-interest-old
mailing list