×

Discussion Board

Results 1 to 7 of 7
  1. #1
    Registered User
    Join Date
    Apr 2008
    Location
    India / Singapore
    Posts
    549

    Loading img from URL

    may I know how to load ( download ) an image at an URL and display it ?
    I understand that I would need to create a label and associate a Pixmap to it. But sometime make the process clearer or direct me to an example ?
    Thanks
    Twitter - manikantan_k
    Just in --

  2. #2
    Super Contributor
    Join Date
    Nov 2009
    Location
    Minnesota, USA
    Posts
    3,209

    Re: Loading img from URL

    Don't know of a simple example. There's one for Symbian, but not Qt, that I can find.

    You can look at the HTTP example described at http://doc.qt.nokia.com/4.6-snapshot/network-http.html and maybe lash it up with one of the graphics examples. Once you've got an image file, displaying it is fairly easy.

  3. #3
    Regular Contributor
    Join Date
    Nov 2007
    Posts
    130

    Re: Loading img from URL

    Quote Originally Posted by manikantan View Post
    may I know how to load ( download ) an image at an URL and display it ?
    I understand that I would need to create a label and associate a Pixmap to it. But sometime make the process clearer or direct me to an example ?
    Thanks
    Hi,

    Use QtNetwork to load images from server and display it in QLabel.

    You can try this

    Code:
    QUrl url("http://www.imageserver.com/image1.jpg");
    QNetworkAccessManager *manager = new QNetworkAccessManager(this);
    connect(manager, SIGNAL(finished(QNetworkReply*)),
    		this, SLOT(updateImage(QNetworkReply*)));
    manager->get(QNetworkRequest(url));
    and in updateImage function try this

    Code:
    if (!networkReply->error())
    {
    QImage image;
    if (image.loadFromData(networkReply->readAll()))
    {
    QPixmap pixmap = QPixmap::fromImage(image);
    if(!pixmap.isNull())
    {
    QLabel imgLbl;
    imgLbl.setPixmap(pixmap.scaled(imgLbl->size(),
    			Qt::KeepAspectRatio,
    			Qt::SmoothTransformation));
    }
    }else{
    //print error
    }else{
    //print error		
    }

  4. #4
    Registered User
    Join Date
    Nov 2007
    Posts
    8

    Downloading file online

    Hello,

    I'm brand new in developing for Qt and thus have no clue around what I'm doing yet, so bare with me

    What I want to do is to make my phone make a HTTP GET request to download a file online.
    This is one of the places: http://vasttrafik.se/External_Servic...mx/GetSMSCodes

    How can I do this with Qt for Symbian?

    Examples, code snippets, wikis or videos on this?

    Thanks

  5. #5
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: Downloading file online

    Use QNetworkAccessManager
    http://doc.trolltech.com/4.6/qnetworkaccessmanager.html
    There are also examples coming with Qt.

  6. #6
    Registered User
    Join Date
    Dec 2009
    Posts
    41

    Smile How to: send http POST data to server.

    Hi,

    I have the data in my vector and I want to send the data containing in that vector to the servlet residing on a different machine.

    can any body tell me how do do it. Is there any sample example of having a similar functionalities.

    Thanks and regards,

    Imran.

  7. #7
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: Loading img from URL

    Using POST is quite similar to using GET. There is only one additional parameter.

Similar Threads

  1. MBM image is not found
    By tamhanna in forum Symbian
    Replies: 14
    Last Post: 2009-04-20, 12:44
  2. BrCtlInterface: how to stop browser control while it is loading url
    By tanimesh in forum Symbian Networking & Messaging (Closed)
    Replies: 1
    Last Post: 2009-02-10, 12:22
  3. Problem when loading video with mmf's open url
    By david.caabeiro in forum Symbian Media (Closed)
    Replies: 0
    Last Post: 2006-12-19, 00:17

Posting Permissions

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