kis_canvas and widgets

Adrian Page adrian at pagenet.plus.com
Fri Mar 25 13:20:24 CET 2005


Michael Thaler wrote:
> On Friday 25 March 2005 10:44, Michael Thaler wrote:
> 
> 
>>#define ADD_BOX_RELATIVE_TO_SELECTION(type,x,y)    \
>>    ret += QRect ((x), (y), type##AtomicLength, type##AtomicLength)
> 
> 
> O:K., I got it. There are two variables: normalAtomicLength and 
> vertEdgeAtomicLength and type allows it to chose one of them by specifying 
> normal or vertEdge. Actually not that hard to understand, but I get scared 
> everytime I see these macros and somehow my brain turns of then:-)
> 
> But why are the two ## necessary?

That's just the C preprocessor syntax needed to take type and 
AtomicLength and turn them into one symbol. It's a useful trick, but as 
you say, it's not very readable.

Adrian



More information about the kimageshop mailing list