当前位置: 首页>>代码示例>>C++>>正文


C++ InlineFlowBox::lastChild方法代码示例

本文整理汇总了C++中InlineFlowBox::lastChild方法的典型用法代码示例。如果您正苦于以下问题:C++ InlineFlowBox::lastChild方法的具体用法?C++ InlineFlowBox::lastChild怎么用?C++ InlineFlowBox::lastChild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在InlineFlowBox的用法示例。


在下文中一共展示了InlineFlowBox::lastChild方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: collectHorizontalBoxCoordinates

/**
 * Traverses the horizontal inline boxes and appends the point coordinates to
 * the given array.
 * @param box inline box
 * @param pointArray array collecting coordinates
 * @param bottom \c true, collect bottom coordinates, \c false, collect top
 * 	coordinates.
 * @param limit lower limit that an y-coordinate must at least reach. Note
 *	that limit designates the highest y-coordinate for \c bottom, and
 *	the lowest for !\c bottom.
 */
static void collectHorizontalBoxCoordinates(InlineBox *box, QValueVector< QPoint > &pointArray, bool bottom, int offset, int limit = -500000)
{
    //   kdDebug(6000) << "collectHorizontalBoxCoordinates: " << endl;
    offset = bottom ? offset : -offset;
    int y = box->yPos() + bottom * box->height() + offset;
    if(limit != -500000 && (bottom ? y < limit : y > limit))
        y = limit;
    int x = box->xPos() + bottom * box->width() + offset;
    QPoint newPnt(x, y);
    // Add intersection point if point-array not empty.
    if(!pointArray.isEmpty())
    {
        QPoint lastPnt = pointArray.back();
        QPoint insPnt(newPnt.x(), lastPnt.y());
        if(offset && ((bottom && lastPnt.y() > y) || (!bottom && lastPnt.y() < y)))
        {
            insPnt.rx() = lastPnt.x();
            insPnt.ry() = y;
        }
        //         kdDebug(6040) << "left: " << lastPnt << " == " << insPnt << ": " << (insPnt == lastPnt) << endl;
        appendPoint(pointArray, insPnt);
    }
    // Insert starting point of box
    appendPoint(pointArray, newPnt);

    newPnt.rx() += (bottom ? -box->width() : box->width()) - 2 * offset;

    if(box->isInlineFlowBox())
    {
        InlineFlowBox *flowBox = static_cast< InlineFlowBox * >(box);
        for(InlineBox *b = bottom ? flowBox->lastChild() : flowBox->firstChild(); b; b = bottom ? b->prevOnLine() : b->nextOnLine())
        {
            // Don't let boxes smaller than this flow box' height influence
            // the vertical position of the outline if they have a different
            // x-coordinate
            int l2;
            if(b->xPos() != box->xPos() && b->xPos() + b->width() != box->xPos() + box->width())
                l2 = y;
            else
                l2 = limit;
            collectHorizontalBoxCoordinates(b, pointArray, bottom, kAbs(offset), l2);
        }

        // Add intersection point if flow box contained any children
        if(flowBox->firstChild())
        {
            QPoint lastPnt = pointArray.back();
            QPoint insPnt(lastPnt.x(), newPnt.y());
            //             kdDebug(6040) << "right: " << lastPnt << " == " << insPnt << ": " << (insPnt == lastPnt) << endl;
            appendPoint(pointArray, insPnt);
        }
    }

    // Insert ending point of box
    appendPoint(pointArray, newPnt);

    //     kdDebug(6000) << "collectHorizontalBoxCoordinates: " << "ende" << endl;
}
开发者ID:,项目名称:,代码行数:69,代码来源:


注:本文中的InlineFlowBox::lastChild方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。