>> It looks like currentRow() might return -1 sometimes > >You are right, if nothing is selected, it returns -1... > >Andre'
Please correct me if I'm wrong (I'm just trying to understand QT). I was a little vague in the above sentence on purpose, because when I was experimenting with this code yesterday I noticed that even when nothing is selected currentRow() returns 0 (or incidentally something else > 0). That's why I added '&& formatLW->selectedItems().size() > 0' to the patch. My hypothesis: isn't it the case that currentRow() only returns -1 if the list is empty ? According to the documentation of QT : currentRow : int This property holds the row of the current item. Depending on the current selection mode, the row _may_ also be selected. Earlier, I also found that Windows and Linux behaved differently with respect to lists, see http://www.lyx.org/trac/changeset/26054 . For Windows item was NULL when clicking on the whitespace of a list, while for Linux it wasn't. This might be related to the stuff above. Vincent