本文整理汇总了C++中QValueVector::isEmpty方法的典型用法代码示例。如果您正苦于以下问题:C++ QValueVector::isEmpty方法的具体用法?C++ QValueVector::isEmpty怎么用?C++ QValueVector::isEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QValueVector
的用法示例。
在下文中一共展示了QValueVector::isEmpty方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: collectVerticalBoxCoordinates
/**
* Traverses the vertical outer borders of the given render flow's line
* boxes and appends the point coordinates to the given point array.
* @param line line box to begin traversal
* @param pointArray point array
* @param left \c true, traverse the left vertical coordinates,
* \c false, traverse the right vertical coordinates.
* @param lastline if not 0, returns the pointer to the last line box traversed
*/
static void collectVerticalBoxCoordinates(InlineRunBox *line, QValueVector< QPoint > &pointArray, bool left, int offset, InlineRunBox **lastline = 0)
{
InlineRunBox *last = 0;
offset = left ? -offset : offset;
for(InlineRunBox *curr = line; curr && !last; curr = left ? curr->prevLineBox() : curr->nextLineBox())
{
InlineBox *root = curr;
bool isLast = lineBoxesDisjoint(curr, kAbs(offset), left);
if(isLast)
last = curr;
if(root != line && !isLast)
while(root->parent())
root = root->parent();
QPoint newPnt(curr->xPos() + !left * curr->width() + offset, (left ? root->topOverflow() : root->bottomOverflow()) + offset);
if(!pointArray.isEmpty())
{
QPoint lastPnt = pointArray.back();
if(newPnt.x() > lastPnt.x() && !left)
pointArray.back().setY(kMin(lastPnt.y(), root->topOverflow() - offset));
else if(newPnt.x() < lastPnt.x() && left)
pointArray.back().setY(kMax(lastPnt.y(), root->bottomOverflow() + offset));
QPoint insPnt(newPnt.x(), pointArray.back().y());
// kdDebug(6040) << "left: " << lastPnt << " == " << insPnt << ": " << (insPnt == lastPnt) << endl;
appendPoint(pointArray, insPnt);
}
appendPoint(pointArray, newPnt);
}
if(lastline)
*lastline = last;
}
示例2: 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;
}
示例3: appendIfNew
/**
* Appends the given coordinate-pair to the point-array if it is not
* equal to the last element.
* @param pointArray point-array
* @param pnt point to append
* @return \c true if \c pnt has actually been appended
*/
inline static bool appendIfNew(QValueVector< QPoint > &pointArray, const QPoint &pnt)
{
// if (!pointArray.isEmpty()) kdDebug(6040) << "appifnew: " << pointArray.back() << " == " << pnt << ": " << (pointArray.back() == pnt) << endl;
// else kdDebug(6040) << "appifnew: " << pnt << " (unconditional)" << endl;
if(!pointArray.isEmpty() && pointArray.back() == pnt)
return false;
pointArray.append(pnt);
return true;
}
示例4: startElement
bool startElement( const QString& /*namespaceURI*/, const QString& localName, const QString& qName, const QXmlAttributes& atts )
{
levels.back()++;
// Ignore document root
if ( levels.back() == 1 )
{
if ( levels.isEmpty() )
{
// Top level
elements.push( NULL );
}
else
{
// Within an include
elements.push( elements.current() );
}
return true;
}
// Include another file
if ( qName == "include" )
{
QString value = atts.value( "file" );
load( value );
elements.push( elements.current() );
return true;
}
cElement* element = new cElement;
element->setName( localName.latin1() );
element->copyAttributes( atts );
// Child Element?
if ( elements.current() != NULL )
{
cElement* parent = elements.current(); // Pop the potential parent
parent->addChild( element ); // Add the child to it's parent
element->setParent( parent );
} else {
Definitions::instance()->addElement(element);
}
elements.push( element ); // Push our element (there may be children)
return true;
}
示例5: defaultSQLTypeName
QString Driver::defaultSQLTypeName(int id_t)
{
if (id_t>=Field::Null)
return "Null";
if (dflt_typeNames.isEmpty()) {
dflt_typeNames.resize(Field::LastType + 1);
dflt_typeNames[Field::InvalidType]="InvalidType";
dflt_typeNames[Field::Byte]="Byte";
dflt_typeNames[Field::ShortInteger]="ShortInteger";
dflt_typeNames[Field::Integer]="Integer";
dflt_typeNames[Field::BigInteger]="BigInteger";
dflt_typeNames[Field::Boolean]="Boolean";
dflt_typeNames[Field::Date]="Date";
dflt_typeNames[Field::DateTime]="DateTime";
dflt_typeNames[Field::Time]="Time";
dflt_typeNames[Field::Float]="Float";
dflt_typeNames[Field::Double]="Double";
dflt_typeNames[Field::Text]="Text";
dflt_typeNames[Field::LongText]="LongText";
dflt_typeNames[Field::BLOB]="BLOB";
}
return dflt_typeNames[id_t];
}