By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,187 Members | 1,060 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,187 IT Pros & Developers. It's quick & easy.

[PyQt] How to get the QRect of a QMenuBar (QPopupMenu) item ?

P: n/a
Hi all,

I try to introduce tooltips in my application written
in PyQt (more precisly, in the menubar of my application)
but I can't find a way to get the QRect instance
associated to a QMenuBar item (neither a QPopupMenu item)

I need the QRect 'cause I followed the tooltip.py file
given with pyqt to do the job with a re-implementation
of "maybeTip( self, pos )".

May be it is not the good solution ...

Help is welcome !

Cheers,

E.A.
Jul 18 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Erwan Adam wrote:
Hi all,

I try to introduce tooltips in my application written
in PyQt (more precisly, in the menubar of my application)
but I can't find a way to get the QRect instance
associated to a QMenuBar item (neither a QPopupMenu item)


QObect Class?

QObject::queryList()
QObject::child()

Also try the PyQt list "pykde"
Jul 18 '05 #2

P: n/a
Erwan Adam <er********@cea.fr> wrote in message news:<cn**********@ellebore.saclay.cea.fr>...
I try to introduce tooltips in my application written
in PyQt (more precisly, in the menubar of my application)
but I can't find a way to get the QRect instance
associated to a QMenuBar item (neither a QPopupMenu item)
You need to call the itemGeometry method on your QPopupMenu
object with the index of the menu item you want to examine.

Something like this should work for popup menus:

# popup is a QPopupMenu containing several items
rect = popup.itemGeometry(2) # for the third item in the menu

It may be a little more difficult to get this information out
of QMenuBar because it looks like PyQt can't access the
itemRect function when the menu bar is created by a C++
object, such as a QMainWindow.
I need the QRect 'cause I followed the tooltip.py file
given with pyqt to do the job with a re-implementation
of "maybeTip( self, pos )".


Are you trying to implement tooltips on menu items?

You may find that regulars on the PyQt/PyKDE mailing list can give
you more detailed advice:

http://mats.imk.fraunhofer.de/mailman/listinfo/pykde

Good luck!

David
Jul 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.