Implemented variable substitution in simple print jobs.

This commit is contained in:
Jim Evins
2019-03-24 17:49:41 -04:00
parent dedbe07312
commit 37f0a8890d
34 changed files with 524 additions and 193 deletions
+12 -9
View File
@@ -518,7 +518,8 @@ namespace glabels
///
void ModelTextObject::drawShadow( QPainter* painter,
bool inEditor,
merge::Record* record ) const
merge::Record* record,
Variables* variables ) const
{
QColor textColor = mTextColorNode.color( record );
@@ -533,7 +534,7 @@ namespace glabels
}
else
{
drawText( painter, shadowColor, record );
drawText( painter, shadowColor, record, variables );
}
}
}
@@ -544,7 +545,8 @@ namespace glabels
///
void ModelTextObject::drawObject( QPainter* painter,
bool inEditor,
merge::Record* record ) const
merge::Record* record,
Variables* variables ) const
{
QColor textColor = mTextColorNode.color( record );
@@ -554,7 +556,7 @@ namespace glabels
}
else
{
drawText( painter, textColor, record );
drawText( painter, textColor, record, variables );
}
}
@@ -696,7 +698,8 @@ namespace glabels
void
ModelTextObject::drawText( QPainter* painter,
const QColor& color,
merge::Record* record ) const
merge::Record* record,
Variables* variables ) const
{
painter->save();
@@ -704,7 +707,7 @@ namespace glabels
QFont font;
font.setFamily( mFontFamily );
font.setPointSizeF( mTextAutoShrink ? autoShrinkFontSize( record ) : mFontSize );
font.setPointSizeF( mTextAutoShrink ? autoShrinkFontSize( record, variables ) : mFontSize );
font.setWeight( mFontWeight );
font.setItalic( mFontItalicFlag );
font.setUnderline( mFontUnderlineFlag );
@@ -716,7 +719,7 @@ namespace glabels
QFontMetricsF fontMetrics( font );
double dy = fontMetrics.lineSpacing() * mTextLineSpacing;
QTextDocument document( mText.expand( record ) );
QTextDocument document( mText.expand( record, variables ) );
QList<QTextLayout*> layouts;
@@ -790,7 +793,7 @@ namespace glabels
/// Determine auto shrink font size
///
double
ModelTextObject::autoShrinkFontSize( merge::Record* record ) const
ModelTextObject::autoShrinkFontSize( merge::Record* record, Variables* variables ) const
{
QFont font;
font.setFamily( mFontFamily );
@@ -802,7 +805,7 @@ namespace glabels
textOption.setAlignment( mTextHAlign );
textOption.setWrapMode( mTextWrapMode );
QTextDocument document( mText.expand( record ) );
QTextDocument document( mText.expand( record, variables ) );
double candidateSize = mFontSize;
while ( candidateSize > 1.0 )