On Wed, 18 Jan 2012 12:44:57 -0800, David Cortesi <davecort...@gmail.com> wrote: > Per both the Qt Assistant and the PyQt4 class reference, QStringList > inherits all methods of QList, but the following code produces the > error message, AttributeError: 'QStringList' object has no attribute > 'at'. If I convert the .at(0) to simple [0] indexing, the error moves > on to say "no attribute 'removeFirst'". > > from PyQt4.QtCore import(Qt,QString,QStringList,QRegExp) > def trySplit(us,ur): > qs = QString(us) > qr = QRegExp(ur) > ql = qs.split(qr) > if unicode(ql.at(0)) == u'': # <-- no attribute 'at' > ql.removeFirst() # <-- nor any attribute 'removeFirst' etc. > if unicode(ql.at(ql.size()-1)) == u'': > ql.removeLast() > print('sans leading/trailing nulls, split gives ',ql.count()," items") > for q in ql: > print(u'>'+unicode(q)+u'<') > > It also doesn't seem to have a .size() method, only .count() > > OK, so what am I doing wrong?
Only a subset of the QList methods are implemented. Use the corresponding Python operators instead. Phil _______________________________________________ PyQt mailing list PyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt