Update of ListView dummy image using images from URL http

Hi guys...

Please help me with this.

I have created a ListView in QML file and filled with data received from a webservice. Since this web service provides all the images, I have to place a dummy image at this location. Then I used another method to retrieve images of the url. Now, I got the image in my CPC file. But I could not update my listview. I tried several methods. But failed.

Here is my code snippet.

 ListView {
                id: listView
                objectName: "listView"

                dataModel: ArrayDataModel {
                    id: myListModel

                }

                // Override default GroupDataModel::itemType() behaviour, which is to return item type "header"
                listItemComponents: ListItemComponent {
                    id: listcomponent
                    // StandardListItem is a convivience component for lists with default cascades look and feel
                    StandardListItem {
                        title: ListItemData.postText
                        description: ListItemData.postDate
                        status: ListItemData.filePath
                        imageSource: "asset:///images/4.png"
                    }

                }
                layoutProperties: StackLayoutProperties {
                    spaceQuota: 1.0
                }
                horizontalAlignment: HorizontalAlignment.Fill
                verticalAlignment: VerticalAlignment.Fill

            }

In the PRC, I get my image like this.

void PostHttp::imageFetcher(){
const QUrl url("http:///828/828_20135312012288.png");
if (flag1 == true) {
    get(url);
}
}
void PostHttp::onImageReply(){
    QNetworkReply* reply = qobject_cast(sender());
    QString response;
    QImage img;
    QString filePathWithName = "data/img/";
    QString imageName;

    if (reply) {
            if (reply->error() == QNetworkReply::NoError) {
                flag1 = false;
                const int available = reply->bytesAvailable();
                if (available > 0) {
                const QByteArray buffer(reply->readAll());
                response = QString::fromUtf8(buffer);
                img.loadFromData(buffer);
                img = img.scaled(40, 40, Qt::KeepAspectRatioByExpanding);
                const QImage swappedImage = img.rgbSwapped();
                const bb::ImageData imageData = bb::ImageData::fromPixels(
                        swappedImage.bits(), bb::PixelFormat::RGBX,
                        swappedImage.width(), swappedImage.height(),
                        swappedImage.bytesPerLine());
                bb::utility::ImageConverter::encode(QUrl(QDir::currentPath() + "/shared/camera/img.png"), imageData, 75);
                qDebug()<<"current path is "<

Thanks in advance

You can pass a QByteArray of image data coded directly to an imageView in the image property, set of QVariant::fromValue (). However, in your case you can place the uri to which you saved the image and not the bytes. Advantage: cascades puts these images in cache. If you use deterministic file names, you can avoid any networking calls or loading of images when only the populated list of point sier after be recycled.

img.loadFromData(buffer);
img = img.scaled(40, 40, Qt::KeepAspectRatioByExpanding);
img.save(QDir::currentPath() + "/shared/camera/img.png"), 0, 75);

QImage can do all this for you, without permutation of bytes.

All you have to do is then updated the datamodel.

Tags: BlackBerry Developers

Similar Questions

  • cfimage does not load image from URL

    So I have a URL as a string in a variable, and I will try the following:

    < cfimage action = "read" name = "MyImage" source "#myUrlString #" >

    And I get the following error:

    faultCode:Server.Processing faultString: 'Impossible to invoke the CFC - a exception has occurred trying to read the image.' faultDetail: "File C:\Inetpub\wwwroot\my\cfc\path\"https:\my.domain.com\imagefile.jpg"does not exist.'"

    It is clearly adding at the beginning of the path to the file on the URL string .cfc.  How do cfimage to simply load the image of the URL without that he's trying to precede the path of the top .cfc file?

    (I also tried ImageRead and ImageNew with exactly the same results).

    Thank you

    Laurence MacNeill

    Mableton, Georgia, USA.

    Yes, it was put me dummy code in my question...  Sorry...

    I figure out the problem a few minutes before, however.

    It turns out that the URL string had quotation marks around it.  Oops...

    If my URL variable contained "https://my.domain.com/imagefile.jpg" * which * quotes...  Once I removed the quotation marks in the string, it works.

    Thank you

    L.

  • Recover images from url

    Hi all and thanks for your support every time.

    I want to go to a picture in the url of my Simulator. The page contains only an image I want to fetch and load to my Simulator.

    Before loading my Simulator I have to resize according to my wish and then keep it on my Simulator.

    Let me give you the key role that I just need the image of the page whole nothing else.

    So, if you can help me with this.

    Thank you in advance,

    Isabelle

    Hi Lisa,

    The link below will probably solve your problem.

    http://www.coderholic.com/category/BlackBerry/

    Kind regards

    Valter

  • HTTP 413 - exception too large entity when you try to read the audio data from URL http

    Hello!

    I sent an audio file of size 718 KB on tamcat and I try to play via a URL but http 413 exception, please help here is my code:

    Try
    {
    Player p = javax.microedition.media.Manager.createPlayer ("http://192.168.0.172:8090 / new.wma");
    p.Realize ();
    VolumeControl volume = (VolumeControl) p.getControl ("VolumeControl");
    volume.setLevel (30);
    p.prefetch ();
    p.Start ();
         
    }
    catch (System.Exception e)
    {
    System.out.println (try ());
    }

    YOUR help is needed thanks.

    Hey thanks for much for your help... I managed to solve the problem using this example BufferedPlaybackDemo accept I made a few changes to it... This added to the URL and change the connection on Read_Write

    if (WLANInfo.getWLANState() == WLANInfo.WLAN_STATE_CONNECTED)
                url.append(";interface=wifi");
            else
                url.append(";deviceside=true");
    

    Thanks anyway

  • Cannot copy image from a url from an invocation

    Hi, I do an application what and now work correctly, but I have a problem. When my application is called is reciving a url as follows:

    file:///accounts/1000/invoke/com.MyApp.image.open/xa000000000000a/IMG_00000027.jpg

    As you can see, this url points to an image, and is the uri from the received call parameter. At this stage I can show the image perfectly in my application (because it is invoked as a card in another application). The goal is to save the url of the image in a database for future access to the app. I tried to register the url because it is above, but now I understand why I could not properly gwendoline image (the stuff of card).

    Then I tried the following:

    void ApplicationUI::addRecord (const QUrl & url)
    {
    Create a new folder
    QDir (QDir::currentPath() + "/ shared/photos/").mkdir("myApp");
    Setting up the source url
    QString from = url.toString ();
    Setting up the destination path
    QString = QDir::currentPath() + ' / shared/photos/myApp ";
    Copy of the file
    QFile::copy (from, to);
    }

    I have permission to access_shared. I didn't really now what's the problem with that. I'm kinda a noob and I'd appreciate your advice and help. Thank you!

    Hello!

    Thank you!

    I achieve my goal like this:

    void ApplicationUI::addRecord (const QUrl & url)
    {
    Create a new folder
    QDir (QDir::currentPath() + "/ shared/photos/").mkdir("myApp");
    Get the file and file information
    QFile file (url.toString ());
    QFileInfo fileInfo (file);
    Setting up the source url
    QString from = url.path ();
    Setting up the destination path
    QString = QDir::currentPath() + ' / shared/photos/myApp / "+ fileInfo.fileName ();
    Copy of the file
    QFile::copy (from, to);
    }

    Originally, I used QString from = url.toString () and got:

    file:///accounts/1000/invoke/com.MyApp.image.open/xa0000000000058/IMG_00000066.jpg

    Then I tried = url.path () QString and I got:

    / Accounts/1000/Invoke/com. MyApp.image.Open/xa0000000000058/IMG_00000066.jpg

    In addition, I changed the setting to QString to QDir::currentPath() = + ' / shared/photos/myApp / "+ fileInfo.fileName ();

    Small piece that I could copy the image.

    Hope you find it useful!

  • Does anyone know of an easy way to download images from the Olympus E - M10 12 of Photoshop, or how to export images uploaded using Olympus Viewer 3 to 12 of Photoshop?

    Does anyone know of an easy way to download images from the Olympus E - M10 12 of Photoshop, or how to export images uploaded using Olympus Viewer 3 to 12 of Photoshop?

    Photoshop elements 12 can use the 8.5 camera raw plugin, which should allow the Olympus E - M10 to open in 12 PES editor or be imported in the Organizer 12 PES.

    Have you tried help > updates the editor of PES 12 to get camera raw 8.5?

  • I use LR 3.6 and CS6 with RAW 7.1.  Lightroom can't open images from a Canon 5 d MkIII - which CS6 c

    I use LR 3.6 and CS6 with RAW 7.1.  Lightroom can't open images from a Canon 5 d MkIII - which can CS6. Should I re-download 7.1 RAW or what I need to update to Lightroom?

    3.6 Lightroom is not and will not support files of 5 d Mk3.  Your choice is either to upgrade to 4.1 LR or convert the files to DNG.

  • Can I use Airdrop to transfer images from my old to my new iphone6 iphone5?

    Can I use Airdrop to transfer images from my old to my new iphone6 iphone5?

    Yes,

    How to use AirDrop with your iPhone, iPad or iPod touch - Apple Support

    Why not just backup the iPhone 5 and the iPhone 6 to restore this backup. In this way, everything is transferred only once.

  • My problem is that when I try to save an image from Adobe Photoshop by using the 'save for Web' half of the dialog box does not appear.

    I use a Vista Home Premiuim Windows in an Acer Aspire One 10.1 "." My problem is that when I try to save an image from Adobe Photoshop by using the 'save for Web' half of the dialog box does not appear. Can someone help me please?

    Here is a screenshot of my problem...
    [IMG] http://i55.tinypic.com/of5w01.png [line]
    Help me please.

    Hello

    1. were you able to see the front dialog box?

    2. did you of recent changes to the computer?

    This happens because your screen resolution is less than the required minimum of 1024 x 768.

    You can try to change the resolution of the monitor and check.

    For more information, see the link:

    Change settings display on multiple monitors

    Change the screen resolution

    You can also refer to Adobe support links and also post your request in the Forum from Adobe for assistance:

    http://forums.Adobe.com/thread/433020?TSTART=0

    http://kb2.Adobe.com/CPS/403/kb403268.html

    http://forums.Adobe.com/community/Photoshop/photoshop_windows

    Hope this information is useful.

  • I've updated a few existing Images on assets &gt; library &gt; Image, but he doesn't think, where it has been used?

    Hello


    I've updated a few existing Images on assets > library > Image, but he doesn't think, where it has been used?




    Thank you

    Sanjiv

    Hi Sanjiv,

    No worries. It takes awhile (6-7 h) in order to take into account.

    Thank you

    Eloqua Expert

  • Using an Image from Adobe Stock on the Standard license for a showcase.

    Hello

    I am currently working on my first design of shop window and I'm eager to confirm whether if I use an Image from Adobe Stock on a standard for this license? As far as I can see after reading the terms and conditions, I am able to. However, I don't want to confirm it for obvious reasons.

    See you soon,.

    Jasmine.

    Hi Jasmine

    The Standard license allows you to use the image for a marketing presentation, promotional or internal or the purposes of decoration, so it should be good providing you comply with the license terms and restrictions.

    Thank you

    Bev

  • Hi, I use lightroom 5 and have been for several years.  Today I imported several batches of today images from different cameras without any problem, but the images of a particular card (with an incredibly large memory) does not matter.

    Hi, I use lightroom 5 and have been for several years.  Today I imported several batches of today images from different cameras without any problem, but the images of a particular card (with an incredibly large memory) does not matter.  I see other people have had similar problems, but I am not able to follow these solutions and would very much help here.  I have an IMac.

    If you had probably two problems

    Permissions, the other is the hardware problem causing slow import and the card cannot be read by your operating system.

  • How to insert image from mysql into the table using php and create the checkbox in the table?

    How can I insert image from mysql into the table using php and create the checkbox for each data as a vote? Here is my code...

    WELCOME

    connect_error) {die ("connection failed:".)} $conn-> connect_error); } $sql = "SELECT no, Calon, ID, of course, the Image OF THE candidates." $result = $conn-> Query; If ($resultat-> num_rows > 0) {echo ' '; export data of each line while ($row = $result-> fetch_assoc()) {"echo"}}
    NO Candidate INFO Vote
    " . $row ["no"]. "-" . $row ["Calon"]. "
    -" . $row ['ID']. "
    -" . $row ['class']. "
    "; } ECHO ' ' ;} else {echo '0 results' ;} $conn-> close();?} >

    hope someone can help me because I am a newbie in this program... need to finish this project... Thank you.

    If you have saved the file name in the database, it's pretty simple.

    echo '' . $row['description'] . '';
    

    Is the same for the box:

    echo '';
    

    If you have saved the image file in the database, it is much more complicated. I recommend you store only the file name in the database.

  • Copy a ghost image from a USB on a DVD? -Windows 8, is it possible?

    Sorry, maybe it's here somewhere but I can't find the user friendly site!  I especially need to know if this is possible and simple instructions would be great...

    That's the computer of my mother (his first!) - which is a few hundred miles of me.

    It is a Toshiba laptop and was running Windows 8 (now updated I think to 8.1), no disk etc. not provided. We put teamviewer in place so I can get access to distance, but not sure how useful, it would be something like that.

    I was visiting and set it for her. We didn't have a DVD at hand to be a ghost of the game image original so I used my large capacity USB flash drive (usually has photos of my children etc. baby - I leave there as a return upwards etc. home fire)

    It's one of those jobs, I still intend to do but it doesn't seem simple and I don't have round to... he bought just for more than a year.

    Is it possible to transfer the ghost image from the memory stick to a DVD?  (preferably using Windows 7, but could wait until I have visit again and use Windows 8)

    I could do another copy (I guess this would be the current set up, but that should be ok I think) on a DVD?

    Or would I better just buying another flash (they are much cheaper now!) but I have a lot of DVD here it seems a bit of a waste...

    I guess the first thing is that possible?

    Hi Lusi,

    Thank you for the update.

    Creating installation media will help you reinstall Windows. However, you must have the correct product key license to validate the OS. In Windows 8, the product key is previously injected into the BIOS. So, as the system has already had 8 Windows installed, it is unnecessary to type a new product key. Therefore, install Windows 8 from the created installation media would serve the purpose.

    Keep us updated to any other help, we will be happy to help you.

  • How can I stop the download of images from the site?

    This is the first time I installed Firefox for Android. Don't see how I can block images from the web page and just take the content of the text. Thanks for your time.

    You can actually set the same preference under the covers that you would use on Firefox for desktop PC: permissions.default.image. Here's where and how:

    (1) open a new tab to Subject: config (type about: config the Awesomebar and hit the arrow go or tap Enter).

    You can bookmark it for easy future access.

    (2) in the search box, type perm and make a pause while Firefox filter list

    3 scroll to permissions.default.image and type it, and then use the up arrow (^) to change the value from 1 to 2 (of 'allow all' on ' block all the ').

    If you go back to your other tab and load a new page, the images must be missing (assuming that they are not cached).

    Success?

    If there is an add-on for it (I have not checked) that might be easier if you find a site where you want the images because it is a hassle to switch back using about: config.

Maybe you are looking for