473,657 Members | 2,447 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

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
2 2606
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::queryL ist()
QObject::child( )

Also try the PyQt list "pykde"
Jul 18 '05 #2
Erwan Adam <er********@cea .fr> wrote in message news:<cn******* ***@ellebore.sa clay.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.itemGeome try(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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

35
7748
by: Vamsi Mudrageda | last post by:
I am kind of new to Python, and after trying and using wxPython, I found it kind of lacking in easy-to-read documentation, speed at loading, and GUI response-time. So I am looking for an another GUI toolkit that is cross-platform for Python, and am leaning toward PyQt (PyGTK is kind of dull looking in comparison). Unfortunately, although TrollTech says Qt is cross-platform, its license strategy has me a bit confused. So here is to...
8
4847
by: simo | last post by:
OK, so I'm at the stage where I want to make a choice between wxPython and PyQt. Currently I'm using wxPython mainly due to the fact that it has GPL Linux and Windows versions. I prefer Qt to wxWindows, but am confused with all the Windows licensing issues. For the moment this is just for my own tinkering and utility apps, but
10
11697
by: Peter | last post by:
I want to draw some lines on a widget. This works ok, but when I want to redraw, the old lines are still there. How do I clear or refresh the widget, so I can draw a new set of lines? Code snip below. TIA Peter
10
2200
by: svenn.are | last post by:
Hi, I wanted to run a program that is written in PyQt on my mac, and went over to Riverbank to get PyQ 3.13 and SIP 4.1.1 sources. I followed the installation guide except for the compiling python as Macosx already has python. I had no problem with compiling SIP and also no problem with compiling PyQt nor did I have any error message during make install.
10
2155
by: Simon John | last post by:
After quite a while of wxPython I'm getting back into PyQt, mainly due to the announcement by Trolltech that they will make a GPL version of Qt4 for Windows (and Phil-T said he will make a PyQt to go with it eventually!) I'm currently using PyQt 3.12 that comes with the BlackAdder demo, it seems to work fine with Python 2.3.5 except that it doesn't support the WinXP look'n'feel, the QStyle "WindowsXP" isn't included, and using a...
9
2360
by: me | last post by:
Hi, I trying to add a menu bar to my main widget. The reslut is, that the menus (like file menu) apear and work ok, but the menubar it self is not being refreshed at all. I looked at all the documantation I could find, and I cant find what I am doing wrong... When my main widget first apears, the area of the menu bar will be full with what ever is behind the main widget at creation time (meaning it had no paint event), and will not...
10
5182
by: Volker Lenhardt | last post by:
For a QApplication (PyQt) on the small screen of my Zaurus 5500 PDA I try to layout my data output in a QScrollView as the central widget. I'd prefer to use QGridLayout, but cannot add it to the scroll view. sc=QScrollView(self) layout=QGridLayout(..., sc.viewport()) sc.addChild(layout) results in a TypeError.
5
1892
by: kobayashi | last post by:
Dear all, For a particuliar case, I need to copy all the items of an existing menu (including the separators and sub-menus) in a new empty one ... Does someone knows how to do that ? I've tried : item = menu_orig.findItem(item_id) menu_new.insertItem(item, item_id) but it fails with : TypeError: argument 1 of QMenuData.insertItem() has an invalid type
0
1831
by: Moezzie | last post by:
So ive got a bit of a problem here. Ive been searching the net about this for quite some time now but i just cant seem to figure out how to open a dialog that ive made in QtDesigner. Of corse i used pyuic4 to make it into python code. This is the code for my dialog window(it contains just a TextEdit and a LineEdit): from PyQt4 import QtCore, QtGui class Ui_Dialog(object): def setupUi(self, Dialog): ...
0
8397
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8310
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8827
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8605
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7333
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6167
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4158
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4315
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1957
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.