×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Regular Contributor
    Join Date
    Jul 2011
    Posts
    100

    load image from buffer

    Hi I have managed to load my image from directory now want to build it from buffer but I get errors,
    I leave my code here

    QBuffer * buffer = new QBuffer (conn);
    QImage image = new QImage ();
    image-> loadFromData (buffer-> buffer ());

    errors are the following:
    C: \ ejemplos_qt \ teratermobile-build-simulator \ .. \ teratermobile \ imagen.cpp: 81: error: conversion from 'QImage *' to non-scalar type 'QImage' Request
    C: \ ejemplos_qt \ teratermobile-build-simulator \ .. \ teratermobile \ imagen.cpp: 82: error: base operand of '->' has non-pointer type 'QImage'

    thanks

  2. #2
    Registered User
    Join Date
    May 2009
    Location
    Greece
    Posts
    191

    Re: load image from buffer

    Correction code:

    Code:
    QBuffer * buffer = new QBuffer (conn);
    QImage* image = new QImage ();
    image-> loadFromData (buffer-> buffer ());
    Be careful with the types! You create a pointer by calling new and you assign it to a local variable that holds an instance of the class, not a pointer of the instance.

  3. #3
    Regular Contributor
    Join Date
    Jul 2011
    Posts
    100

    Re: load image from buffer

    I use this code with my code but I get an error on the part that I have. which is this:

    C:\ejemplos_qt\teratermobile-build-simulator\..\teratermobile\imagen.cpp:100: error: no matching function for call to 'QPixmap::fromImage(QImage*&)'

    which is in this line
    label-> setPixmap (QPixmap:: FromImage (image));

    but using this code, the same line does not give me no problems gives me problems:
    //QString fileName = QFileDialog::getOpenFileName(this,
    //tr("abrir archivo"), QDir::currentPath(),
    // "archivos(*.jpg *.png)");
    //QImage image(fileName);

  4. #4
    Registered User
    Join Date
    May 2009
    Location
    Greece
    Posts
    191

    Re: load image from buffer

    Code:
    label-> setPixmap (QPixmap:: FromImage (*image));
    Once again.......be careful with the types. What type you have, what a function needs as argument, what to assign where....this is basic C++ theory.

  5. #5
    Regular Contributor
    Join Date
    Jul 2011
    Posts
    100

    Re: load image from buffer

    I've tried that but still functional, I think that image is not an image because when I run it nothing appears on my screen
    Could you use this?
    QImage image(loadFromData (buffer-> buffer ()))
    thanks

Similar Threads

  1. Replies: 6
    Last Post: 2011-05-02, 18:06
  2. Maximum buffer size for contact image
    By janamahe in forum Symbian Media (Closed)
    Replies: 3
    Last Post: 2010-05-07, 08:05
  3. HOW TO CAPTURE AN IMAGE ON PHONE AND PUT INTO A BUFFER.....
    By srinivasreddy501 in forum Mobile Java General
    Replies: 2
    Last Post: 2009-12-12, 07:13
  4. Convert image buffer to bitmap
    By shrawan_gupta in forum Symbian
    Replies: 2
    Last Post: 2009-01-03, 05:01
  5. Can image.createImage load an image not in a jar?
    By nurru in forum Mobile Java General
    Replies: 3
    Last Post: 2007-05-02, 05:19

Posting Permissions

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