CNode.h 728 B

12345678910111213141516171819202122232425262728293031323334
  1. #ifndef CNODE_H
  2. #define CNODE_H
  3. #include <QObject>
  4. class CNode : public QObject
  5. {
  6. Q_OBJECT
  7. public:
  8. explicit CNode(QObject *parent = nullptr);
  9. const CNode *pNode() const; // 父节点
  10. const CNode *rNode() const; // 根节点
  11. QList<CNode *> cNodes() const; // 孩子节点
  12. int height() const; // 节点的高度
  13. int depth() const; // 节点的深度
  14. int leafs() const; // 叶子节点个数或包含的路径条数
  15. ///
  16. /// \brief sizeOfLevel 以此节点为根节点的子树中,某一层的节点数
  17. /// \param lev 节点层级,当前节点为1,向下递增
  18. /// \return 节点数
  19. ///
  20. int sizeOfLevel(int lev) const;
  21. signals:
  22. };
  23. #endif // CNODE_H