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:
parent
4f35fdd1e3
commit
01b8beb023
|
@ -1379,11 +1379,7 @@ void Tree::select_single_item(TreeItem *p_selected, TreeItem *p_current, int p_c
|
||||||
|
|
||||||
if (select_mode==SELECT_ROW) {
|
if (select_mode==SELECT_ROW) {
|
||||||
|
|
||||||
|
if (p_selected==p_current && !c.selected) {
|
||||||
if (p_selected==p_current) {
|
|
||||||
|
|
||||||
if (!c.selected) {
|
|
||||||
|
|
||||||
c.selected=true;
|
c.selected=true;
|
||||||
selected_item=p_selected;
|
selected_item=p_selected;
|
||||||
selected_col=0;
|
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)
|
//if (p_col==i)
|
||||||
// p_current->selected_signal.call(p_col);
|
// p_current->selected_signal.call(p_col);
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
} else if (c.selected) {
|
||||||
|
|
||||||
if (c.selected) {
|
|
||||||
|
|
||||||
c.selected=false;
|
c.selected=false;
|
||||||
//p_current->deselected_signal.call(p_col);
|
//p_current->deselected_signal.call(p_col);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if (select_mode==SELECT_SINGLE || select_mode==SELECT_MULTI) {
|
} else if (select_mode==SELECT_SINGLE || select_mode==SELECT_MULTI) {
|
||||||
|
|
||||||
if (!r_in_range && &selected_cell==&c) {
|
if (!r_in_range && &selected_cell==&c) {
|
||||||
|
|
||||||
|
|
||||||
if (!selected_cell.selected) {
|
if (!selected_cell.selected) {
|
||||||
|
|
||||||
selected_cell.selected=true;
|
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");
|
emit_signal("cell_selected");
|
||||||
if (select_mode==SELECT_MULTI)
|
if (select_mode==SELECT_MULTI)
|
||||||
emit_signal("multi_selected",p_current,i,true);
|
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)) {
|
} 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) {
|
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;
|
p_item->cells[p_column].selected=false;
|
||||||
}
|
}
|
||||||
update();
|
update();
|
||||||
|
|
Loading…
Reference in New Issue