Middle Clicking on BookmarkBar and BookmarkMenu entries

Daniel Teske teske at squorn.de
Mon Dec 13 20:39:51 GMT 2004


>Yes. I was just wondering if we could connect to another signal from KToolbarButton
>instead (like in Stefan's patch).
>  
>
For KToolbarButton, another signal middleclicked() would be possible and 
would certainly fit.
KAction would need to catch all three signals. Adding it to 
KToolBarButton::eventFilter would be easy.
That seems reasonable to me.

For KPopupMenu emitting such a signal doesn't feel right, because we 
can't know which menuitem was activated, alas if there isn't another 
way, emitting a signal to every function which I redefined.

>>>+    const QString & url = sender()->property("url").toString();
>>>Looks dangerous to me - the ref could easily become dangling.
>>>Better use "[const] QString url = ..." without the ref, we have implicit sharing anyway.
>>> 
>>>
>>>      
>>>
>>I don't understand what you mean by dangling. That const reference is 
>>perfectly safe, it avoids the cost of one copy constructor.
>>    
>>
>Well if the compiler decides that the QString returned by toString() isn't useful
>anymore, it might get rid of it - there is no other var holding the string anymore.
>We've had crashes in KonqRun when keeping a reference to a QString, and the
>object holding the QString got deleted - and the reference was dangling (i.e. pointing
>to a deleted object).
>  
>
A const reference to a function return value is safe, the compiler isn't 
allowed to call the destructor until the const reference goes out of scope.

daniel




More information about the kfm-devel mailing list