[PyQt] Model/View programming and QFileSystemModel

2010-11-14 Thread Gaƫtan Podevijn
Hello, I'm trying to understand the model/view programming while making a kind of tag-based browser. I have some absoluteFilePath in a database associated to one ore more tags (which are strings) . I'm trying to display those files (or directories of course) in a view. Hence, I created a subclass

Re: [PyQt] Model/View programming

2010-05-06 Thread Philippe Crave
finally, I did it like that: I don't know if it's a good way to access the model in the view, but it works class CustomQTableView(QTableView): def __init__(self): super(CustomQTableView, self).__init__() def show_hide_rows(self, choice): """choice comes from a checkox""

Re: [PyQt] Model/View programming

2010-05-06 Thread Scott Frankel
I have not yet found a better way to do this than by first building a list of rows you want to be visible, then setting the model's filter with setFilter(). On May 6, 2010, at 12:24 PM, Philippe Crave wrote: Yes, I use that in the model also. but now, I need to iterate over the row, in

Re: [PyQt] Model/View programming

2010-05-06 Thread Philippe Crave
Yes, I use that in the model also. but now, I need to iterate over the row, in the tableView. I want to hide row when the data is an empty string. I found that I can get the string with self.currentIndex().data().toString() so, I suppose that I have to find a way to modify the currentIndex 2010/5

Re: [PyQt] Model/View programming

2010-05-06 Thread Scott Frankel
On May 6, 2010, at 9:46 AM, Philippe Crave wrote: actually, I just want to loop over the rows. I do not find a max_row, or an iterator over the rows of a Table. Take a look at your model's rowCount() and record() methods. I think you'll want to be iterating over the records in your model,

Re: [PyQt] Model/View programming

2010-05-06 Thread Philippe Crave
actually, I just want to loop over the rows. I do not find a max_row, or an iterator over the rows of a Table. 2010/5/6 Philippe Crave : > thank you, both of you ! > I will check the filtering solution. > I am now implementing the setColumnHidden. just have to customize a > QTableView class. seems

Re: [PyQt] Model/View programming

2010-05-06 Thread Philippe Crave
thank you, both of you ! I will check the filtering solution. I am now implementing the setColumnHidden. just have to customize a QTableView class. seems simple. by the way, do you know how to get the total number of row in a table ? i must be blind, but I could not find it. 2010/5/6 Christian Br

Re: [PyQt] Model/View programming

2010-05-06 Thread Benjamin Sonnemann
perhaps setColumnHidden is what you seek? http://doc.trolltech.com/4.6/qtableview.html#setColumnHidden Am 06.05.2010, 17:15 Uhr, schrieb Philippe Crave : looks like that I have to do a QAbstractTableModel for each QTableView, no ? sounds strange, I thought that the idea was to have only o

Re: [PyQt] Model/View programming

2010-05-06 Thread Philippe Crave
looks like that I have to do a QAbstractTableModel for each QTableView, no ? sounds strange, I thought that the idea was to have only one model that will serve data to several views. 2010/5/6 Philippe Crave : > Hello, > > I am reading the chapter 14 of Mark Summerfield. > I work with custom model

[PyQt] Model/View programming

2010-05-06 Thread Philippe Crave
Hello, I am reading the chapter 14 of Mark Summerfield. I work with custom model and custom delegate. in the sample from the book, we have 1 tableView linked to one model. It's simple to get 2 tableView linked to the same model. my Model has got 4 columns. I would like that TableView_1 show the

Re: [PyQt] Model/View programming

2009-09-25 Thread Lukas Hetzenecker
Hello, thanks for your help again. It works like a charm now. Lukas Am Donnerstag 24 September 2009 21:11:34 schrieb David Boddie: > On Tue Sep 22 01:37:33 BST 2009, David Boddie wrote: > > I tried running your test case and found that the view displayed various > > items in an incomplete way -

Re: [PyQt] Model/View programming

2009-09-24 Thread David Boddie
On Tue Sep 22 01:37:33 BST 2009, David Boddie wrote: > I tried running your test case and found that the view displayed various > items in an incomplete way - when you see trailing branches, it's a sure > sign that something isn't quite right. > > I'll try and take a look at this tomorrow unless s

Re: [PyQt] Model/View programming

2009-09-21 Thread David Boddie
On Mon, 21 Sep 2009 13:20:33 +0200, Lukas Hetzenecker wrote: > When I get a reply from the phone (some items) I don't know how to get the > parent QModelIndex for the directory (internal pointer). Currently I store > the index in my internal class and update it on every createIndex call - is > the

[PyQt] Model/View programming

2009-09-21 Thread Lukas Hetzenecker
Hello, i have some problems with my first attempt to use Model/View programming: I tried to create a Model for a directory list. The folders are located on a mobile phone and I get the content over Obex and Bluetooth, so the communication can be really slow -> The model should be asynchronous.