• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ parentItem函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中parentItem函数的典型用法代码示例。如果您正苦于以下问题:C++ parentItem函数的具体用法?C++ parentItem怎么用?C++ parentItem使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: transientParent

void QQuickMenuPopupWindow::setGeometry(int posx, int posy, int w, int h)
{
    QWindow *pw = transientParent();
    if (!pw && parentItem())
        pw = parentItem()->window();
    if (!pw)
        pw = this;
    QRect g = pw->screen()->availableVirtualGeometry();

    if (posx + w > g.right()) {
        if (qobject_cast<QQuickMenuPopupWindow *>(transientParent())) {
            // reposition submenu window on the parent menu's left side
            int submenuOverlap = pw->x() + pw->width() - posx;
            posx -= pw->width() + w - 2 * submenuOverlap;
        } else {
            posx = g.right() - w;
        }
    } else {
        posx = qMax(posx, g.left());
    }

    posy = qBound(g.top(), posy, g.bottom() - h);

    QQuickWindow::setGeometry(posx, posy, w, h);
}
开发者ID:xjohncz,项目名称:qt5,代码行数:25,代码来源:qquickmenupopupwindow.cpp


示例2: parentItem

QVariant PixmapItem::itemChange(GraphicsItemChange change,
                                const QVariant &value)
{
    if (change == ItemPositionChange)
    {
        // value is the new position.
        QPointF newPos = value.toPointF();
        QRectF rect = parentItem()->boundingRect();

        rect.moveLeft(boundingRect().width()*3/4*-1);
        rect.setWidth(rect.width() + boundingRect().width()*2/4 );

        rect.moveTop(boundingRect().height()*3/4*-1);
        rect.setHeight(rect.height() + boundingRect().height()*2/4 );

        CardItem *card = qgraphicsitem_cast<CardItem *>(parentItem());

        if (!rect.contains(newPos))
        {
            // Keep the item inside the scene rect.
            int newX = (int)qMin(rect.right(), qMax(newPos.x(), rect.left()));
            int newY = (int)qMin(rect.bottom(), qMax(newPos.y(), rect.top()));



            if(card->isAlign())
            {
                int gridSize = card->getGridSize();
                newX = (newX/(10*gridSize))*(10*gridSize);
                newY = (newY/(10*gridSize))*(10*gridSize);
            }

            newPos.setX(newX);
            newPos.setY(newY);
            return newPos;
        }
        else
        {
            int newX =  newPos.x();
            int newY = newPos.y();

            if(card->isAlign())
            {
                int gridSize = card->getGridSize();
                newX = newPos.x()/(10*gridSize);
                newX = newX * (10*gridSize);
                newY = newPos.y()/(10*gridSize);
                newY = newY*(10*gridSize);

            }

            newPos.setX(newX);
            newPos.setY(newY);
            return newPos;

        }
    }

    return QGraphicsItem::itemChange(change, value);
}
开发者ID:BackupTheBerlios,项目名称:horux-svn,代码行数:60,代码来源:pixmapitem.cpp


示例3: toHtml

void ElementTitle::focusOutEvent(QFocusEvent *event)
{
	QGraphicsTextItem::focusOutEvent(event);

	QString htmlNormalizedText = toHtml().remove("\n", Qt::CaseInsensitive);

	setTextInteractionFlags(Qt::NoTextInteraction);

	parentItem()->setSelected(true);

	// Clear selection
	QTextCursor cursor = textCursor();
	cursor.clearSelection();
	setTextCursor(cursor);

	unsetCursor();

	if (mReadOnly)
		return;

	if (mOldText != toPlainText()) {
		QString value = toPlainText();
		if (mBinding == "name")
			static_cast<NodeElement*>(parentItem())->setName(value);
		else
			static_cast<NodeElement*>(parentItem())->setLogicalProperty(mBinding, value);
	}
	setHtml(htmlNormalizedText);
}
开发者ID:ArtemKopylov,项目名称:qreal,代码行数:29,代码来源:elementTitle.cpp


示例4: Q_D

 QRectF RadicalElectron::boundingRect() const {
   if (!parentItem()) return QRectF();
   Q_D(const RadicalElectron);
   QRectF bounds(0,0,d->diameter,d->diameter);
   bounds.translate(d->linker.getShift(parentItem()->boundingRect(), bounds));
   return bounds;
 }
开发者ID:hvennekate,项目名称:Molsketch,代码行数:7,代码来源:radicalelectron.cpp


示例5: qRound

Cell::CellState Cell::shrinkOrGrow()
{
    int dishSize = qRound(parentItem()->boundingRect().width());
    int neighbours = 0;
    QListIterator<QGraphicsItem*> i(parentItem()->childItems());
    while (i.hasNext()) {
        QGraphicsItem *item = i.next();
        if (item != this && collidesWithItem(item))
            ++neighbours;
    }
    if (!neighbours || m_size > dishSize / 3)
        m_size *= randomReal(); // shrink - lonely or too big
    else if (neighbours < 4) // grow - happy
        m_size *= ((5 - neighbours) * randomReal());
    else // shrink - too crowded
        m_size *= ((1.0 / neighbours) + randomReal());

    QPainterPath path;
    qreal x = m_size * std::cos(AQP::radiansFromDegrees(1));
    qreal y = m_size * std::sin(AQP::radiansFromDegrees(1));
    path.moveTo(x, y);
    for (int angle = 1; angle < 360; ++angle) {
        qreal factor = m_size + ((m_size / 3) * (randomReal() - 0.5));
        x = factor * std::cos(AQP::radiansFromDegrees(angle));
        y = factor * std::sin(AQP::radiansFromDegrees(angle));
        path.lineTo(x, y);
    }
    path.closeSubpath();
    m_path = path;

    prepareGeometryChange();
    if (m_size < 5.0 && (qrand() % 20 == 0))
        return Die; // small ones randomly die
    return Live;
}
开发者ID:JustFFunny,项目名称:WorkSpace,代码行数:35,代码来源:cell.cpp


示例6: switch

QVariant Node::itemChange(GraphicsItemChange change, const QVariant &value)
{
    switch (change)
    {
      case ItemPositionHasChanged:
        if (parentItem() != 0)
        {
            if (parentItem()->type() == Graph::Type)
            {
                Graph * graph = qgraphicsitem_cast<Graph*>(parentItem());
                Graph * tempGraph = graph;
                graph = qgraphicsitem_cast<Graph*>(graph->getRootParent());
                this->setParentItem(nullptr);
                this->setParentItem(tempGraph);
            }
            if (verbose)
                qDebug() << "node does not have a graph item parent";
        }
        foreach (Edge * edge, edgeList)
            edge->adjust();
        break;

      case ItemRotationChange:
        foreach (Edge * edge, edgeList)
            edge->adjust();
        break;

      default:
        break;
    };

    return QGraphicsItem::itemChange(change, value);
}
开发者ID:Razmataz88,项目名称:Graphic,代码行数:33,代码来源:node.cpp


示例7: Q_Q

/*!
    \internal

    This function is called from subclasses to add a layout item \a layoutItem
    to a layout.

    It takes care of automatically reparenting graphics items, if needed.

    If \a layoutItem is a  is already in a layout, it will remove it  from that layout.

*/
void QGraphicsLayoutPrivate::addChildLayoutItem(QGraphicsLayoutItem *layoutItem)
{
    Q_Q(QGraphicsLayout);
    if (QGraphicsLayoutItem *maybeLayout = layoutItem->parentLayoutItem()) {
        if (maybeLayout->isLayout())
            removeLayoutItemFromLayout(static_cast<QGraphicsLayout*>(maybeLayout), layoutItem);
    }
    layoutItem->setParentLayoutItem(q);
    if (layoutItem->isLayout()) {
        if (QGraphicsItem *parItem = parentItem()) {
            static_cast<QGraphicsLayout*>(layoutItem)->d_func()->reparentChildItems(parItem);
        }
    } else {
        if (QGraphicsItem *item = layoutItem->graphicsItem()) {
            QGraphicsItem *newParent = parentItem();
            QGraphicsItem *oldParent = item->parentItem();
            if (oldParent == newParent || !newParent)
                return;

#ifdef QT_DEBUG
            if (oldParent && item->isWidget()) {
                QGraphicsWidget *w = static_cast<QGraphicsWidget*>(item);
                qWarning("QGraphicsLayout::addChildLayoutItem: %s \"%s\" in wrong parent; moved to correct parent",
                    w->metaObject()->className(), w->objectName().toLocal8Bit().constData());
            }
#endif

            item->setParentItem(newParent);
        }
    }
}
开发者ID:MarianMMX,项目名称:MarianMMX,代码行数:42,代码来源:qgraphicslayout_p.cpp


示例8: model

UIGChooserItemMachine::~UIGChooserItemMachine()
{
    /* If that item is focused: */
    if (model()->focusItem() == this)
    {
        /* Unset the focus: */
        model()->setFocusItem(0);
    }
    /* If that item is in selection list: */
    if (model()->currentItems().contains(this))
    {
        /* Remove item from the selection list: */
        model()->removeFromCurrentItems(this);
    }
    /* If that item is in navigation list: */
    if (model()->navigationList().contains(this))
    {
        /* Remove item from the navigation list: */
        model()->removeFromNavigationList(this);
    }

    /* Remove item from the parent: */
    AssertMsg(parentItem(), ("No parent set for machine-item!"));
    parentItem()->removeItem(this);
}
开发者ID:zBMNForks,项目名称:virtualbox-org-svn-vbox-trunk,代码行数:25,代码来源:UIGChooserItemMachine.cpp


示例9: QGraphicsPathItem

CanvasBezierLineMov::CanvasBezierLineMov(PortMode port_mode_, PortType port_type_, QGraphicsItem* parent) :
    QGraphicsPathItem(parent, canvas.scene)
{
    port_mode = port_mode_;
    port_type = port_type_;

    // Port position doesn't change while moving around line
    item_x = parentItem()->scenePos().x();
    item_y = parentItem()->scenePos().y();
    item_width = ((CanvasPort*)parentItem())->getPortWidth(); // FIXME

    QPen pen;

    if (port_type == PORT_TYPE_AUDIO_JACK)
        pen = QPen(canvas.theme->line_audio_jack, 2);
    else if (port_type == PORT_TYPE_MIDI_JACK)
        pen = QPen(canvas.theme->line_midi_jack, 2);
    else if (port_type == PORT_TYPE_MIDI_A2J)
        pen = QPen(canvas.theme->line_midi_a2j, 2);
    else if (port_type == PORT_TYPE_MIDI_ALSA)
        pen = QPen(canvas.theme->line_midi_alsa, 2);

    QColor color(0,0,0,0);
    setBrush(color);
    setPen(pen);
    update();
}
开发者ID:87maxi,项目名称:oom,代码行数:27,代码来源:canvasbezierlinemov.cpp


示例10: parentItem

void UIGChooserItem::updateGeometry()
{
    /* Call to base-class: */
    QIGraphicsWidget::updateGeometry();

    /* Update parent's geometry: */
    if (parentItem())
        parentItem()->updateGeometry();

    /* Special handling for root-items: */
    if (isRoot())
    {
        /* Root-item should notify chooser-view if minimum-width-hint was changed: */
        int iMinimumWidthHint = minimumWidthHint();
        if (m_iPreviousMinimumWidthHint != iMinimumWidthHint)
        {
            /* Save new minimum-width-hint, notify listener: */
            m_iPreviousMinimumWidthHint = iMinimumWidthHint;
            emit sigMinimumWidthHintChanged(m_iPreviousMinimumWidthHint);
        }
        /* Root-item should notify chooser-view if minimum-height-hint was changed: */
        int iMinimumHeightHint = minimumHeightHint();
        if (m_iPreviousMinimumHeightHint != iMinimumHeightHint)
        {
            /* Save new minimum-height-hint, notify listener: */
            m_iPreviousMinimumHeightHint = iMinimumHeightHint;
            emit sigMinimumHeightHintChanged(m_iPreviousMinimumHeightHint);
        }
    }
}
开发者ID:VirtualMonitor,项目名称:VirtualMonitor,代码行数:30,代码来源:UIGChooserItem.cpp


示例11: setSystem

void QSGParticlePainter::componentComplete()
{
    if (!m_system && qobject_cast<QSGParticleSystem*>(parentItem()))
        setSystem(qobject_cast<QSGParticleSystem*>(parentItem()));
    if (!m_system)
        qWarning() << "ParticlePainter created without a particle system specified";//TODO: useful QML warnings, like line number?
    QSGItem::componentComplete();
}
开发者ID:yinyunqiao,项目名称:qtdeclarative,代码行数:8,代码来源:qsgparticlepainter.cpp


示例12: parentItem

QRectF HighlightItem::parentRect() const
{
    if (parentItem())
        return parentItem()->boundingRect();
    else if (scene())
        return scene()->sceneRect();
    return QRectF(0, 0, 10, 10);
}
开发者ID:AndySardina,项目名称:fotowall,代码行数:8,代码来源:HighlightItem.cpp


示例13: parentItem

void GEventNode::UpdateVerticalPosition()
{
	// if their is a parent item, we draw the line within the pParentItem->boundingRect(). 
	double heightLine = 11.4159;
	if(parentItem())
		heightLine = parentItem()->boundingRect().height();
	setLine(0.0, 0.0, 0.0, heightLine);
}
开发者ID:GaelReinaudi,项目名称:LabExe,代码行数:8,代码来源:GEventNode.cpp


示例14: clearItems

UIGSelectorItemGroup::~UIGSelectorItemGroup()
{
    /* Delete all the items: */
    clearItems();

    /* Remove item from the parent: */
    if (parentItem())
        parentItem()->removeItem(this);
}
开发者ID:greg100795,项目名称:virtualbox,代码行数:9,代码来源:UIGSelectorItemGroup.cpp


示例15: qDebug

bool Cell::isGrouped()
{

    if(parentItem()) {
        qDebug() << "isGrouped parent type:" << parentItem()->Type;
        return true;
    }

    return false;
}
开发者ID:DoubleYouEl,项目名称:CrochetCharts,代码行数:10,代码来源:cell.cpp


示例16:

KoFilterEffect * ConnectorItem::effect() const
{
    if (!parentItem())
        return 0;
    EffectItemBase * effectItem = dynamic_cast<EffectItemBase*>(parentItem());
    if (!effectItem)
        return 0;

    return effectItem->effect();
}
开发者ID:abhishekmurthy,项目名称:Calligra,代码行数:10,代码来源:FilterEffectSceneItems.cpp


示例17: AssertMsg

QString UIGChooserItemMachine::fullName() const
{
    /* Get full parent name, append with '/' if not yet appended: */
    AssertMsg(parentItem(), ("Incorrect parent set!"));
    QString strFullParentName = parentItem()->fullName();
    if (!strFullParentName.endsWith('/'))
        strFullParentName.append('/');
    /* Return full item name based on parent prefix: */
    return strFullParentName + name();
}
开发者ID:zBMNForks,项目名称:virtualbox-org-svn-vbox-trunk,代码行数:10,代码来源:UIGChooserItemMachine.cpp


示例18: UIGSelectorItem

UIGSelectorItemMachine::UIGSelectorItemMachine(UIGSelectorItem *pParent,
                                               UIGSelectorItemMachine *pCopyFrom,
                                               int iPosition /* = -1 */)
    : UIGSelectorItem(pParent, iPosition)
    , UIVMItem(pCopyFrom->machine())
{
    /* Add item to the parent: */
    AssertMsg(parentItem(), ("No parent set for machine item!"));
    parentItem()->addItem(this, iPosition);
}
开发者ID:greg100795,项目名称:virtualbox,代码行数:10,代码来源:UIGSelectorItemMachine.cpp


示例19: isGrouped

bool ItemGroup::isGrouped()
{
    if(parentItem()) {
        if(parentItem()->Type == ItemGroup::Type) {
            return true;
        }
    }

    return false;
}
开发者ID:DoubleYouEl,项目名称:CrochetCharts,代码行数:10,代码来源:itemgroup.cpp


示例20: onParentChanged

void Fixture::onParentChanged()
{
    if (!m_shapeItem)
        return;

    // NOTE: Probably we need to check if there is a
    // better place to set container Entity to be
    // parent of Shape.
    m_shapeItem->setParent(parentItem());
    m_shapeItem->setParentItem(parentItem());
}
开发者ID:dallarosa,项目名称:Quasi-Engine,代码行数:11,代码来源:fixture.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ parentNode函数代码示例发布时间:2022-05-30
下一篇:
C++ parent函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap