tags:

views:

370

answers:

2

Hi,

How can I place a Qt4 widget just above the system tray on windows. Since exact coordinates may depend on resolution and even the size and placement of the task bar(top or bottom of the screen etc.)?

I think there is probably a method for getting the screen resolution, but is there any method for getting the size of the taskbar and placement?

+1  A: 

No, there isn't.

You can get the screen size using QDesktopWidget - this will give you the number of screens, screen size etc. However, finding the location of the task bar, and then the system tray is platform specific.

Why do you want to do this? Are you trying to emulate a QSystemTrayIcon? Perhaps if you told us what you're trying to do we may be able to help you.

Thomi
When I click to system tray icon i want my window to be appeared right above (or below, near, depends on the placement of the taskbar) of the system tray icon. I don't think it is emulating the QSystemTrayIcon or is it?
prometeus
Ahh, I see.Unfortunately, the system tray object is not a QWidget-derived class, so you can't get it's screen geometry. I suspect you will end up relying on platform-specific system calls for this one.
Thomi
+1  A: 

Answering my own question, but apparently with Qt 4.3 I can get the coordinates of the tray icon using QSystemTrayIcon.geometry() method. So I can place my window relatively. It would be even better if I could get the position of the task bar but I guess I can figure out something for it.

http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qsystemtrayicon.html#geometry

prometeus
im trying to do also something like this,is it working for you ?