[Development] qpa api - current status

Jørgen Lind jorgen.lind at nokia.com
Tue May 29 11:46:34 CEST 2012


On Tue, May 29, 2012 at 10:52:30AM +0200, Knoll Lars (Nokia-MP/Oslo) wrote:
> On 5/29/12 8:22 AM, "ext Jørgen Lind" <jorgen.lind at nokia.com> wrote:
> 
> >Hi
> >> 6. Rename the handle() to platformXXX() since it's easy to educate
> >> that anything that has platform in it is out of reach of app
> >> developers.
> >> Status: In progress, I am atm, marking handle() as obsolete and as an
> >> alias to platformXXX().
> >
> >But since when did the word handle() mean anything else in API design?
> >Im all for clear and verbose function names, but think this is just
> >making the api ugly. To me if you ask for a handle of a class you will
> >get the underlying structure. It then should be crystal clear to the
> >developer that this class can not be used as a public class.
> 
> The problem is that handle() is very unspecific, and that code ported from
> Qt 4.x to Qt 5 will silently break when people call handle(), as you get
> something else back then you thought you would.
> 
> Renaming the methods at least turns the silent breakage into an explicit
> one.

QWidget is not a QWindow subclass. For QFont's handle(), this function
should be considered removed for Qt 5, since its hardcoded to return 0.
QCursor has also a handle function which doesn't look right to me at
first glance.

My point was actually just to justfy why we used the handle() functions
in the first place. Believe it or not, we used to have platformWindow
for QWidget back when there was no QWindow. But it never looked so good
in use.

Jørgen



More information about the Development mailing list