1 #include "BlockCategory.h"
\r
3 BlockCategory::BlockCategory(QString _name, int _id, BlockCategory* _parent) {
\r
9 void BlockCategory::addChild(BlockCategory* child) {
\r
10 childs.append(child);
\r
15 BlockCategory* BlockCategory::getChild(QString name) {
\r
16 QListIterator<BlockCategory *> iter(childs);
\r
17 BlockCategory* item = NULL;
\r
18 while(iter.hasNext()) {
\r
20 if (item->name == name) return item;
\r
25 BlockCategory* BlockCategory::getChild(int index) {
\r
26 if ((index >=0) && (index < childs.size()) ) {
\r
27 return childs.at(index);
\r
32 QList<BlockCategory *> BlockCategory::getAllChilds()
\r
37 ReferenceBlock *BlockCategory::getBlockById(int index) {
\r
38 if ((index >=0) && (index < blocks.size()) ) {
\r
39 return blocks.at(index);
\r
41 cout << "block null!" << endl;
\r
45 ReferenceBlock *BlockCategory::getBlockByName(QString name) {
\r
46 foreach(ReferenceBlock* block, blocks) {
\r
47 if (block->getName() == name) return block;
\r
49 cout << "block null!" << endl;
\r
53 QDomElement BlockCategory::save(QDomDocument &doc) {
\r