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

void Kanagram::drawSwitcher ( QPainter &  p,
const int  xMargin,
const int  yMargin 
) [private]

draw the name of the current vocabulary and the arrow icon

ppainter to use to draw
xMarginx margin inside of the blackboard rect
yMarginy margin inside of the blackboard rect

Definition at line 499 of file kanagram.cpp.

References KanagramGame::getDocTitle(), innerRect(), m_arrowName, m_cornerFontSize, m_game, m_renderer, and m_xRatio.

Referenced by paintEvent().

    const int padding = 5;
    QString text = m_game->getDocTitle();
    QFont font = KGlobalSettings::generalFont();
    QFontMetrics fm(font);
    QRect r = innerRect(m_blackboardRect, xMargin, yMargin);
    r = r.normalized();
    r.translate(- padding - int(16.250 * m_xRatio), yMargin);
    r.setHeight(int(25.0 * m_yRatio));
    m_switcherRect = p.boundingRect(r, Qt::AlignVCenter|Qt::AlignRight, text);
    QString arrow = m_arrowName;
    if (m_overSwitcher)
        arrow = m_arrowName + "_hover";
    p.translate(m_switcherRect.right() + padding, m_switcherRect.top());
    p.scale(16.250 / kWindowWidth, 25.0 / kWindowHeight);
    m_renderer->render(&p, arrow);

    m_switcherRect.translate(0, -2);
    p.drawText(m_switcherRect, Qt::AlignVCenter|Qt::AlignRight, 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