diff options
author | Sandro S. Andrade <sandroandrade@kde.org> | 2013-09-04 07:26:59 -0300 |
---|---|---|
committer | Sandro S. Andrade <sandroandrade@kde.org> | 2013-09-04 12:24:26 +0200 |
commit | df7fb2f660e151d0c5fbe62f90be9437ed190087 (patch) | |
tree | d001e89e61a00cd00e23b2b6a042bc55aed150d0 /examples/uml/nested-packages | |
parent | c9b9fb27ccfef6f23ce89eb7a54ed1ffa0bdd697 (diff) |
Add clone() method in template files
Change-Id: I345f997a2002bb97d4d243e4b2286865728292d8
Reviewed-by: Sandro S. Andrade <sandroandrade@kde.org>
Diffstat (limited to 'examples/uml/nested-packages')
-rw-r--r-- | examples/uml/nested-packages/main.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/examples/uml/nested-packages/main.cpp b/examples/uml/nested-packages/main.cpp index d0b3c34a..d78c48f2 100644 --- a/examples/uml/nested-packages/main.cpp +++ b/examples/uml/nested-packages/main.cpp @@ -49,13 +49,23 @@ int main () c2->asQObject()->setObjectName("c2"); QUmlComment *c3 = new QUmlComment; c3->asQObject()->setObjectName("c3"); + c3->setBody("c3 body"); - c2->setBody("Teste"); + c1->setBody("c1 body"); + c2->setBody("c2 body"); c1->addOwnedComment(c2); c1->addOwnedComment(c3); qDebug() << "c2's parent:" << c2->asQObject()->parent()->objectName(); qDebug() << "c3's parent:" << c3->asQObject()->parent()->objectName(); + QUmlComment *c4 = dynamic_cast<QUmlComment *>(c1->clone()); + qDebug() << "c1 body:" << c4->body(); + foreach (QUmlComment *comment, c1->ownedComment()) + qDebug() << "c1 owned comment body:" << comment->body(); + qDebug() << "c4 body:" << c4->body(); + foreach (QUmlComment *comment, c4->ownedComment()) + qDebug() << "c4 owned comment body:" << comment->body(); + //c1->removeOwnedComment(c3); qDebug() << "c3's parent:" << c3->asQObject()->parent(); @@ -70,5 +80,6 @@ int main () qDebug() << c->objectName(); delete c1; + delete c4; //delete c3; } |