[PyQt] Bad images are shown in QToolTip
Jan Kaluza
hanzz.k at gmail.com
Mon Aug 11 12:24:22 BST 2008
Hi,
Since Qt4.4 I have problems with every widget which uses rich text
(QTooltip, QTextEdit, QTextBrowser ...). I will demonstrate my problem
on QToolTip. I create two widgets and set their tooltip to show image.
When I try to show tooltip from first widget (simply by mouse as usual)
and then move mouse above second widget then image from first widget is
shown instead of the second one. Maybe it's Qt fault, so tell me if it
is please and I will create task in Trolltech Tracker and rewrite this
example to C++.
I'm using latest stable PyQt from binary installer.
Here is example code (Please change the path to two images to images
which exist on your computer):
try: from PyQt4 import QtCore, QtGui
except: print "PyQt4 is not installed."
app=QtGui.QApplication([])
w=QtGui.QWidget()
layout=QtGui.QVBoxLayout(w)
w1=QtGui.QWidget(w)
w1.setToolTip('<img src="C:\\Users\\hanzz\\Pictures\\rosterstyles3.png"
width="128" height="128"/>')
layout.addWidget(w1)
w2=QtGui.QWidget(w)
w2.setToolTip('<img src="C:\\Users\\hanzz\\Pictures\\rosterstyles2.png"
width="128" height="128"/>')
layout.addWidget(w2)
w.show()
app.exec_()
Thanks for answer
Jan Kaluza
More information about the PyQt
mailing list