Http://blog.csdn.net/kerry_xiaowei/article/details/6367570
Http://mobile.51cto.com/symbian-270600.htm
The audio and video solutions in QT are as follows:
Phonon framework
QT is really a little rubbish, and a delay is also so troublesome
- Qtime;
- T. Start ();
- While (T. elapsed () <1000)
- Qcoreapplication: processevents ();
- The program keeps responding to events.
Qwaitcondition
Waitcond; waitcond. Wait (400); // or any other
Time in [MS]
Step 2: solve the problem of high CPU usage-make the program sleep properly.
- Qtime T;
- T. Start ();
- While (T. elapsed () <250)
- {
- Qcoreapplication: processevents ();
- Usleep (10000); // both sleep and usleep have been obsolete. We recommend that you use nanosleep instead.
- }
Char * BMP = new char [Len + 1]; memcpy (BMP, (char *) Ba. Data (), Len );
BMP [Len + 1] = '\ 0 ';
Wchar wsz [1024] = {0 };
Swprintf (wsz, Len + 1, l "% s", BMP );
Lpcwstr P = wsz;
Start a new program in QT:
Qprocess: startdetached (qstring: fromwchararray (m_strsetupfile.c_str ()));
In QT, the interface is processed as follows:
Qapp-> processevent ();
Memory Management in QT and Memory leakage handling:
In QT, if a parent is specified in an object definition, the structure of the object is completed by its parent analysis.
For example
Qtoolbar parent;
Qlabel * label = new qlabel ("this is a label", & parent );
Here, the Delete label is completed in the parent destructor.
If multiple objects are released, consider the sequence:
QIcon *ss =
new
QIcon(tempimage);
//2
QPixmap* tempimage1 =
new
QPixmap( ss->pixmap(tempimage.size(),QIcon::Disabled) );
//3
// Memory cannot be released
tempimage1.detach();
deletetempimage1
;
delete
SS
;
Some classes provide other functions called before the delete operation, such as the following detach: tempimage1.detach ();
Delete tempimage1;
Http://blog.csdn.net/zhangshan415/article/details/7986027 check memory leakage
If qpixmap is used for performance problems, you can consider qpixmapcache and use it to solve the problem of excessive memory usage during image display. See the following article:
Http://blog.csdn.net/a324539017/article/details/6567186