comparison libgui/graphics/ListBoxControl.cc @ 20509:7d8ec197b08b

Scroll list view to display selection (bug #45848) * LisboxControl.cc (updateSelection, ListBoxControl::ListBoxControl): scroll to item after selection.
author Pantxo Diribarne <pantxo.diribarne@gmail.com>
date Tue, 01 Sep 2015 19:05:57 +0200
parents f0e61a67ad9f
children
comparison
equal deleted inserted replaced
20508:4c2e76cbdc7d 20509:7d8ec197b08b
46 int idx = xround (value(i)); 46 int idx = xround (value(i));
47 47
48 if (1 <= idx && idx <= lc) 48 if (1 <= idx && idx <= lc)
49 { 49 {
50 list->item (idx-1)->setSelected (true); 50 list->item (idx-1)->setSelected (true);
51 list->scrollToItem (list->item (idx-1));
51 if (i == 0 52 if (i == 0
52 && list->selectionMode () == QAbstractItemView::SingleSelection) 53 && list->selectionMode () == QAbstractItemView::SingleSelection)
53 break; 54 break;
54 } 55 }
55 else 56 else
98 int idx = xround (value(i)); 99 int idx = xround (value(i));
99 100
100 if (1 <= idx && idx <= lc) 101 if (1 <= idx && idx <= lc)
101 { 102 {
102 list->item (idx-1)->setSelected (true); 103 list->item (idx-1)->setSelected (true);
104 list->scrollToItem (list->item (idx-1));
103 if (i == 0 && (list->selectionMode () 105 if (i == 0 && (list->selectionMode ()
104 == QAbstractItemView::SingleSelection)) 106 == QAbstractItemView::SingleSelection))
105 break; 107 break;
106 } 108 }
107 } 109 }