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

List:       kde-pim
Subject:    Re: [Kde-pim] [patch] korganizer - printing calendar item recurrence
From:       Ingo =?iso-8859-1?q?Kl=F6cker?= <kloecker () kde ! org>
Date:       2008-09-02 21:18:47
Message-ID: 200809022318.51888 () thufir ! ingo-kloecker ! de
[Download RAW message or body]

[Attachment #2 (multipart/signed)]


On Tuesday 02 September 2008, Allen Winter wrote:
> On Sunday 31 August 2008 11:00:15 Ron Goodheart wrote:
> > > Date: Thu, 21 Aug 2008 22:18:50 -0700
> > > From: "Ron Goodheart" <ron.goodheart@gmail.com>
> > > Subject: [Kde-pim] [patch] korganizer - printing calendar item
> > >        recurrence
> > > To: kde-pim <kde-pim@kde.org>
> > >
> > > HI all,
> > > Got the following on my printout when printing my scheduled event
> > > on korganizer. "Repeat: TODO: Convert Repeat to String!"
> > >
> > > So created the attached patch to print the recurrence
> > > information.
>
> Committed.
>
> I mostly used what you had.  I replaced the STL ::push_back() style
> stuff with the plain old << operator.

IMO QList::push_back() (or QList::append()) is preferable to 
QList::operator<<(). Why? Well, what does the following do?

  const QVariantList a;
  QVariantList b;
  b << a;

Note that QVariantList is a typedef for QList<QVariant> and that there 
are two overloads of QList::operator<<():
  QList<T> & operator<< ( const QList<T> & other ) 
  QList<T> & operator<< ( const T & value )

So, is the above equivalent to
  b.push_back( a );
or is it equivalent to
  b = b + a;
or does it probably fail to compile?

Solution: It is equivalent to
  b = b + a;


Funny enough in Qt 3 it was equivalent to
  b.push_back( a );
because QValueList did have only one variant of operator<<(), namely
  QValueList<T> & operator<< ( const T & x )

What a great way to shoot yourself in the foot when you port Qt 3 code 
to Qt 4. All of the sudden you have flat variant lists instead of a 
nested ones.


So, that's why I prefer the explicit push_back() or append() over the 
sometimes ambiguous operator<<() (except for ad-hoc creation of lists 
as in someMethod( QStringList() << "foo" << "bar" )).


Regards,
Ingo

["signature.asc" (application/pgp-signature)]

_______________________________________________
KDE PIM mailing list kde-pim@kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/

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

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