display image and get coordinates
Need help
Hi everybody I am newbie to Qt Gui application....before I haved worked with simple programs in dot net platform.....now I want to get started with Qt straight by displaying images and get co-ordinate of image when I click on the image...
I want it to be done urgently...
please help me
Re: display image and get coordinates
I would suggest you start with something simpler. Like at least following some of the tutorials and examples Qt has.
Re: display image and get coordinates
can you please provide the link for latest Qt GUI application tutorial
Re: display image and get coordinates
All materials are available in the reference manual, either offline or online.
Re: display image and get coordinates
atleast tell me which ui tool is used for image displaying
Re: display image and get coordinates
I think u can use QLabel->setPixmap(...)
Re: display image and get coordinates
As u suggested i used label which is in display widget..
my code:
Code:
void MainWindow::on_pushButton_2_clicked()
{
QPixmap *img
= new QPixmap("freedom.jpg");
//this image is in folder that contains exe ui->imagelabel->setPixmap(*img);//named the label as imagelabel
ui->imagelabel->show();
}
but this does not show error and neither it displays the image ............please help
Re: display image and get coordinates
Well... here is the code i used:
Code:
QImage image
("C:/Picture.jpg");
imageLabel
->setPixmap
(QPixmap::fromImage(image
));
And I didn't used the ui thing, so I really can't help there...
Re: display image and get coordinates
thank you Archa4.....It really worked....
I would like to ask one more question...is it possible to get the co-ordinates from the picture displayed in label just by clicking with mouse ....ie mouse handling....
I have got no idea how to do it in qt please help
Re: display image and get coordinates
Well... I found another thing in documentation:
http://doc.trolltech.com/4.7/qwidget.html#pos-prop
It shows the position of a widget within the parent's widget.
I think u can use it like
QPoint point = imagelabel->pos();
But i cannot be sure...