well, that was quick, I'v fixed it by painting to a bitmap, and painting the bitmap to the printer.
On Thu, Jul 17, 2014 at 9:43 PM, Tomaz Canabrava <[email protected]> wrote: > Look what I'v found https://bugreports.qt-project.org/browse/QTBUG-17422 > it seems that there is already a bug for it. > > On Thu, Jul 17, 2014 at 9:35 PM, Tomaz Canabrava <[email protected]> wrote: >> Some print related fixes. >> I'm trying to fix the thick lines, but without luck till now.
From 0ff194ec1abcf10c2a282ccd2f71d1ac7e7b7d6c Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava <[email protected]> Date: Thu, 17 Jul 2014 22:00:24 -0300 Subject: [PATCH 7/8] Bypass the PDF bug by painting on a QImage and paint the image to pdf well... we have a good and working printing system now. :) Signed-off-by: Tomaz Canabrava <[email protected]> --- qt-ui/printlayout.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/qt-ui/printlayout.cpp b/qt-ui/printlayout.cpp index 384a0ef..c8e1621 100644 --- a/qt-ui/printlayout.cpp +++ b/qt-ui/printlayout.cpp @@ -193,10 +193,14 @@ void PrintLayout::printProfileDives(int divesPerRow, int divesPerColumn) } QTransform origTransform = painter.transform(); + QImage image(scaledW, scaledH - tableH - padPT, QImage::Format_ARGB32); + QPainter imgPainter(&image); // draw a profile painter.translate((scaledW + padW) * col, (scaledH + padH) * row + yOffsetProfile); profile->plotDive(dive, true); // make sure the profile is actually redrawn - profile->render(&painter, QRect(0, 0, scaledW, scaledH - tableH - padPT)); + profile->render(&imgPainter, QRect(0, 0, scaledW, scaledH - tableH - padPT)); + imgPainter.end(); + painter.drawImage(image.rect(),image); painter.setTransform(origTransform); // draw a table -- 2.0.1
From 9376c651df28aa94dfad45f73c0bdb427c9d490c Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava <[email protected]> Date: Thu, 17 Jul 2014 22:01:11 -0300 Subject: [PATCH 8/8] Do not plot text twice for information. Well, the information was bad, it was being printed twice if the text is HTML, print only once. Signed-off-by: Tomaz Canabrava <[email protected]> --- qt-ui/modeldelegates.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/qt-ui/modeldelegates.cpp b/qt-ui/modeldelegates.cpp index 3fb8bea..a2c61e2 100644 --- a/qt-ui/modeldelegates.cpp +++ b/qt-ui/modeldelegates.cpp @@ -346,8 +346,7 @@ ProfilePrintDelegate::ProfilePrintDelegate(QObject *parent) : QStyledItemDelegat { } -/* this method overrides the default table drawing method and places grid lines only at certain rows and columns */ -void ProfilePrintDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const +static void paintRect(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) { const QRect rect(option.rect); const int row = index.row(); @@ -368,6 +367,12 @@ void ProfilePrintDelegate::paint(QPainter *painter, const QStyleOptionViewItem & painter->drawLine(rect.topRight(), rect.bottomRight()); } painter->restore(); +} + +/* this method overrides the default table drawing method and places grid lines only at certain rows and columns */ +void ProfilePrintDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const +{ + paintRect(painter, option, index); QStyledItemDelegate::paint(painter, option, index); } @@ -409,6 +414,7 @@ HTMLDelegate::HTMLDelegate(QObject *parent) : ProfilePrintDelegate(parent) void HTMLDelegate::paint(QPainter* painter, const QStyleOptionViewItem & option, const QModelIndex &index) const { + paintRect(painter, option, index); QStyleOptionViewItemV4 options = option; initStyleOption(&options, index); painter->save(); @@ -422,7 +428,6 @@ void HTMLDelegate::paint(QPainter* painter, const QStyleOptionViewItem & option, QRect clip(0, 0, options.rect.width(), options.rect.height()); doc.drawContents(painter, clip); painter->restore(); - ProfilePrintDelegate::paint(painter,option,index); } QSize HTMLDelegate::sizeHint ( const QStyleOptionViewItem & option, const QModelIndex & index ) const -- 2.0.1
_______________________________________________ subsurface mailing list [email protected] http://lists.hohndel.org/cgi-bin/mailman/listinfo/subsurface
