Out of curiosity, did you set the flags of the items in the model to allow selections?
Adam On Tue, Sep 9, 2008 at 1:11 PM, Wim Verhavert <[EMAIL PROTECTED]> wrote: > Sounds easy he, but this one is really driving me crazy... > > So here's what I've done so far. > > Ok: I have a QTreeview (using QT Designer by the way) filled with > objects using my own homebrew objectTableModel(QAbstractTableModel). > This model stores POPO's and allows me to retrieve them. So far no > problem. Now I want to highlight + select the last item of the tree > (using code). > So here's what I've done: > - I created an instance of objectTableModel for storing my invoices > -> invoiceModel > - I created a method getIndexOf(self, object) in my objectTableModel > class which returns a QModelIndex instance. Then I do: > > last = self.invoiceModel.getIndexOf(self.invoices[-1]) > self.treeInvoices.selectionModel().select(last, QItemSelectionModel.Rows) > > But this doesn't do anything. > > I also tried: > last = self.invoiceModel.getIndexOf(self.invoices[-1]) > self.treeInvoices.setSelection(self.treeInvoices.visualRect(last), > QItemSelectionModel.Rows) > > But this also doesn't do anything... > > Am I just too blind to see the thing here? This is keeping me up for > hours now... > > Any help greatly appreciated... > > Oh yeah: I'm on windows here (XP pro) > _______________________________________________ > PyQt mailing list [email protected] > http://www.riverbankcomputing.com/mailman/listinfo/pyqt > _______________________________________________ PyQt mailing list [email protected] http://www.riverbankcomputing.com/mailman/listinfo/pyqt
