Silly programming question

View: New views
2 Messages — Rating Filter:   Alert me  

Silly programming question

by tonyb-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

In Qt3, how does one traverse a QValueListIterator in reverse? It doesn't
provide the toBack(), atFirst() functions like QPtrListIterator (and
QListIterator in Qt4)!!

--
Cheers,

TonyB

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
KMyMoney2-developer mailing list
KMyMoney2-developer@...
https://lists.sourceforge.net/lists/listinfo/kmymoney2-developer

Re: Silly programming question

by Thomas Baumgart :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

on Wednesday 04 November 2009 tonyb wrote:


> In Qt3, how does one traverse a QValueListIterator in reverse? It doesn't
> provide the toBack(), atFirst() functions like QPtrListIterator (and
> QListIterator in Qt4)!!

I've done this somewhere in the code but can't remember where. Now it's too
big :)

You could try this:

  QValueList<xxx> list;
  QValueList<xxx>::const_iterator it;
  it = list.end();
  if(list.count() > 0) {
    do {
      --it; // decrement prior to using the iterator

      // do whatever you need to do here

    } while(it != list.begin());
  }


Hope I remembered this correctly. No guarantee that the syntax is correct :)

--


Regards

Thomas Baumgart

GPG-FP: E55E D592 F45F 116B 8429   4F99 9C59 DB40 B75D D3BA
-------------------------------------------------------------
Please avoid sending me Word or PowerPoint attachments.
 See http://www.gnu.org/philosophy/no-word-attachments.html
-------------------------------------------------------------


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
KMyMoney2-developer mailing list
KMyMoney2-developer@...
https://lists.sourceforge.net/lists/listinfo/kmymoney2-developer

signature.asc (232 bytes) Download Attachment