本文整理汇总了C++中QQuickItem::inherits方法的典型用法代码示例。如果您正苦于以下问题:C++ QQuickItem::inherits方法的具体用法?C++ QQuickItem::inherits怎么用?C++ QQuickItem::inherits使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QQuickItem
的用法示例。
在下文中一共展示了QQuickItem::inherits方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updatePolish
void QQuickStretchColumnContainer::updatePolish (void) {
const QList<QQuickItem *> childrenList = childItems ();
/// find items and stretchers
qreal tmpW = 0;
qreal tmpH = 0;
int nbItems = 0;
int nbStretch = 0;
for (QList<QQuickItem *>::const_iterator it = childrenList.constBegin (); it != childrenList.constEnd (); it++) {
QQuickItem * child = (* it);
if (child != Q_NULLPTR && !child->inherits ("QQuickRepeater") && child->isVisible ()) {
if (child->implicitWidth () > tmpW) {
tmpW = child->implicitWidth ();
}
if (child->implicitHeight () >= 0) {
tmpH += child->implicitHeight ();
}
else {
nbStretch++;
}
nbItems++;
}
}
/// resize layout
if (nbItems > 1) {
tmpH += (m_spacing * (nbItems -1));
}
setImplicitWidth (tmpW);
setImplicitHeight (tmpH);
const qreal layoutWidth = width ();
const qreal layoutHeight = height ();
const qreal autoSize = (nbStretch > 0 ? (layoutHeight - tmpH) / qreal (nbStretch) : 0);
/// position children
int currY = 0;
for (QList<QQuickItem *>::const_iterator it = childrenList.constBegin (); it != childrenList.constEnd (); it++) {
QQuickItem * child = (* it);
if (child != Q_NULLPTR && !child->inherits ("QQuickRepeater") && child->isVisible ()) {
if (currY) {
currY += m_spacing;
}
child->setY (currY);
child->setWidth (layoutWidth);
child->setHeight (child->implicitHeight () >= 0 ? child->implicitHeight () : autoSize);
currY += child->height ();
}
}
}