[Development] Qt Platform Extras

Tor Arne Vestbø tor.arne.vestbo at digia.com
Thu Feb 28 14:42:53 CET 2013


On 2/25/13 17:12 , Joerg Bornemann wrote:
> On 25/02/2013 16:27, Jake Thomas Petroules wrote:
>
>> I'd prefer Qt namespace with no platform indicators, i.e.:
>>
>> Qt::toHICON
>> Qt::toHBITMAP
>> Qt::toCGImageRef
>> Qt::toNSString

I'm probably missing something obvious here, but why are these not with 
the class that they convert from?

- conversion operator (or toFoo function if expensive)
- constructor (explicit if expensive)

If it's not an expensive conversion, it should just be:

class QRect
{
#if defined(Q_OS_MAC)
     QRect(const CGRect& rect);
     operator CGRect() const;
#endif
};

So that I can write code like this:

   someQtFunction(someCGRect);
   someCocoaFunction(someQtRect);

Without having to wrap it in QRect::to/from -- or even worse, some sort 
of global namespace for all to/from conversion functions.

tor arne



More information about the Development mailing list