Qlist<pixmap> sembolList pass another class only via pointer.
I have QPixmaps array QList ,
mainwindow.h file
Code:
QList<QPixmap> sembolList;
mainwindow.cpp file
Code:
sembolList <<
QPixmap(":/images/9_maca.png");
sembolList <<
QPixmap(":/images/10_maca.png");
sembolList <<
QPixmap(":/images/11_maca.png");
...
...
I want to send another classes (more than one) as constructor parameter sembolList but not instance or copy , only use its adress . in other words , I do not want to take up space in memory. one time create and dynamically use all my class. How to make that?
Re: Qlist<pixmap> sembolList pass another class only via pointer.
The QPixmap class is implemented with internal data sharing, so when you pass an instance of the class by value (as you are doing with QList< QPixmap >), the pixel data is -not- copied. So you can pass your QList<> by reference or by value. If you pass by value (QList<> mylist, instead of QList<> & mylist) then the only thing copied is the list itself. The QPixmap instances in the list are not copied, only their reference counts are incremented.
See the "Detailed Description" in the QPixmap documentation and the "Implicit Sharing" overview in the Qt Core documentation.