+ Reply to Thread
Results 1 to 10 of 10

Thread: display image and get coordinates

  1. #1
    Join Date
    Mar 2011
    Posts
    36
    Thanks
    30
    Qt products
    Qt4
    Platforms
    Windows

    Default 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

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    31,255
    Thanks
    3
    Thanked 4,705 Times in 4,506 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Blog Entries
    4
    Wiki edits
    10

    Default 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.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Mar 2011
    Posts
    36
    Thanks
    30
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: display image and get coordinates

    can you please provide the link for latest Qt GUI application tutorial

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    31,255
    Thanks
    3
    Thanked 4,705 Times in 4,506 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Blog Entries
    4
    Wiki edits
    10

    Default Re: display image and get coordinates

    All materials are available in the reference manual, either offline or online.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Mar 2011
    Posts
    36
    Thanks
    30
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: display image and get coordinates

    atleast tell me which ui tool is used for image displaying

  6. #6
    Join Date
    Feb 2011
    Location
    Latvia
    Posts
    139
    Thanks
    24
    Thanked 6 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: display image and get coordinates

    I think u can use QLabel->setPixmap(...)

  7. The following user says thank you to Archa4 for this useful post:

    ready (21st March 2011)

  8. #7
    Join Date
    Mar 2011
    Posts
    36
    Thanks
    30
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: display image and get coordinates

    As u suggested i used label which is in display widget..
    my code:
    Qt Code:
    1. void MainWindow::on_pushButton_2_clicked()
    2. {
    3. QPixmap *img = new QPixmap("freedom.jpg");//this image is in folder that contains exe
    4. ui->imagelabel->setPixmap(*img);//named the label as imagelabel
    5. ui->imagelabel->show();
    6.  
    7.  
    8. }
    To copy to clipboard, switch view to plain text mode 
    but this does not show error and neither it displays the image ............please help

  9. #8
    Join Date
    Feb 2011
    Location
    Latvia
    Posts
    139
    Thanks
    24
    Thanked 6 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: display image and get coordinates

    Well... here is the code i used:

    Qt Code:
    1. QImage image("C:/Picture.jpg");
    2. imageLabel->setPixmap(QPixmap::fromImage(image));
    To copy to clipboard, switch view to plain text mode 

    And I didn't used the ui thing, so I really can't help there...

  10. The following user says thank you to Archa4 for this useful post:

    ready (21st March 2011)

  11. #9
    Join Date
    Mar 2011
    Posts
    36
    Thanks
    30
    Qt products
    Qt4
    Platforms
    Windows

    Default 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

  12. #10
    Join Date
    Feb 2011
    Location
    Latvia
    Posts
    139
    Thanks
    24
    Thanked 6 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default 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...

+ Reply to Thread

Similar Threads

  1. Qt Image Display...
    By mahe2310 in forum Qt Programming
    Replies: 9
    Last Post: 22nd July 2013, 09:06
  2. Replies: 4
    Last Post: 18th March 2010, 10:11
  3. How to Display the image in Qt
    By sdastagirmca in forum Qt Programming
    Replies: 1
    Last Post: 10th February 2009, 06:17
  4. Image display
    By bmn in forum Qt Programming
    Replies: 1
    Last Post: 5th June 2008, 13:52
  5. Display image
    By Pesho in forum Qt Programming
    Replies: 1
    Last Post: 14th September 2007, 00:21

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts