QCombox 下拉框树状结构列表能实现 Tree 状结构吗

1336人阅读
算法(18)
该代码实现了tree的结构,依赖dyArray数据结构。有first一级目录,second二级目录。
dyArray的c实现参考这里&&hashTable的c实现参考这里
下面是跨平台的数据类型定义
cpPlatform.h
dataStruct
Created by hherima on 14-7-29.
Copyright (c) 2014年 . All rights reserved.
#ifndef dataStruct_cpPlatform_h
#define dataStruct_cpPlatform_h
F_MALLOC_TYPE(s) (s*)f_malloc(sizeof(s))
FREEFUN free
MIN_PRE_ALLOCATE_SIZE 10
//The initial size of the dynamic array.
REALLOCFUN
typedef unsigned char cp_
typedef signed int cp_int32;
typedef char cp_int8;
typedef unsigned int cp_uint32;
treeStruct.h
dataStruct
Created by hherima on 14-8-1.
Copyright (c) 2014年 . All rights reserved.
#ifndef dataStruct_treeStruct_h
#define dataStruct_treeStruct_h
#include &stdlib.h&
#include &cpPlatform.h&
#include &dyArray.h&
enum nodetype //tree节点类型
second_type_node,
first_type_node
struct firstnode
struct DynamicArray *second_
void *puiD
cp_bool flag_
//标志该组是否展开
struct TreeNode
enum nodetype pnode_t;
//用来记录该节点为first或者是second
//该指针实际应该为firstnode或者secondnode,应根据nodetype强转加以使用
struct tree
/*struct Iterator_trees_fromcur_skipmode */void *piterator_fromcur_
/*struct Iterator_trees_fromhead_skipmode*/void *piterator_fromhead_
/*struct Iterator_trees_fromhead_holemode*/void *piterator_fromhead_
#ifdef FET_ITERATOR_EXTEND
/*struct Iterator_trees_fromcur_holemode*/void *piterator_fromcur_
/*struct Iterator_trees_fromcur_first*/void *piterator_fromcur_
/*struct Iterator_trees_fromhead_first*/void *piterator_fromhead_
/*struct Iterator_trees_fromcur_skipmode_wm*/void *piterator_fromcur_skipmode_
/*struct Iterator_trees_fromcur_holdmode_wm*/void *piterator_fromcur_holemode_
/*struct Iterator_trees_fromcur_first_wm*/void *piterator_fromcur_first_
struct DynamicArray *first_
cp_int32 firstI
//该second所在组在整个组动态数组中的index
cp_int32 secondI //该second所在second动态数组中的index
void * pCursorfirstN
void * pCursorsecondN
enum travmode //遍历模式
skipModeFlag, //跳跃闭合组模式
wholeModeFlag, //全节点遍历模式(不区分闭合组)
//为树上的节点申请空间
create_first_array(struct tree *c_tree,DataDestroyFunc data_destroy);
create_second_array(struct firstnode *first_node,DataDestroyFunc data_destroy);
cp_bool append_first_ele(struct tree *c_tree, struct firstnode *first_node);
cp_bool append_second_ele(struct firstnode *first_node, struct secondnode *second_node);
cp_bool insert_first_ele(struct tree *c_tree, struct firstnode *first_node, cp_int32 insert_pos);
cp_bool insert_second_ele(struct firstnode *first_node, struct secondnode *second_node, cp_int32 insert_pos);
cp_bool ThisIsSelectedNode(struct tree *theTree, void *pNode);
void *get_focus_first(struct tree *theTree);
treeStruct.c
dataStruct
Created by hherima on 14-8-1.
Copyright (c) 2014年 . All rights reserved.
#include &treeStruct.h&
create_first_array(struct tree *c_tree,DataDestroyFunc data_destroy)
if( c_tree == NULL )
return CP_FALSE;
c_tree-&first_array = DyArrayCreate(data_destroy);
if(c_tree-&first_array == NULL)
return CP_FALSE;
return CP_TRUE;
cp_bool create_second_array(struct firstnode *first_node,DataDestroyFunc data_destroy)
if(first_node == NULL)
return CP_FALSE;
first_node-&second_array = DyArrayCreate(data_destroy);
if(first_node-&second_array == NULL)
return CP_FALSE;
return CP_TRUE;
append_first_ele( struct tree *c_tree, struct firstnode *first_node )
if( c_tree == NULL || first_node == NULL)
return CP_FALSE;
if( !DyArrayAppend(c_tree-&first_array, first_node) )
return CP_FALSE;
return CP_TRUE;
append_second_ele(struct firstnode *first_node, struct secondnode *second_node)
if( first_node == NULL || second_node == NULL)
return CP_FALSE;
if( !DyArrayAppend(first_node-&second_array, second_node))
return CP_FALSE;
return CP_TRUE;
insert_first_ele(struct tree *c_tree, struct firstnode *first_node, cp_int32 insert_pos)
if( first_node == NULL || c_tree == NULL)
return CP_FALSE;
if(!DyArrayInsert(c_tree-&first_array, insert_pos, first_node))
return CP_FALSE;
return CP_TRUE;
insert_second_ele(struct firstnode *first_node, struct secondnode *second_node, cp_int32 insert_pos)
if( first_node == NULL || second_node == NULL)
return CP_FALSE;
if(!DyArrayInsert(first_node-&second_array, insert_pos, second_node))
return CP_FALSE;
return CP_TRUE;
void traversal_tree(struct tree *theTree)
cp_int32 i = 0, j = 0;
cp_int32 first_num = 0, second_num = 0;
struct firstnode *
struct secondnode *
first_num = theTree-&first_array-&m_nS
while(i & first_num)
pcurfirst = (struct firstnode*)(theTree-&first_array-&m_ppData[i++]);
// visit(pcurfirst);
second_num = pcurfirst-&second_array-&m_nS
while(j & second_num)
pcursecond = (struct secondnode*)(pcurfirst-&second_array-&m_ppData[j++]);
// visit(pcursecond);
//遍历结束的回调
void traversal_firstnode(struct tree *theTree)
cp_int32 i = 0;
cp_int32 first_num = 0;
struct firstnode *
first_num = theTree-&first_array-&m_nS
while(i & first_num)
pcurfirst = (struct firstnode*)(theTree-&first_array-&m_ppData[i++]);
// visit(pcurfirst);
//遍历结束的回调
cp_bool ThisIsSelectedNode(struct tree *theTree, void *pNode)
if(theTree-&secondIndex == -1)
if(theTree-&first_array-&m_ppData[theTree-&firstIndex] == pNode)
return CP_TRUE;
return CP_FALSE;
struct firstnode *first_node = NULL;
first_node = theTree-&first_array-&m_ppData[theTree-&firstIndex];
if(first_node-&second_array-&m_ppData[theTree-&secondIndex] == pNode)
return CP_TRUE;
return CP_FALSE;
void *get_focus_first(struct tree *theTree)
if(theTree == NULL)
return NULL;
if(theTree-&first_array == NULL)
return NULL;
return theTree-&first_array-&m_ppData[theTree-&firstIndex];
&&相关文章推荐
参考知识库
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:863828次
积分:6943
积分:6943
排名:第2985名
原创:161篇
转载:44篇
译文:16篇
评论:105条
阅读:12258
阅读:12665
阅读:28341
阅读:14374
文章:10篇
阅读:419542
阅读:32983
文章:11篇
阅读:19246
文章:12篇
阅读:34663
(3)(1)(7)(3)(1)(1)(1)(7)(3)(1)(1)(1)(3)(6)(6)(3)(3)(1)(1)(3)(5)(3)(8)(12)(9)(1)(2)(1)(3)(3)(8)(23)(6)(9)(4)(1)(7)(1)(3)(3)(5)(2)(1)(5)(13)(4)(19)(4)Tree:实用的树形菜单控件
&&共3页『 &&1&&&&&&&&』
&jQuery plugin: Treeview&这个插件能够把无序列表转换成可展开与收缩的Tree。&&&& &jstree&是一个基于jQuery的Tree控件。支持XML,JSON,Html三种数据源。提供创建,重命名,移动,删除,拖\放节点操作。可以自己自定义创建,删除,嵌套,重命名,选择节点的规则。在这些操作上可以添加多种监听事件。&&&&&& &FileTreePanel&FileTreePanel扩展至Ext.tree.TreePanel附带基本的文件/文件夹管理功能。其它还包括文件上传,重命名,删除,新建与移动。&&& &jQuery File Tree&jQuery File Tree是一个可配置的Ajax文件浏览器jQuery插件。可以通过CSS定制外观,指定文件树展开图标,可以自己定义展开/收缩事件、速度,配置加载信息等。 jQuery File Tree通过Ajax来获取文件信息。&&& &dhtmlxTree &dhtmlxTree是一个功能丰富的Tree Menu控件。提供丰富的操作API,AJAX支持和drag-n-drop功能。& &dTree&dTree是一个易于使用的JavaScript树形菜单控件。支持无限分级,可以在同一个页面中放置多个dTree,可以为每个节点指定不同的图标。& &Yahoo! UI Library: TreeView&YUI TreeView Control这个树形组件,支持通过XMLHttpRequest对象动态加载节点数据,自定义每一个节点metadata。 &&& &Fonshen JS MenuTree&风声JS菜单树,程序基于JavaScript/XHTML/CSS标准实现。支持丰富的功能/表现定制:拥有表现和数据分离,单页面可以应用多个无限级菜单树,多达4种展开模式,风格样式定义结构清晰、灵活又精细等等特性。&&& &Control.Treeview&采用Mootools开发的树形菜单控件。支持通过Ajax动态获取节点,设置默认选中某些节点。&&& &Folder Tree&文件夹树形控件。支持利用拖放(drag and drop)操作来重新排序节点,利用Ajax更新节点。&
&&&&&&&&&共3页『 &&1&&&&&&&&』
&&相关经验 ->
&&相关文档 ->
&&相关资讯 ->
&&相关代码 ->QCombox 下拉列表能实现 Tree 状结构吗?该如何解决 - QT开发当前位置:& &&&QCombox 下拉列表能实现 Tree 状结构吗?该如何解决QCombox 下拉列表能实现 Tree 状结构吗?该如何解决&&网友分享于:&&浏览:0次QCombox 下拉列表能实现 Tree 状结构吗?QCombox&下拉列表能实现&Tree&状结构吗?------解决思路----------------------
应该是#include&&QTreeView&而不是QTreeWidget.
下面给你一个使用MVC的代码参考下:
#include&&QApplication&
#include&&QFileSystemModel&
#include&&QTreeView&
#include&&QListView&
int&main(int&argc,&char&*argv[])
&&&&QApplication&app(argc,&argv);
&&&&//&创建文件系统模型
&&&&QFileSystemModel&
&&&&//&指定要监视的目录
&&&&model.setRootPath(QDir::currentPath());
&&&&//&创建树型视图
&&&&QTreeView&
&&&&//&为视图指定模型
&&&&tree.setModel(&model);
&&&&//&指定根索引
&&&&tree.setRootIndex(model.index(QDir::currentPath()));
&&&&//&创建列表视图
&&&&QListView&
&&&&list.setModel(&model);
&&&&list.setRootIndex(model.index(QDir::currentPath()));
&&&&tree.show();
&&&&list.show();
&&&&return&app.exec();
12345678910
12345678910
12345678910 上一篇:下一篇:文章评论相关解决方案暂无相关解决方案Copyright & &&版权所有tree 实现多层树结构的展示,支持无限层次。操控简单。 android 238万源代码下载-
&文件名称: tree
& & & & &&]
&&所属分类:
&&开发工具: Java
&&文件大小: 78 KB
&&上传时间:
&&下载次数: 41
&&提 供 者:
&详细说明:实现多层树结构的展示,支持无限层次。操控简单。-Achieve multi-tree structure display, supports unlimited levels. Simple manipulation.
文件列表(点击判断是否您需要的文件,如果是垃圾请在下面评价投诉):
&&多层树完美实现\.classpath&&..............\.project&&..............\AndroidManifest.xml&&..............\default.properties&&..............\src\com\gao\tree\TreeElement.java&&..............\...\...\...\....\TreeView.java&&..............\...\...\...\....\TestView.java&&..............\res\values\strings.xml&&..............\...\layout\outline.xml&&..............\...\......\testview1.xml&&..............\...\drawable-mdpi\icon.png&&..............\...\.............\outline_list_collapse.png&&..............\...\.............\outline_list_expand.png&&..............\...\.........ldpi\icon.png&&..............\...\.........hdpi\icon.png&&..............\...\.............\outline_list_collapse.png&&..............\...\.............\outline_list_expand.png&&..............\gen\com\gao\tree\R.java&&..............\bin\com\gao\tree\TreeView.class&&..............\...\...\...\....\TreeElement.class&&..............\...\...\...\....\R$string.class&&..............\...\...\...\....\R$drawable.class&&..............\...\...\...\....\R.class&&..............\...\...\...\....\R$attr.class&&..............\...\...\...\....\R$layout.class&&..............\...\...\...\....\R$id.class&&..............\...\...\...\....\TestView.class&&..............\...\...\...\....\TestView$TreeViewAdapter.class&&..............\...\...\...\....\TestView$TreeViewAdapter$ViewHolder.class&&..............\...\...\...\....\TestView$1.class&&..............\...\...\...\....\TestView$TreeViewAdapter$1.class&&..............\...\...\...\....\TreeView$TreeViewAdapter$1.class&&..............\...\...\...\....\TreeView$TreeViewAdapter$ViewHolder.class&&..............\...\...\...\....\TreeView$TreeViewAdapter.class&&..............\...\classes.dex&&..............\...\resources.ap_&&..............\...\多层树完美实现.apk&&..............\.settings\org.eclipse.core.resources.prefs&&..............\src\com\gao\tree&&..............\gen\com\gao\tree&&..............\bin\com\gao\tree&&..............\src\com\gao&&..............\gen\com\gao&&..............\bin\com\gao&&..............\src\com&&..............\res\values&&..............\...\layout&&..............\...\drawable-mdpi&&..............\...\drawable-ldpi&&..............\...\drawable-hdpi&&..............\gen\com&&..............\bin\com&&..............\src&&..............\res&&..............\gen&&..............\bin&&..............\.settings&&多层树完美实现
&相关搜索:
&输入关键字,在本站238万海量源码库中尽情搜索:
&[] - 从sdk中整理出来的3d切换界面效果,利用了Animation
&[] - android基本控件使用方法。例如button,listview,menu,textview,spinner等。
&[] - android开发的视频通话程序,在Android1.6系统上开发,能实现远程手机视频通话,不知道你信不信,反正我信了!
&[] - android聊天室,采用Socket网络编程方式
&[] - android 经典demo listview分页实现,
&[] - android基本控件使用方法。例如button,listview,menu,textview,spinner等。
&[] - android MAPABC 4.2 InvokeJar源代码。
&[] - 利用ListView实现的具有树形结构的List
&[] - android下的多重树形结构的实现。可以编译,运行。

我要回帖

更多关于 jquery实现树状结构图 的文章

 

随机推荐