[PyQt] displaying icon and text in one QListWidgetItem on QListWidget

Naoya Makino mackey32 at gmail.com
Mon Jul 13 16:54:22 BST 2009


To whom it may concern

Hi this is Naoya Makino, currently a subscriber of PyQt mail list.
My message was rejected as I was not a subscriber of the email list.
Now I would like to send my message to the mail list.
Please forward the following message to the mail list.

http://www.nabble.com/displaying-icon-and-text-in-one-QListWidgetItem-on-QListWidget-td24455479.html#a24455479

---------- Forwarded message ----------
From: mackey32 <mackey32 at gmail.com>
To: pyqt at riverbankcomputing.com
Date: Sun, 12 Jul 2009 19:57:24 -0700 (PDT)
Subject: [PyQt] displaying icon and text in one QListWidgetItem on QListWidget

I am currently implementing an instant messenger called
http://code.google.com/p/pendulim/ Pendulim  written in Python using PyQt4,
and I am having a trouble with displaying emoticons and text in one line on
chat window.

I am using QListWidget to display conversations and each line as
QListWidgetItem. the trouble is that i cannot add or append QListWidgetItem,
so I can't combine emoticon and string.

this is a chatwindow class.
http://code.google.com/p/pendulim/source/browse/trunk/pendulim/current_build/interface/ChatWindow.py

for example:
item = QtGui.QListWidgetItem(self.convoWindow)
emoticon = QtGui.QListWidgetItem(self.convoWindow)
icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap(path), QtGui.QIcon.Normal, QtGui.QIcon.Off)
emoticon.setIcon(icon)
item.setText(some_string)
#here i would like to combine item and emoticon so that I can display it in
one line

Is there any way to display icon and string in one QListWidgetItem? or is
there any alternative way to meet the need?
I would very appreciate if you could give me any kind of help.
thank you for consideration.

Best regards

Naoya Makino


More information about the PyQt mailing list