hi
i am newbee to Qt
How do upload the image for project....
please provide me sample code
Thanks
Yuvaraj R
Printable View
hi
i am newbee to Qt
How do upload the image for project....
please provide me sample code
Thanks
Yuvaraj R
Try this one example i'm still working on.
You must be talking about the qrc file (resource) and loading the png images to an object (QPushButton in the example) ... something like that?!
Thanks for your reply...
i am beginner .....I don't know in deapth
So give the sample code to upload image from my system
Thanks
Yuvaraj R
Code:
QPixmap image; switch (i){ case 0: image.load(":/quatroestacoes/primavera"); break; case 1: image.load(":/quatroestacoes/verao"); break; case 2: image.load(":/quatroestacoes/outono"); break; case 3: image.load(":/quatroestacoes/inverno"); break; case 4: image.load(":/quatroestacoes/as4estacoes"); } return image; }
In this function i select an imagem, load it into a QPixmap object, and the return it to the call point.
You must replace ...
... by something like ...Code:
image.load(":/quatroestacoes/as4estacoes");
... if you have not created the resource file.Code:
image.load("yourpath/imagename.png");
...but there are many other ways to do it :)
Here is a simple one:
Where:
- receiverLight is a QLabel object
- the file name of the image is off.png
Dont you have access to Qt Demos ? It is a very good place to start with.
You will get almost every example you need for a beginner .