On Sun, 23 Mar 2008, Tomasz 'Trog' Welman wrote:
>
> Look at this code:
>
> QSystemTrayIcon sysTray = new QSystemTrayIcon(new
> QIcon("images/icon.png"),this);
> sysTray.show();
> QRect g = sysTray.geometry();
> System.out.println(g.width()+" - "+g.height());
>
> The above code prints strange random values, like that:
> 512 - 307
>
> Why is that? The icon original size is 48x48 and I'm using X11,
> so it should be scaled to 22x22 & the expected output should be:
> 22 - 22
>
> The g.x() & g.y() methods return correct values (always :>).
>
>
Ok. I've figured it out:
QAbstractEventDispatcher.instance().processEvents(QEventLoop.ProcessEventsFlag.AllEvents);
after the constriction of the main application object (all other gui/non
gui objects container) (outside it's constructor), but before geometry()
request did the trick.
I thing the system tray wasn't (fully) created yet, and processEvents()
created it.
--
Tomasz 'Trog' Welman
_______________________________________________
Qt-jambi-interest mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt-jambi-interest