[Panel-devel] Propsed change: boundingRect() vs. contentSize()

Alex Merry huntedhacker at tiscali.co.uk
Wed Jul 25 15:54:35 CEST 2007


Attached is a proposed API change.  I've got a test applet (which I will 
commit, because it's very useful for debugging), the digital clock and 
the dictionary applets working correctly with it (well, the dictionary 
one needs work to make it display the arrows, but...)

Basically, rather than specifying the boundingRect(), applets implement 
a virtual method
QSizeF contentSize() const
detailing what size they need for content.  If no background is being 
drawn, Plasma::Applet::boundingRect() just returns a rectangle of the 
requested size anchored at (0,0).

If a background is drawn, the boundingRect() may be larger to take this 
into account.  However, the area for content will be anchored at (0,0) 
and of the requested size.

So the following works as expected:
MyApplet::MyApplet(...) : ..., m_edit(new Plasma::LineEdit(this)) {
  setDrawDefaultBackground(true);
}
QSizeF contentSize() const {
  m_edit->sizeHint();
}

(in fact, this is exactly what the test applet I wrote does).

Comments?  OK to commit?

Alex


-- 
KDE: http://www.kde.org
Ubuntu/Kubuntu: http://www.ubuntu.org http://www.kubuntu.org
Please avoid sending me Word or PowerPoint attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: plasma-rects.diff
Type: text/x-diff
Size: 6995 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/panel-devel/attachments/20070725/f6e28424/attachment.bin 
-------------- 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/20070725/f6e28424/attachment.pgp 


More information about the Panel-devel mailing list