當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。