I have a QList of base class pointers:

Qt Code:
  1. QList<QGraphicsItem*> selectedItems = myGraphicsScene->selectedItems();
To copy to clipboard, switch view to plain text mode 

but I'd like it to be a derived class, e.g., QList<DerivedGraphicsItem*>. Is there any way to do this other than iterating through the list and creating a new one?

Note that in this particular case, I want to static cast, although I'm curious how it would work to dynamic cast in this situation too.