make sure the compiler knows what you are doing. You need to include qlabel.h. #include <qlabel.h> B-) On Friday 17 September 2004 07:51 am, Prabu Subroto wrote:
Hallo Jeroen.
Firstly, thank you for your answer.
I did like this in depanForm.ui.h :
#include <qlabel.h> #include <qpixmap.h>
void depanForm::init() { QLabel * lb = new QLabel(this); lb->setPixmap("images/1.png"); }
As I compiled this simple code (as my first try), I get this error message : patrixlinux@patrix:~/arsip/proyek/qt/10> make g++ -c -pipe -O2 -march=i586 -mcpu=i686 -fmessage-length=0 -Wall -fPIC -Wall -W -O2 -march=i586 -mcpu=i686 -fmessage-length=0 -Wall -fPIC -DQT_NO_DEBUG -DQT_SHARED -DQT_TABLET_SUPPORT -I/usr/lib/qt3/mkspecs/default -I. -I. -I/usr/include -I/usr/lib/qt3/include -o depanform.o depanform.cpp In file included from depanform.cpp:19: depanform.ui.h: In member function `virtual void depanForm::init()': depanform.ui.h:15: error: no matching function for call to `QLabel::setPixmap(const char[13])' /usr/lib/qt3/include/qlabel.h:104: error: candidates are: virtual void QLabel::setPixmap(const QPixmap&) make: *** [depanform.o] Error 1 patrixlinux@patrix:~/arsip/proyek/qt/10>
Why does it happen?
Please tell me.
Thank you very much in advance.
Newbie in Qt, Prabu.
--- Jeroen Wijnhout <wijnhout@science.uva.nl> wrote:
On Friday 17 September 2004 15:16, Prabu Subroto
wrote:
Dear my friends...
I use SuSE 9.1 and Qt 3.2 . I am writing a
database
program with Qt.
I have an image file named "1.png", I want this
image
file displayed in a Dialog Form.
Anybody would be so generous to give me a very
simple
sample code how to display an image file into a
Dialog
Form with QImage?
All I know only this step : QImage::QImage("images/1.png");
Please give me a very simple sample code.
You can use QLabel, instead of giving it a textual label, you give it an pixmap.
QLabel *lb = new QLabel(this); lb->setPixmap("images/1.png");
Insert the QLabel into your dialog as usual.
best, Jeroen
-- To unsubscribe, email: suse-programming-e-unsubscribe@suse.com For additional commands, email: suse-programming-e-help@suse.com Archives can be found at: http://lists.suse.com/archive/suse-programming-e
Do you Yahoo!? Declare Yourself - Register online to vote today! http://vote.yahoo.com