I am getting a wierd compiler error in this code:

Qt Code:
  1. const QObjectList *l = boxLayout->children();
  2.  
  3. for ( unsigned int i = topLine; i != l->count(); i++ )
  4. {
  5. QObject *obj = l->at(i);
  6. if( !((PositionElementLine*)obj)->isChecked() )
  7. firstUnchecked = i;
  8. }
To copy to clipboard, switch view to plain text mode 

gcc objects to line 5 with this message:

error: passing 'const QObjectList' as 'this' argument of 'type* QPtrList<type>::at(uint) [with type = QObject]' discards qualifiers