本文整理匯總了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);
}
}
示例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 &)));
}
示例3: Delegate
void UBGraphicsTextItem::setSelected(bool selected)
{
if(selected){
Delegate()->createControls();
Delegate()->frame()->setOperationMode(UBGraphicsDelegateFrame::Resizing);
}
QGraphicsTextItem::setSelected(selected);
}
示例4: setTextWidth
void UBGraphicsTextItem::resize(qreal w, qreal h)
{
setTextWidth(w);
setTextHeight(h);
if (Delegate())
Delegate()->positionHandles();
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例12: Delegate
void UBGraphicsPathItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
{
if(mMultiClickState == 0){
Delegate()->mouseMoveEvent(event);
UBAbstractGraphicsPathItem::mouseMoveEvent(event);
}
}
示例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);
}
}
示例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
}
示例15: Delegate
void UBAbstractEditableGraphicsShapeItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
{
if(mMultiClickState == 0){
Delegate()->mouseMoveEvent(event);
UBAbstractGraphicsItem::mouseMoveEvent(event);
}
}