Results 1 to 4 of 4

Thread: pygtk to pyqt4 help

  1. #1
    Join Date
    Jul 2009
    Location
    Valladolid, Spain
    Posts
    125
    Thanks
    16
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Question pygtk to pyqt4 help

    Hi all, I have this in pygtk:

    Qt Code:
    1. self._model = gtk.TreeStore(gtk.gdk.Pixbuf, object, str, str, bool)
    2. ...
    3. self._model.append(None, [None, None, gid, gid, False])
    To copy to clipboard, switch view to plain text mode 

    I want to convert this code to pyqt4. I'm using a QStandardItemModel.

    Qt Code:
    1. self._model = QStandardItemModel(self)
    2. ...
    3. self._model.appendRow(????????????????)
    To copy to clipboard, switch view to plain text mode 

    Is there something similar to gtk.TreeStore in pyqt4?

    Thanks

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: pygtk to pyqt4 help

    With a simple lookup in the docs you could have found: QTreeView with a custom/existing model (e.g. QDirModel) or QTreeWidget with QTreeWidgetItem.
    Or read the doc about QStandardItemModel there is a example for using it with a tree.

  3. #3
    Join Date
    Jul 2009
    Location
    Valladolid, Spain
    Posts
    125
    Thanks
    16
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: pygtk to pyqt4 help

    Thanks. I think I'll use the standarditemmodel.
    I have another question, related to this one.

    I'm using the QStandardItemModel, and I swear I red all the methods and I can't find nothing equivalent to GtkTreeModel::get_iter_first.
    Can you help me?
    Last edited by alexandernst; 19th July 2009 at 23:25. Reason: updated contents

  4. #4
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: pygtk to pyqt4 help

    Quote Originally Posted by alexandernst View Post
    can't find nothing equivalent to GtkTreeModel::get_iter_first.
    I don't know what that iterator is for, but if you want to iterate through all items in your model, you could use two for-loops with rowCount and columnCount and construct a QModelIndex with index() out of them.

Similar Threads

  1. Replies: 6
    Last Post: 26th April 2010, 16:47
  2. 64-bit PyQt4 on Mac?
    By keflavich in forum Installation and Deployment
    Replies: 0
    Last Post: 4th July 2009, 01:25
  3. mouse move event filtering in PyQt4
    By lucaf in forum Qt Programming
    Replies: 1
    Last Post: 4th April 2009, 14:53
  4. keypressevent with pyqt4
    By coldlin in forum Qt Programming
    Replies: 3
    Last Post: 3rd October 2007, 16:52
  5. PyQt4 to Py3exe problem
    By WinchellChung in forum Newbie
    Replies: 3
    Last Post: 9th August 2007, 19:33

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.