本文整理汇总了C++中aggregation::Aggregate::remove方法的典型用法代码示例。如果您正苦于以下问题:C++ Aggregate::remove方法的具体用法?C++ Aggregate::remove怎么用?C++ Aggregate::remove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类aggregation::Aggregate
的用法示例。
在下文中一共展示了Aggregate::remove方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: changeEditor
void FindMacroHandler::changeEditor(Core::IEditor *editor)
{
if (!isRecording() || !editor || !editor->widget())
return;
Aggregation::Aggregate *aggregate = Aggregation::Aggregate::parentAggregate(editor->widget());
if (aggregate) {
Core::IFindSupport *currentFind = aggregate->component<Core::IFindSupport>();
if (currentFind) {
MacroTextFind *macroFind = qobject_cast<MacroTextFind *>(currentFind);
if (macroFind)
return;
aggregate->remove(currentFind);
macroFind = new MacroTextFind(currentFind);
aggregate->add(macroFind);
// Connect all signals
connect(macroFind, &MacroTextFind::allReplaced,
this, &FindMacroHandler::replaceAll);
connect(macroFind, &MacroTextFind::incrementalFound,
this, &FindMacroHandler::findIncremental);
connect(macroFind, &MacroTextFind::incrementalSearchReseted,
this, &FindMacroHandler::resetIncrementalSearch);
connect(macroFind, &MacroTextFind::replaced,
this, &FindMacroHandler::replace);
connect(macroFind, &MacroTextFind::stepFound,
this, &FindMacroHandler::findStep);
connect(macroFind, &MacroTextFind::stepReplaced,
this, &FindMacroHandler::replaceStep);
}
}
}
示例2: parentAggregate
void tst_Aggregate::parentAggregate()
{
Aggregation::Aggregate aggregation;
Aggregation::Aggregate aggregation2;
Interface1 *component1 = new Interface1;
Interface11 *component11 = new Interface11;
QObject *component2 = new QObject;
aggregation.add(component1);
aggregation.add(component11);
QCOMPARE(Aggregation::Aggregate::parentAggregate(&aggregation), &aggregation);
QCOMPARE(Aggregation::Aggregate::parentAggregate(component1), &aggregation);
QCOMPARE(Aggregation::Aggregate::parentAggregate(component11), &aggregation);
QCOMPARE(Aggregation::Aggregate::parentAggregate(component2), (Aggregation::Aggregate *)0);
// test reparenting a component to another aggregate (should warn but not work)
aggregation2.add(component11);
QCOMPARE(Aggregation::Aggregate::parentAggregate(component11), &aggregation);
// test adding an aggregate to an aggregate (should warn but not work)
aggregation.add(&aggregation2);
QCOMPARE(Aggregation::Aggregate::parentAggregate(&aggregation2), &aggregation2);
// test removing an object from an aggregation.
aggregation.remove(component11);
QCOMPARE(Aggregation::Aggregate::parentAggregate(component11), (Aggregation::Aggregate *)0);
}