[Interest] Problem with QPixmap.

Igor Mironchik igor.mironchik at gmail.com
Sun Apr 19 18:39:35 CEST 2015


Hi,

On Sun, 19 Apr 2015 13:28:30 +0300, Till Oliver Knoll  
<till.oliver.knoll at gmail.com> wrote:

>
>
>> Am 19.04.2015 um 06:54 schrieb Igor Mironchik  
>> <igor.mironchik at gmail.com>:
>>
>> Hi,
>>
>> On Sun, 19 Apr 2015 00:04:08 +0300, Thiago Macieira
>> <thiago.macieira at intel.com> wrote:
>>
>>>> On Friday 17 April 2015 19:53:01 Igor Mironchik wrote:
>>>> I have one problem: pixmap "usb-disconnected.png" doesn't draws
>>>> correctly.
>>>> Draws absolutely nothing. And if click on this button application
>>>> crashes.
>>>> What is the problem? Thank you.
>>>
>>> Hi Igor
>>>
>>> You're not a newbie. You know better than to say "it crashes" and not
>>> provide
>>> a backtrace of the crash...
>>
>> Thank you, Thiago... You pointed me to the right direction. I found the
>> problem.
>
> Mind sharing your solution (even if it was something stupid or trivial)?  
> Others might stumble over the same (beginner's) mistake and profit from  
> your tip!
>
> But stiring up dust on a mailing list like "it crashes! doesn't work",  
> even providing example code for others to study (which costs them time!)  
> and then go like "thanks all, I have found the problem (but I won't tell  
> you)!" is a bit "one-sided".
>
> Glad you solved it though.

I'm sorry that I didn't provide solution and that you lost time. The  
problem was very simple: I forgot to initialize private implementation in  
the constructor of the class (d-ptr)...

I.e.

USBButton::USBButton( QWidget * parent )
     :    QWidget( parent )
     ,    d( new USBButtonPrivate( this ) ) // This line was missed.
{
}

>
> Cheers,
>   Oliver
>
> P.S. I rarely open attachments, unless curiosity about the problem  
> really overtakes me. So IMHO it's better to extract /relevant/ code  
> (snippets) and show it in the email.
>
> In general it is also polite to disect (digest) the code yourself first  
> a little bit and say "Here I do this" and "There I expect the code to  
> behave like that" etc., when you expect others to spend time and study  
> your code.
>
> You can then still attach a /minimal/ example which is fully compileable  
> (qmake; make), for those who caught interest. Besides, attachments are  
> /not/ archived (usually) in mailing list archives! (Another good reason  
> to show code snippets directly in the email - helps others in the  
> future, keeps the Internet a happy place ;)).
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest


-- 
Best Regards,
Igor Mironchik.



More information about the Interest mailing list