本文整理汇总了C++中InlineTextBox::baseline方法的典型用法代码示例。如果您正苦于以下问题:C++ InlineTextBox::baseline方法的具体用法?C++ InlineTextBox::baseline怎么用?C++ InlineTextBox::baseline使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类InlineTextBox
的用法示例。
在下文中一共展示了InlineTextBox::baseline方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: caretPos
void RenderText::caretPos(int offset, int flags, int &_x, int &_y, int &width, int &height)
{
if (!m_lines.count()) {
_x = _y = height = -1;
width = 1;
return;
}
int pos;
InlineTextBox * s = findInlineTextBox( offset, pos, true );
RenderText *t = s->renderText();
// kdDebug(6040) << "offset="<<offset << " pos="<<pos << endl;
const QFontMetrics &fm = t->metrics( s->m_firstLine );
height = fm.height(); // s->m_height;
_x = s->m_x + s->widthFromStart(pos);
_y = s->m_y + s->baseline() - fm.ascent();
width = 1;
if (flags & CFOverride) {
width = offset < maxOffset() ? fm.width(str->s[offset]) : 1;
}/*end if*/
#if 0
kdDebug(6040) << "_x="<<_x << " s->m_x="<<s->m_x
<< " s->m_start"<<s->m_start
<< " s->m_len" << s->m_len << " _y=" << _y << endl;
#endif
int absx, absy;
if (absolutePosition(absx,absy))
{
//kdDebug(6040) << "absx=" << absx << " absy=" << absy << endl;
_x += absx;
_y += absy;
} else {
// we don't know our absolute position, and there is no point returning
// just a relative one
_x = _y = -1;
}
}