[Qt-interest] Why is assignment of overloaded classes not possible with QScopedPointer?

Matthias Pospiech matthias.pospiech at gmx.de
Sun Apr 25 10:10:58 CEST 2010


Thiago Macieira schrieb:
> Em Domingo 25. Abril 2010, às 00.10.27, Matthias Pospiech escreveu:
>   
>> This code does not compile
>>     QScopedPointer<QPlotFunction> function;
>>     switch (functionID)
>>     {
>>     case PlotFunction::Gauss:
>>         function = new GaussianFunction;
>>     
> [snip]
>   
>> anyone knows why ?
>>     
>
> Because there's no operator=()
>
> You have to write:
> 	function.reset(new GaussianFunction);
>   
You are right, I completely forgot that this is a smart pointer...

Matthias



More information about the Qt-interest-old mailing list