PDA

View Full Version : add itel to QListView 4.7



arpho
26th October 2011, 13:33
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

clepto
19th December 2011, 19:12
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


#!/usr/bin/env python
import sys
from PyQt4.QtCore import *
from PyQt4.QtGui import *


class MainWindow(QMainWindow):
def __init__(self):
QMainWindow.__init__(self)
lb = QListWidget()
QListWidget.addItem(self, hello)
lb.doubleClicked.connect(self.someMethod)

grid = QGridLayout()
grid.addWidget(lb, 0, 0)

def someMethod(self):
print "It happened!"

app = QApplication(sys.argv)
form = MainWindow()
form.show()
app.exec_()