Logo Search packages:      
Sourcecode: kanagram version File versions  Download package

void Kanagram::drawTextNew ( QPainter &  p,
const QString &  text,
int  textAlign,
int  xMargin,
int  yMargin,
const QRect &  rect,
bool  highlight,
int  fontSize = 18 
) [private]

new method to draw text in a rectangle

Parameters:
ppainter to use
texttext string to draw
textAlignthe alignment to use for the text (Left, right, center)
xMarginthe margin in the x direction
yMarginthe margin in the y direction
rectthe bounding rectangle to draw the text inside of
highlightwhether or not to use the highlight color if true m_chalkHighlightColor is used, otherwise m_chalkColor is used
fontSizethe fontsize to use

Definition at line 758 of file kanagram.cpp.

References innerRect(), and m_fillColor.

Referenced by paintEvent().

{
    QRect r = innerRect(rect, xMargin, yMargin);
    QFont font = KGlobalSettings::generalFont();
    font.setPointSize(fontSize);
    font.setBold(true);
    p.setFont(font);

    const bool withMargin = false;
    if (withMargin)
    {
        p.fillRect(r, m_fillColor);
        p.setPen(QPen(Qt::black, 3));
        p.drawRoundRect(r.left(), r.top(), r.width(), r.height(), 15, 15);
    }

    if (highlight)
        p.setPen(m_chalkHighlightColor);
    else
        p.setPen(m_chalkColor);
    p.drawText(r, textAlign, text);
}

Here is the call graph for this function:

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index