[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: KDE Test Report - savesize, optionsShowToolbar()
From:       Michael Pyne <michael.pyne () kdemail ! net>
Date:       2005-11-23 22:37:58
Message-ID: 200511231737.58700.michael.pyne () kdemail ! net
[Download RAW message or body]

[Attachment #2 (multipart/signed)]


On Wednesday 23 November 2005 16:32, Andreas Silberstorff wrote:
> I just wrote
>
> > The QString.fromLatin1() thing might get a better explanation. Looks like
> > I made my "correction" just on the wrong part of the comparison?!
>
> I have to admit I am quite confused about that one. All three versions are
> wrong. But how can I do it right?
>
> else if ( myAudiodev  == "vol" )
> else if ( myAudiodev  == QString::fromLatin1( "vol" )  )
> else if ( QString::fromLatin1( myAudiodev ) == "vol" )

This isn't something you need to worry about.  I'm not even sure that this 
applies to Qt 3.

But basically, if you're only doing a comparison between a QString and a const 
char*, and if QT_NO_CAST_FROM_ASCII is defined (which removes the comparison 
operator between QString and const char *), then there is a way to do the 
comparison without spending a lot of time constructing the QString.

If you instead wrap the const char * in a QLatin1String, you can compare that 
with QString quickly.

i.e.

if ( myAudiodev == QLatin1String("vol") )
{
  // do stuff
}

That way you get the code correctness benefit of QT_NO_CAST_FROM_ASCII without 
the speed penalty of converting const char* to QString.

But like I said, I don't see it in assistant so I'm not sure it's in Qt 3.

As far as the copyright thing is concerned, any files you edit in 2005 are 
technically supposed to have the year 2005 added to the copyright notice.  
Same for 2006, 2007, etc.  If you're looked at the sources for some of the 
GNU utilities you'll notice that they have copyright headers like:

"Copyright (c) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 
2001, 2002, 2003 Free Software Foundation" or something equally extreme.  
Abbreviating it as "Copyright (c) 2003 - 2005 Andreas Silberstoff" should be 
fine.

Regards,
 - Michael Pyne

[Attachment #5 (application/pgp-signature)]

>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic