Results 1 to 2 of 2

Thread: add itel to QListView 4.7

  1. #1
    Join Date
    Oct 2011
    Posts
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default add itel to QListView 4.7

    Hi I am new at Qt; I am developing an application in Python I do not know how to add string to QListView, in internet I found some posts, that adviced me to use insertItem but this has been removed in the new version of QT, so I do not know how to list item(just string in my case)
    thank you in advance

  2. #2
    Join Date
    Dec 2011
    Posts
    11
    Platforms
    Unix/X11

    Default Re: add itel to QListView 4.7

    did you find a solution? because i need this...
    actually i am trying to add a string into a QListWidget but i am new to QT and i don't know how to do it, here is my code

    am writing in python

    Qt Code:
    1. #!/usr/bin/env python
    2. import sys
    3. from PyQt4.QtCore import *
    4. from PyQt4.QtGui import *
    5.  
    6.  
    7. class MainWindow(QMainWindow):
    8. def __init__(self):
    9. QMainWindow.__init__(self)
    10. lb = QListWidget()
    11. QListWidget.addItem(self, hello)
    12. lb.doubleClicked.connect(self.someMethod)
    13.  
    14. grid = QGridLayout()
    15. grid.addWidget(lb, 0, 0)
    16.  
    17. def someMethod(self):
    18. print "It happened!"
    19.  
    20. app = QApplication(sys.argv)
    21. form = MainWindow()
    22. form.show()
    23. app.exec_()
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. QListView
    By Maluko_Da_Tola in forum Newbie
    Replies: 3
    Last Post: 10th August 2010, 22:21
  2. Use of QListView
    By BrainStorm in forum Qt Programming
    Replies: 5
    Last Post: 3rd August 2010, 04:39
  3. QListView
    By Yayati.Ekbote in forum Qt Programming
    Replies: 1
    Last Post: 23rd January 2010, 18:50
  4. [QT3] QListView
    By incapacitant in forum Qt Programming
    Replies: 5
    Last Post: 29th January 2006, 14:31
  5. QListView
    By dragon in forum Newbie
    Replies: 1
    Last Post: 25th January 2006, 21:08

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.