From d242546aa6399bb61317c64bb7f0f1bdbbc1874c Mon Sep 17 00:00:00 2001 From: xavier Date: Sun, 9 Jan 2011 21:56:52 +0000 Subject: [PATCH] It is now possible to specify the font size of a title block template field using the "fontsize" attribute. git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/branches/0.3@1143 bfdf4180-ca20-0410-9c96-a3a8aa849046 --- sources/titleblockcell.h | 1 + sources/titleblocktemplate.cpp | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/sources/titleblockcell.h b/sources/titleblockcell.h index ffd2fd18b..fd512bf20 100644 --- a/sources/titleblockcell.h +++ b/sources/titleblockcell.h @@ -36,6 +36,7 @@ class TitleBlockCell { QString label; bool display_label; int alignment; + int font_size; QString logo_reference; }; #endif diff --git a/sources/titleblocktemplate.cpp b/sources/titleblocktemplate.cpp index 5baf05e41..5b6792df2 100644 --- a/sources/titleblocktemplate.cpp +++ b/sources/titleblocktemplate.cpp @@ -273,6 +273,12 @@ bool TitleBlockTemplate::loadCells(const QDomElement &xml_element) { if (cell_element.hasAttribute("displaylabel") && cell_element.attribute("displaylabel").compare("false", Qt::CaseInsensitive) == 0) { loaded_cell -> display_label = false; } + int fontsize; + if (QET::attributeIsAnInteger(cell_element, "fontsize", &fontsize)) { + loaded_cell -> font_size = fontsize; + } else { + loaded_cell -> font_size = -1; + } // horiwontal and vertical alignments loaded_cell -> alignment = 0; @@ -489,7 +495,6 @@ void TitleBlockTemplate::render(QPainter &painter, const DiagramContext &diagram // prepare the QPainter painter.setPen(Qt::black); painter.setBrush(Qt::white); - painter.setFont(QETApp::diagramTextsFont()); // draw the titleblock border painter.drawRect(QRect(0, 0, titleblock_width, titleblock_height)); @@ -520,6 +525,7 @@ void TitleBlockTemplate::render(QPainter &painter, const DiagramContext &diagram painter.drawPixmap(cell_rect, *(bitmap_logos_[cells_[i][j].logo_reference])); } } else { + painter.setFont(cells_[i][j].font_size == -1 ? QETApp::diagramTextsFont() : QETApp::diagramTextsFont(cells_[i][j].font_size)); painter.drawText(cell_rect, cells_[i][j].alignment, finalTextForCell(cells_[i][j], diagram_context)); }