还是一堆bug的状态
This commit is contained in:
@@ -4,49 +4,49 @@
|
||||
#include <stack>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
namespace Psc {
|
||||
class Node {
|
||||
namespace Flex_Qt {
|
||||
class Tree_Node {
|
||||
public:
|
||||
explicit Node();
|
||||
explicit Tree_Node();
|
||||
// 判断状态
|
||||
int index();
|
||||
bool is_root();
|
||||
bool is_leaf();
|
||||
bool is_first();
|
||||
bool is_last();
|
||||
Node* previous();
|
||||
Node* next();
|
||||
Node* last_child();
|
||||
Node* first_child();
|
||||
Node* root();
|
||||
Tree_Node* previous();
|
||||
Tree_Node* next();
|
||||
Tree_Node* last_child();
|
||||
Tree_Node* first_child();
|
||||
Tree_Node* root();
|
||||
int get_deep();
|
||||
// 遍历值
|
||||
std::vector<Node*> deep_traversed();
|
||||
std::vector<Node*> sequence_traversed();
|
||||
std::vector<Node*> descendants();
|
||||
Node* par = nullptr;
|
||||
std::vector<Node*> sons;
|
||||
std::vector<Tree_Node*> deep_traversed();
|
||||
std::vector<Tree_Node*> sequence_traversed();
|
||||
std::vector<Tree_Node*> descendants();
|
||||
Tree_Node* par = nullptr;
|
||||
std::vector<Tree_Node*> sons;
|
||||
QString text;
|
||||
bool expand = true;
|
||||
int height = 20;
|
||||
void add_child(Node* child) {
|
||||
void add_child(Tree_Node* child) {
|
||||
sons.push_back(child);
|
||||
child->par = this;
|
||||
}
|
||||
};
|
||||
struct Tree_Pos {
|
||||
Node* p{};
|
||||
Tree_Node* p{};
|
||||
int depth{};
|
||||
int node_pos{};
|
||||
int offset{};
|
||||
int pos() {
|
||||
return node_pos + offset;
|
||||
}
|
||||
std::stack<std::pair<Node*, int>> rest;
|
||||
std::stack<std::pair<Tree_Node*, int>> rest;
|
||||
};
|
||||
class Tree_Model {
|
||||
public:
|
||||
std::vector<Node*> roots;
|
||||
std::vector<Tree_Node*> roots;
|
||||
int tab_pixel_size = 8;
|
||||
int png_len = 20;
|
||||
int tab_width = 10;
|
||||
@@ -56,8 +56,8 @@ public:
|
||||
return 1000;
|
||||
}
|
||||
};
|
||||
Tree_Pos get_pos(int pos, const std::vector<Node*>& roots, int space);
|
||||
std::vector<Node*> deep_traversed(const std::vector<Node*>& nodes);
|
||||
using Node_Call_Back = const std::function<void(Node*, int, int)>&;
|
||||
void select_node(const std::vector<Node*>& roots, int view_y, int length, int space, Node_Call_Back call_back);
|
||||
} // namespace Psc
|
||||
Tree_Pos get_pos(int pos, const std::vector<Tree_Node*>& roots, int space);
|
||||
std::vector<Tree_Node*> deep_traversed(const std::vector<Tree_Node*>& nodes);
|
||||
using Node_Call_Back = const std::function<void(Tree_Node*, int, int)>&;
|
||||
void select_node(const std::vector<Tree_Node*>& roots, int view_y, int length, int space, Node_Call_Back call_back);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user