PDA

View Full Version : [qt4]QPixmap::fromMimeSource



intrajp
31st December 2008, 02:49
Hi, I ported qt3 code to qt4, but this error happens when I make the code.

####code
setIcon(QPixmap::fromMimeSource("document.png"));
####
and it returns...

editor.cpp: In constructor 'Editor::Editor(QWidget*, const char*)':
editor.cpp:38: error: 'qPixmapFromMimeSource' is not a member of 'QPixmap'


What is wrong and what should I do ?

Thanks in advance.

wysota
31st December 2008, 03:08
Well... there is no such method in Qt4 :) You should use the resource system available in Qt4. Once you place the icon in the resources, you'll be able to load it via:

QPixmap myIcon = QPixmap(":/document.png");

intrajp
31st December 2008, 03:46
Thanks !

It worked.:D