How do i change images? Qt creator label>pixmap
I got errors with my code...
Quote:
ui->label->pixmap(":/new/prefix1/images/solve3.png");
also got errors with this code...
Quote:
char[32] urr = ":/new/prefix1/images/solve3.png";
ui->label->pixmap(urr);
ERRORS:
/Users/martins/showhide/mainwindow.cpp:31: error: no matching function for call to 'QLabel::pixmap(const char [32])'
/Library/Frameworks/QtGui.framework/Headers/qlabel.h:75: note: candidates are: const QPixmap* QLabel::pixmap() const
Re: How do i change images? Qt creator label>pixmap
its QLabel::setPixmap()
Qlabel::Pixmap() returns you the current pixmap.
Re: How do i change images? Qt creator label>pixmap
thanks, but this doesn't work either...
Quote:
ui->label->setPixmap(":/new/prefix1/images/FirefoxCool.png");
C:/Users/QueenZ/Desktop/showhide/showhide/mainwindow.cpp:32: error: no matching function for call to 'QLabel::setPixmap(const char [37])'
c:\Qt\2010.01\qt\include/QtGui/../../src/gui/widgets/qlabel.h:116: note: candidates are: void QLabel::setPixmap(const QPixmap&)
Re: How do i change images? Qt creator label>pixmap
The function you want would be void QLabel::setPixmap(const QPixmap&)
So I think you would need syntax that looks similar to this:
Code:
QPixmap *pixmap
= new QPixmap(":/new/prefix1/images/FirefoxCool.png");
ui->label->setPixmap(pixmap);
I have not tested this nor have I ever used QPixmap so you may need to mess around with this a bit, but this should get you started.
Re: How do i change images? Qt creator label>pixmap
or simply ui->label->setPixmap(QPixmap(":/new/prefix1/images/FirefoxCool.png") );