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


C++ Delegate函数代码示例

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


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

示例1: mouseMoveEvent

void UBGraphicsTextItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
{
    if (!Delegate() || !Delegate()->mouseMoveEvent(event))
    {
        QGraphicsTextItem::mouseMoveEvent(event);
    }
}
开发者ID:zhgn,项目名称:OpenBoard,代码行数:7,代码来源:UBGraphicsTextItem.cpp

示例2: QGraphicsTextItem

UBGraphicsTextItem::UBGraphicsTextItem(QGraphicsItem * parent) :
    QGraphicsTextItem(parent)
    , UBGraphicsItem()
    , mMultiClickState(0)
    , mLastMousePressTime(QTime::currentTime())
{
    setDelegate(new UBGraphicsTextItemDelegate(this, 0));

    // TODO claudio remove this because in contrast with the fact the frame should be created on demand.
    Delegate()->createControls();
    Delegate()->frame()->setOperationMode(UBGraphicsDelegateFrame::Resizing);
    Delegate()->setUBFlag(GF_FLIPPABLE_ALL_AXIS, false);
    Delegate()->setUBFlag(GF_REVOLVABLE, true);

    mTypeTextHereLabel = tr("<Type Text Here>");

    setData(UBGraphicsItemData::ItemLayerType, UBItemLayerType::Object);
    setData(UBGraphicsItemData::itemLayerType, QVariant(itemLayerType::ObjectItem)); //Necessary to set if we want z value to be assigned correctly


    setFlag(QGraphicsItem::ItemIsSelectable, true);
    setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);

    setTextInteractionFlags(Qt::TextEditorInteraction);

    setUuid(QUuid::createUuid());

    connect(document(), SIGNAL(contentsChanged()), Delegate(), SLOT(contentsChanged()));
    connect(document(), SIGNAL(undoCommandAdded()), this, SLOT(undoCommandAdded()));

    connect(document()->documentLayout(), SIGNAL(documentSizeChanged(const QSizeF &)),
            this, SLOT(documentSizeChanged(const QSizeF &)));

}
开发者ID:zhgn,项目名称:OpenBoard,代码行数:34,代码来源:UBGraphicsTextItem.cpp

示例3: Delegate

void UBGraphicsTextItem::setSelected(bool selected)
{
    if(selected){
        Delegate()->createControls();
        Delegate()->frame()->setOperationMode(UBGraphicsDelegateFrame::Resizing);
    }
    QGraphicsTextItem::setSelected(selected);
}
开发者ID:zhgn,项目名称:OpenBoard,代码行数:8,代码来源:UBGraphicsTextItem.cpp

示例4: setTextWidth

void UBGraphicsTextItem::resize(qreal w, qreal h)
{
    setTextWidth(w);
    setTextHeight(h);

    if (Delegate())
        Delegate()->positionHandles();
}
开发者ID:zhgn,项目名称:OpenBoard,代码行数:8,代码来源:UBGraphicsTextItem.cpp

示例5: Delegate

void
IMenuListener::Events
::RemoveListener(IMenuListener::Pointer l)
{
  if (l.IsNull()) return;

  menuAboutToShow -= Delegate(l.GetPointer(), &IMenuListener::MenuAboutToShow);
  menuAboutToHide -= Delegate(l.GetPointer(), &IMenuListener::MenuAboutToHide);
}
开发者ID:AGrafmint,项目名称:MITK,代码行数:9,代码来源:berryGuiTkIMenuListener.cpp

示例6: IMenuPage

InstructionsMenuPage::InstructionsMenuPage(Menu *menu, SaveGameManager *savedGames) : IMenuPage(menu)
{
	this->savedGames = savedGames;
	
	menuButton = new Input_Button();
	if(AppConfig::Instance().IsIpad())
	{
		menuButton->SetSpriteAndBounds(12, 15, CR::AssetList::menu_menu_buttons);
		menuButton->DesignSize(69,30);
	}
	else
		menuButton->SetSpriteAndBounds(12, 11, CR::AssetList::menu_menu_buttons);
	menuButton->SetSoundOn(true);
	menuButton->OnClicked += Delegate(this, &InstructionsMenuPage::OnMenuButtonClicked);
	input_objects.push_back(menuButton);
	
	nextButton = new Input_Button();
	if(AppConfig::Instance().IsIpad())
	{
		nextButton->SetSpriteAndBounds(394, 268, CR::AssetList::button_next);
		nextButton->DesignSize(78,47);
	}
	else
		nextButton->SetSpriteAndBounds(420, 277, CR::AssetList::button_next);
	nextButton->SetSoundOn(true);
	nextButton->OnClicked += Delegate(this, &InstructionsMenuPage::OnNextButtonClicked);
	input_objects.push_back(nextButton);
	
	prevButton = new Input_Button();
	if(AppConfig::Instance().IsIpad())
	{
		prevButton->SetSpriteAndBounds(394, 268, CR::AssetList::button_previous);
		prevButton->DesignSize(78,47);
	}
	else
		prevButton->SetSpriteAndBounds(420, 277, CR::AssetList::button_previous);
	prevButton->SetSoundOn(true);
	prevButton->OnClicked += Delegate(this, &InstructionsMenuPage::OnPrevButtonClicked);
	prevButton->Disabled(true);
	input_objects.push_back(prevButton);
	
	instructions01 = graphics_engine->CreateSprite1();
	instructions01->SetImage(CR::AssetList::menu_instructions_01);
	instructions01->SetPositionAbsalute(240, 160);
	if(AppConfig::Instance().IsIpad())
		instructions01->SetDesignSize(480,320);
	
	instructions02 = graphics_engine->CreateSprite1();
	instructions02->SetImage(CR::AssetList::menu_instructions_02);
	instructions02->SetPositionAbsalute(240, 160);
	if(AppConfig::Instance().IsIpad())
		instructions02->SetDesignSize(480,320);
	
	currPage = 1;
}
开发者ID:shoematt,项目名称:BladeofBetrayal,代码行数:55,代码来源:InstructionsMenuPage.cpp

示例7: Delegate

void
IControlListener::Events
::RemoveListener(IControlListener::Pointer l)
{
  if (l.IsNull()) return;

  movedEvent -= Delegate(l.GetPointer(), &IControlListener::ControlMoved);
  resizedEvent -= Delegate(l.GetPointer(), &IControlListener::ControlResized);
  activatedEvent -= Delegate(l.GetPointer(), &IControlListener::ControlActivated);
  destroyedEvent -= Delegate(l.GetPointer(), &IControlListener::ControlDestroyed);
}
开发者ID:test-fd301,项目名称:MITK,代码行数:11,代码来源:berryGuiTkIControlListener.cpp

示例8: Delegate

void
IWindowListener::Events
::RemoveListener(IWindowListener::Pointer listener)
{
  if (listener.IsNull()) return;

  windowActivated -= Delegate(listener.GetPointer(), &IWindowListener::WindowActivated);
  windowDeactivated -= Delegate(listener.GetPointer(), &IWindowListener::WindowDeactivated);
  windowClosed -= Delegate(listener.GetPointer(), &IWindowListener::WindowClosed);
  windowOpened -= Delegate(listener.GetPointer(), &IWindowListener::WindowOpened);
}
开发者ID:test-fd301,项目名称:MITK,代码行数:11,代码来源:berryIWindowListener.cpp

示例9: Delegate

void
IWindowListener::Events
::RemoveListener(IWindowListener* listener)
{
  if (listener == nullptr) return;

  windowActivated -= Delegate(listener, &IWindowListener::WindowActivated);
  windowDeactivated -= Delegate(listener, &IWindowListener::WindowDeactivated);
  windowClosed -= Delegate(listener, &IWindowListener::WindowClosed);
  windowOpened -= Delegate(listener, &IWindowListener::WindowOpened);
}
开发者ID:151706061,项目名称:MITK,代码行数:11,代码来源:berryIWindowListener.cpp

示例10: Delegate

QVariant UBGraphicsCurtainItem::itemChange(GraphicsItemChange change, const QVariant &value)
{

    QVariant newValue = value;

    if (Delegate())
    {
        newValue = Delegate()->itemChange(change, value);
    }

    return QGraphicsRectItem::itemChange(change, newValue);
}
开发者ID:199901,项目名称:Sankore-3.1,代码行数:12,代码来源:UBGraphicsCurtainItem.cpp

示例11: Delegate

void
IPartListener::Events
::AddListener(IPartListener::Pointer l)
{
  if (l.IsNull()) return;

  Types t = l->GetPartEventTypes();

  if (t & ACTIVATED)
    partActivated += Delegate(l.GetPointer(), &IPartListener::PartActivated);
  if (t & BROUGHT_TO_TOP)
    partBroughtToTop += Delegate(l.GetPointer(), &IPartListener::PartBroughtToTop);
  if (t & CLOSED)
    partClosed += Delegate(l.GetPointer(), &IPartListener::PartClosed);
  if (t & DEACTIVATED)
    partDeactivated += Delegate(l.GetPointer(), &IPartListener::PartDeactivated);
  if (t & OPENED)
    partOpened += Delegate(l.GetPointer(), &IPartListener::PartOpened);
  if (t & HIDDEN)
    partHidden += Delegate(l.GetPointer(), &IPartListener::PartHidden);
  if (t & VISIBLE)
    partVisible += Delegate(l.GetPointer(), &IPartListener::PartVisible);
  if (t & INPUT_CHANGED)
    partInputChanged += Delegate(l.GetPointer(), &IPartListener::PartInputChanged);
}
开发者ID:AGrafmint,项目名称:MITK,代码行数:25,代码来源:berryIPartListener.cpp

示例12: Delegate

void UBGraphicsPathItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
{
    if(mMultiClickState == 0){
        Delegate()->mouseMoveEvent(event);
        UBAbstractGraphicsPathItem::mouseMoveEvent(event);
    }
}
开发者ID:fincom,项目名称:Sankore-3.1,代码行数:7,代码来源:UBGraphicsPathItem.cpp

示例13: prepareGeometryChange

void UBEditableGraphicsRegularShapeItem::updateHandle(UBAbstractHandle *handle)
{
    prepareGeometryChange();

    Delegate()->showFrame(false);

    QPointF diff = handle->pos() - path().boundingRect().topLeft();

    qreal maxSize = handle->radius() * 4;

    if(diff.x() < maxSize) {
        handle->setX(handle->pos().x() + (maxSize - diff.x()));
    }

    if(diff.y() < maxSize) {
        handle->setY(handle->pos().y() + (maxSize - diff.y()));
    }

    updatePath(handle->pos());

    if(hasGradient()) {
        QLinearGradient g(path().boundingRect().topLeft(), path().boundingRect().topRight());

        g.setColorAt(0, brush().gradient()->stops().at(0).second);
        g.setColorAt(1, brush().gradient()->stops().at(1).second);

        setBrush(g);
    }

}
开发者ID:hethi,项目名称:Sankore-3.1,代码行数:30,代码来源:UBEditableGraphicsRegularShapeItem.cpp

示例14: QGraphicsPixmapItem

UBGraphicsPixmapItem::UBGraphicsPixmapItem(QGraphicsItem* parent)
    : QGraphicsPixmapItem(parent)
{
    setDelegate(new UBGraphicsItemDelegate(this, 0, true, false, true, true));
    Delegate()->init();
    Delegate()->setFlippable(true);
    Delegate()->setRotatable(true);

    setData(UBGraphicsItemData::ItemLayerType, UBItemLayerType::Object);
    setTransformationMode(Qt::SmoothTransformation);

    setData(UBGraphicsItemData::itemLayerType, QVariant(itemLayerType::ObjectItem)); //Necessary to set if we want z value to be assigned correctly
    setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);

    setUuid(QUuid::createUuid()); //more logical solution is in creating uuid for element in element's constructor
}
开发者ID:Ascaf0,项目名称:Sankore-3.1,代码行数:16,代码来源:UBGraphicsPixmapItem.cpp

示例15: Delegate

void UBAbstractEditableGraphicsShapeItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
{
    if(mMultiClickState == 0){
        Delegate()->mouseMoveEvent(event);
        UBAbstractGraphicsItem::mouseMoveEvent(event);
    }
}
开发者ID:hethi,项目名称:Sankore-3.1,代码行数:7,代码来源:UBShapeEditable.cpp


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