[Development] qpa api - current status

Samuel Rødal samuel.rodal at nokia.com
Thu May 31 08:12:55 CEST 2012

On 05/31/2012 03:45 AM, ext Girish Ramakrishnan wrote:
> On Tue, May 29, 2012 at 2:46 AM, Jørgen Lind <jorgen.lind at nokia.com> wrote:
>> 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.
> I have pushed changes now to remove QCursor::handle, QFont::handle(),
> QRegion::handle().
> What's remaining is:
> ./opengl/qopenglframebufferobject.h:    GLuint handle() const;
> ./image/qpixmap.h:    QPlatformPixmap* handle() const;
> ./kernel/qopenglcontext.h:    QPlatformOpenGLContext *handle() const;
> ./kernel/qwindow.h:    QPlatformWindow *handle() const;
> ./kernel/qscreen.h:    QPlatformScreen *handle() const;
> ./kernel/qplatformscreenpageflipper.h:    virtual void *handle() const = 0;
> ./painting/qbackingstore.h:    QPlatformBackingStore *handle() const;

The QOpenGLFramebufferObject's handle can be quite useful for the
application developer (it's really the framebuffer object id that's
passed to glBindFramebuffer etc), so it's not of the same sort as the
others :)

The QPlatformScreenPageFlipper's handle() is probably also of a
different sort.


More information about the Development mailing list