Making deselect work for TreeItem when select_mode is SELECT_SINGLE and item_selected is now properly emitted

(cherry picked from commit 4b9a96859b)
This commit is contained in:
Bruno Ortiz 2016-12-20 19:47:24 -02:00 committed by Rémi Verschelde
parent 4f35fdd1e3
commit 01b8beb023
1 changed files with 6 additions and 16 deletions

View File

@ -1379,11 +1379,7 @@ void Tree::select_single_item(TreeItem *p_selected, TreeItem *p_current, int p_c
if (select_mode==SELECT_ROW) {
if (p_selected==p_current) {
if (!c.selected) {
if (p_selected==p_current && !c.selected) {
c.selected=true;
selected_item=p_selected;
selected_col=0;
@ -1394,23 +1390,16 @@ void Tree::select_single_item(TreeItem *p_selected, TreeItem *p_current, int p_c
}
//if (p_col==i)
// p_current->selected_signal.call(p_col);
}
} else {
if (c.selected) {
} else if (c.selected) {
c.selected=false;
//p_current->deselected_signal.call(p_col);
}
}
} else if (select_mode==SELECT_SINGLE || select_mode==SELECT_MULTI) {
if (!r_in_range && &selected_cell==&c) {
if (!selected_cell.selected) {
selected_cell.selected=true;
@ -1421,6 +1410,8 @@ void Tree::select_single_item(TreeItem *p_selected, TreeItem *p_current, int p_c
emit_signal("cell_selected");
if (select_mode==SELECT_MULTI)
emit_signal("multi_selected",p_current,i,true);
else if(select_mode == SELECT_SINGLE)
emit_signal("item_selected");
} else if (select_mode==SELECT_MULTI && (selected_item!=p_selected || selected_col!=i)) {
@ -2909,8 +2900,7 @@ void Tree::item_selected(int p_column,TreeItem *p_item) {
void Tree::item_deselected(int p_column,TreeItem *p_item) {
if (select_mode==SELECT_MULTI) {
if (select_mode==SELECT_MULTI || select_mode == SELECT_SINGLE) {
p_item->cells[p_column].selected=false;
}
update();