[PATCH] Tooltip alignment (and all the other popups too)

Aaron J. Seigo aseigo at kde.org
Mon Jan 21 06:38:18 CET 2008


On Friday 18 January 2008, Marco Martin wrote:
> this is another version: i made a new function popupPosition() to calc the
> position, because this is also badly needed for all the popups like kickoff
> and device notifier. because at the moment (at least for kickoff) the case
> of a lateral panel is not managed at all, this should use sane positions
> both in the panel and in the desktop

looks good. it is interesting that the window manager wasn't catching this an 
moving the window to an on-screen location. if it truly isn't, then the patch 
should also take that into consideration. however, i think the window manager 
is *supposed* to do that, so .. this patch looks good to me.

style-wise:

please don't separate lines like these:

+             return QPoint(globalPos.x(),
+                           globalPos.y()+(int)size().height());

onto two lines, and add some space around the + operator. this:

            return QPoint(globalPos.x(), globalPos.y() + 
(int)size().height());

fits just fine. we do all have modern screens and fonts that give us 100 
characters, no? ;) 

and not that it *overly* matters, of course, but one can always raise the 
possibility of avoiding the allocation of another object here by turning 
this:

+    QPoint viewPos = view()->mapFromScene(scenePos());
+    QPoint globalPos = view()->mapToGlobal(viewPos);

into:

+    QPoint pos = view()->mapFromScene(scenePos());
+    pos = view()->mapToGlobal(viewPos);

since viewPos isn't used again and the code is one right after the other in 
usage, i don't consider this overly uglifying.

-- 
Aaron J. Seigo
humru othro a kohnu se
GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA  EE75 D6B7 2EB1 A7F1 DB43

KDE core developer sponsored by Trolltech
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://mail.kde.org/pipermail/panel-devel/attachments/20080120/6d1527be/attachment.pgp 


More information about the Panel-devel mailing list