From 40bb3fe2c65949199de52dcc0dbb6fa87217ed09 Mon Sep 17 00:00:00 2001 From: scorpio810 Date: Tue, 24 Jan 2017 08:08:08 +0000 Subject: [PATCH] Improve dxf export for folio list git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4869 bfdf4180-ca20-0410-9c96-a3a8aa849046 --- sources/exportdialog.cpp | 51 +++++++++++++++++----------------------- 1 file changed, 22 insertions(+), 29 deletions(-) diff --git a/sources/exportdialog.cpp b/sources/exportdialog.cpp index 992034db2..1cc944317 100644 --- a/sources/exportdialog.cpp +++ b/sources/exportdialog.cpp @@ -423,10 +423,11 @@ void ExportDialog::generateDxf(Diagram *diagram, int width, int height, bool kee //QList list_ellipses; QList list_shapes; - DiagramFolioList *ptr; - if ((ptr = dynamic_cast(diagram))) { + DiagramFolioList *ptr = dynamic_cast(diagram); + if (ptr) { list_lines = ptr -> lines(); list_rectangles = ptr -> rectangles(); + QSettings settings; // fill the rows with text. QString authorTranslatable = tr("Auteur"); @@ -442,33 +443,25 @@ void ExportDialog::generateDxf(Diagram *diagram, int width, int height, bool kee fillRow(file_path, row_RectF, authorTranslatable, titleTranslatable, folioTranslatable, dateTranslatable); QList diagram_list = ptr -> project() -> diagrams(); - int startDiagram = (ptr -> getId()) * 58; + int startDiagram = (ptr -> getId()) *29; for (int i = startDiagram; i < startDiagram+29 && i < diagram_list.size(); ++i) { y0 += rowHeight; QRectF row_rect(x0, y0, list_rectangles[0] -> width(), rowHeight); + if (settings.value("genericpanel/folio", true).toBool()){ fillRow(file_path, row_rect, diagram_list[i] -> border_and_titleblock.author(), diagram_list[i] -> title(), - QString::number(diagram_list[i] ->folioIndex()+1), - diagram_list[i] -> border_and_titleblock.date().toString("dd/MM/yyyy")); - } - - x0 = list_rectangles[1] -> topLeft().x(); - y0 = list_rectangles[1] -> topLeft().y(); - rowHeight = (list_rectangles[1] -> height())/30; - QRectF row_RectF2(x0, y0, list_rectangles[1] -> width(), rowHeight); - fillRow(file_path, row_RectF2, authorTranslatable, titleTranslatable, folioTranslatable, dateTranslatable); - - startDiagram += 29; - - for (int i = startDiagram; i < startDiagram+29 && i < diagram_list.size(); ++i) { - y0 += rowHeight; - QRectF row_rect(x0, y0, list_rectangles[1] -> width(), rowHeight); - fillRow(file_path, row_rect, diagram_list[i] -> border_and_titleblock.author(), + diagram_list[i] -> border_and_titleblock.finalfolio(), + diagram_list[i] -> border_and_titleblock.date().toString("dd/MM/yy")); + + }else{ + fillRow(file_path, row_rect, diagram_list[i] -> border_and_titleblock.author(), diagram_list[i] -> title(), QString::number(diagram_list[i] ->folioIndex()+1), - diagram_list[i] -> border_and_titleblock.date().toString("dd/MM/yyyy")); + diagram_list[i] -> border_and_titleblock.date().toString("dd/MM/yy")); + } +} } else { // Determine les elements a "XMLiser" @@ -698,29 +691,29 @@ void ExportDialog::fillRow(QString file_path, const QRectF &row_rect, QString au y += height*0.2; Createdxf::drawTextAligned(file_path, folio, - x + 0.05*DiagramFolioList::colWidths[0]*row_rect.width()*Createdxf::xScale, y, height, 0, 0, 5, 0, + x + 0.02*DiagramFolioList::colWidths[0]*row_rect.width()*Createdxf::xScale, y, height, 0, 0, 5, 0, x + 0.95*DiagramFolioList::colWidths[0]*row_rect.width()*Createdxf::xScale, 0); x += DiagramFolioList::colWidths[0]*row_rect.width()*Createdxf::xScale; QString heading = tr("Titre"); if (title == heading) Createdxf::drawTextAligned(file_path, title, - x + 0.05*DiagramFolioList::colWidths[1]*row_rect.width()*Createdxf::xScale, y, height, 0, 0, 5, 0, - x + 0.95*DiagramFolioList::colWidths[1]*row_rect.width()*Createdxf::xScale, 0); + x + 0.02*DiagramFolioList::colWidths[1]*row_rect.width()*Createdxf::xScale, y, height, 0, 0, 5, 0, + x + 0.02*DiagramFolioList::colWidths[1]*row_rect.width()*Createdxf::xScale, 0); else Createdxf::drawTextAligned(file_path, title, - x + 0.05*DiagramFolioList::colWidths[1]*row_rect.width()*Createdxf::xScale, y, height, 0, 0, 5, 0, - x + 0.95*DiagramFolioList::colWidths[1]*row_rect.width()*Createdxf::xScale, 0, true); + x + 0.02*DiagramFolioList::colWidths[1]*row_rect.width()*Createdxf::xScale, y, height, 0, 0, 5, 0, + x + 0.02*DiagramFolioList::colWidths[1]*row_rect.width()*Createdxf::xScale, 0, true); x += DiagramFolioList::colWidths[1]*row_rect.width()*Createdxf::xScale; Createdxf::drawTextAligned(file_path, author, - x + 0.05*DiagramFolioList::colWidths[2]*row_rect.width()*Createdxf::xScale, y, height, 0, 0, 5, 0, - x + 0.95*DiagramFolioList::colWidths[2]*row_rect.width()*Createdxf::xScale, 0); + x + 0.02*DiagramFolioList::colWidths[2]*row_rect.width()*Createdxf::xScale, y, height, 0, 0, 5, 0, + x + 3.02*DiagramFolioList::colWidths[2]*row_rect.width()*Createdxf::xScale, 0); x += DiagramFolioList::colWidths[2]*row_rect.width()*Createdxf::xScale; Createdxf::drawTextAligned(file_path, date, - x + 0.05*DiagramFolioList::colWidths[3]*row_rect.width()*Createdxf::xScale, y, height, 0, 0, 5, 0, - x + 0.95*DiagramFolioList::colWidths[3]*row_rect.width()*Createdxf::xScale, 0); + x + 0.02*DiagramFolioList::colWidths[3]*row_rect.width()*Createdxf::xScale, y, height, 0, 0, 5, 0, + x + 5.02*DiagramFolioList::colWidths[3]*row_rect.width()*Createdxf::xScale, 0); } QPointF ExportDialog::rotation_transformed(qreal px, qreal py , qreal origin_x, qreal origin_y, qreal angle) {