blend function urgently needed in kdelibs

Matthew Woehlke mw_triad at users.sourceforge.net
Tue May 22 19:29:27 BST 2007


Thiago Macieira wrote:
> As for BlendMode, you used Q_DECLARE_FLAGS, but the enum values do not 
> support operation in flags mode. Besides, it doesn't make semantic sense: 
> what would be a Replace, Multiply *and* Add blend?

BlendMode is just an enum... was there a reason (i.e. something I need 
to fix) you thought otherwise?

> In this case, I see no need for a protected "blend" function that doesn't 
> even seem to touch the private members.
> 
> Rule of thumb: if you have no immediate need or use-case for a function, 
> don't publish it. If the need you thought of actually shows up later, you 
> can add it at that time. Exception: virtual functions.

So the "correct" way is to make it a static function in the .cpp? If so 
I'll do that for my next check-in (I'm putting stuff in playground until 
Monday, if you hadn't caught my most recent e-mail).

> The two constructors:
>     KColor( const QColor& );
>     KColor( const KColor& );
> are different in meaning. The latter one is a copy-constructor and it 
> generally makes no sense to make it explicit. So you can leave it as it 
> is.

Yes, I figured that out... things actually break if it's explicit 
(because gcc seems to want a KColor(KColor) copy constructor.

I made the others explicit.

> [snip link]
> In this case, I would say that the whole point is to allow implicit 
> casting, so you want to tell krazy that you know it is implicit. Just add 
> an " // implicit" after it to tell krazy to go away.

Right, thanks. I did that (as mentioned the copy constructor /must/ 
exist or lots of stuff - like trying to return a KColor - breaks).

>>> 4) If you want implicit sharing, use QSharedDataPointer.
>> See conversation with Matt Nowell, this is still in the air.
> 
> I have received no emails from Matt Nowell.

Ack, s/Nowell/Newell/ (sorry, Matt!), they're definitely in this thread. 
http://permalink.gmane.org/gmane.comp.kde.devel.core/42417 for one (yup, 
too lazy to produce a kde.org link, Archived-At is a nice header...).

Thanks again for the advice! As you can probably tell I'm still kinda 
new at KDE... bit of a difference between KATE hacking and building a 
new class from scratch. :-)

-- 
Matthew
"Nobody expects the traditional Bourne shell!"





More information about the kde-core-devel mailing list