Loading an image works on Z10, but not on the Q5

I use FilePicker to load an image from the library by using the following code

Container {
        ...

        ImageView {
            id: imgView
            verticalAlignment: VerticalAlignment.Center
            horizontalAlignment: HorizontalAlignment.Center
            scalingMethod: ScalingMethod.AspectFit
            maxHeight: 250
            minHeight: 100
            bottomMargin: 30.0

        }

    }
    Container {
        verticalAlignment: VerticalAlignment.Bottom
        horizontalAlignment: HorizontalAlignment.Fill
        bottomPadding: 30.0
        leftPadding: 30
        rightPadding: 30

        Button {
            id: btnSelectImg
            topPadding: 25
            horizontalAlignment: HorizontalAlignment.Fill
            text: qsTr("Select Image") + Retranslate.onLocaleOrLanguageChanged
            onClicked: {
                console.log("FilePicker")
                picker.open()
            }

            attachedObjects: [
                FilePicker { //image picker
                    id: picker
                    property string selectedFile
                    type: FileType.Picture
                    title: qsTr("Select Image") + Retranslate.onLocaleOrLanguageChanged
                    onFileSelected: {
                        imgView.imageSource = "file://" + selectedFiles[0];
                    }

                }
            ]
        }
    }
}

Copy the following code to display the image correctly on Z10, but not on Q5 however both running the same version.

No idea what could be the problem?

It turns out that the problem is exactly as described by dbigham, ImageView can handle images up to a certain size depedning on the device.

I added a C++ code to resize the image before feeding it to QML

QML code:

ImageView {
            id: imgView
            attachedObjects: [
                ImageTracker {
                    id: imgViewTracker

                    onStateChanged: {
                        if (state == ResourceState.Loaded)
                        {
                            imgView.image = imgViewTracker.image
                            console.log("Shared image loaded correctly!")
                        }
                        else if (state == ResourceState.ErrorMemory)
                        {
                            console.log("Shared image load: Error Memory!")
                        }
                        else if (state == ResourceState.ErrorInvalidFormat || state == ResourceState.ErrorNotFound) {
                            console.log("Shared image load: " + state + "!")
                        }
                    }
                },
                FilePicker { //image picker
                    id: picker
                    property string selectedFile
                    type: FileType.Picture
                    title: qsTr("Select Image") + Retranslate.onLocaleOrLanguageChanged
                    onFileSelected: {
                        _app.loadImage(selectedFiles[0],300,200)
                        imgViewTracker.image = _app.image;
                    }

                }
            ]

        }

C++ code:

void ApplicationUI::loadImage(QString strImageFileName, int width, int height)
 {
     QImage image;

     image.load(strImageFileName);

     image = image.scaled(width, height, Qt::KeepAspectRatioByExpanding);

     QImage swappedImage = image.rgbSwapped();
     if(swappedImage.format() != QImage::Format_RGB32) {
         swappedImage = swappedImage.convertToFormat(QImage::Format_RGB32);
     }
     const bb::ImageData imageData = bb::ImageData::fromPixels(swappedImage.bits(), bb::PixelFormat::RGBX, swappedImage.width(), swappedImage.height(), swappedImage.bytesPerLine());

     m_image = bb::cascades::Image(imageData);
     emit imageChanged();
 }

QVariant ApplicationUI::image() const
 {
     return QVariant::fromValue(m_image);
 }

C++ header:

class ApplicationUI : public QObject
{
...

Q_PROPERTY(QVariant image READ image NOTIFY imageChanged)

public:
...

Q_INVOKABLE void loadImage(QString strImageFileName, int width, int height);

signals:
...

void imageChanged();

private:
...
    QVariant image() const;
    bb::cascades::Image m_image;

Tags: BlackBerry Developers

Similar Questions

  • ContextMenu working on 8120 but not on the 8900

    I have this application running on the OS 8120 v4.3.0.115 and 8900 OS v4.6.1.231 and get a strange problem with the context menu not appearing is not on the 8900 but for 8120 his job very well.

    This is my code:

        /*Override this to add custom menu items.*/
        protected void makeMenu( Menu menu )
            {
                Field focus = UiApplication.getUiApplication().getActiveScreen().getLeafFieldWithFocus();
                if(focus != null)
                    {
                    ContextMenu contextMenu = focus.getContextMenu();
                    if (contextMenu !=null)
                        {
                            menu.add(contextMenu);
                            menu.addSeparator();
                        }
                    }
                menu.addSeparator();
                menu.add(_closeItem);
            }
    

    Any who have similar problems with the context menu for ObjectChoiceField does not not on the 8900?

    figured it out. I have replace him-> public boolean trackwheelClick (int status, int time)
    and this for a reason any did not work with the 8900. Still strange that he worked on the 8100.

    But somehow rewrote this code and now its work on both devices.

  • Client vSphere 5.0 works on network, but not via the SSH tunnel

    Hoping someone can help you.

    Seems that others have this problem as well.

    Can connect to the network, but not through an SSH tunnel.

    On the network, I am invited to accept/ignore a SSL certificate.  This does not happen when trying to connect remotely (via an SSH tunnel).

    During troubleshooting, I port passed almost all the ports TCP, starting w / ports 80, 443 and 902.

    Through the SSH tunnel, via a browser, I can successfully access https://127.0.0.1 (VMware server), but the client software will not complete the connection, w / error message: «...» "The client could not send a request to the server."

    Any help would be appreciated.

    Thank you.

    Managed to understand this myself, having invested in a way more time I should have.

    This announcement in the hope that it will help others.

    In your SSH client, port forward with the help of one local loop, IP OTHER THAN 127.0.0.1 (such as 127.0.0.2 for example).

    Port 127.0.0.2:443 before--> IP:443 target

    127.0.0.2:902--> target IP:902

    127.0.0.2:903--> target IP:903

  • Rh9 link works in preview but not on the generated version

    Question: I have the theme with link to a MS Excel file. When I make a point of view, the link action behaves correctly, by displaying the file download dialog box. When I generate the layout (WebHelp), the link action does not respond.

    Notes:

    • The file appears in the two c:\appname\! SSL! \WebHelp\,rules_summary_1.xls , and c:\appname\Rules_Summary_1.xls

    (not sure if the case of filenames questions)

    • I created a test subject and got the same behavior

    Any ideas?

    Thank you

    -bruce.

    Hello

    It is probably the result of having Mark of The Web (MOTW) activated at the time of publication and that you view using Microsoft Internet Explorer as your browser.

    If you have decided to copy the files on a web server for your end users to open, the links should work properly.

    If you want to test your local PC to ensure that things work, you can disable MOTW and deal with problems of boxes dialog IE or you can relax in the Internet Explorer security to allow to run active content. Your call.

    What version of IE are you using?

    See you soon... Rick

    Useful and practical links

    Wish to RoboHelp form/Bug report form

    Begin to learn RoboHelp HTML 7, 8 or 9 in the day!

    Adobe Certified RoboHelp HTML Training

    SorcerStone blog

    RoboHelp EBooks

  • bbUI.js - in ripple, menu, title bar and menu shortcut works for Z10 but not Q10

    Hello

    I have a simple application of BB10 built using bbUI.js.  The home screen features a menu, a menu bar and title of context.  In ripple, all works well when the Z10 is selected but when I go to Q10, menu functionality no longer works and the title bar loses its style.  (Please see attached screenshots)

    • What is a ripple problem?
    • Any code changes are required to get a Z10 application to work on a Q10?

    Notice that I use the latest version of ripple 0.9.16

    Thank you!

    Z10 homescreen

    Z10 Home screen - Menu

    Q10 homescreen


    What version of bbUI are you using?

  • Memory micro SD card works on phone, but not on the computer, Please HELP!

    Help, please

    History
    (1) I got a 8 GB Micro SD memory card, it worked fine for two years and then became corrupted, I formatted and it worked fine for about two months before, she has become corrupt again
    (2) this time when it became corrupt my phone always accepted, but the computer could not detect, weird, I decided to not format and continue to use on my phone
    (3) I decided to buy a new memory card and an adapter and then transfer the stuff over the old to the new, but I was shocked when the NEW memory card and a NEW adapter did not work and continued to say needs formatting, hmmm...
    (4) I decided to format it, but it says that it cannot be formatted... WHAT!
    (5) I put the new card in my phone, it works and I have format it on my phone instead... IT STILL DOES not work! Help me!!!

    I still think you should get a new card reader.  The adapters are not likely to be the problem.  On the other hand, I had a player go bad and yet still be "recognized" by the computer.

    It is possible, but probably not - IMO that reinstall the driver (if available; in general, however, these devices use drivers that come built-in to Windows) or a firmware update (if available for your drive in particular) could solve the problem.  What is the brand and model of your card reader?

    At the very least, you should see if you can find someone with a SDHC card reader and then see if you can read and format the card using your cards.

  • Preloader works on homepage, but not on the subpage

    I work for this site is home to the preloder home page works fine. I put the preloader in the upper layer, but here at work page whose link is here works is not work fine same as homepage... would have some advice me what to do? because I did the same thing on the home page, but unfortunately I can't find any reason why his works very well on the WORK page.

    Thank you.

    Even I tested in 3 different browsers, Chrome, Firefox, and Edge, and it works very well in all the!

    Looks like the problem is solved!

  • HP f4480 has worked with dv6 but not with the new dv7 after transfer windows easy

    F4480 will not be printed with the new laptop dv7, I can scan to laptop and the printer works with the old dv6 but it will not print and shows no errors. Print jobs just disappear.

    Have reinstalled several times with the removal of the pilot tool and all the info on this site.

    Me using fixed http://support.hp.com/us-en/document/c02554863 of HP diagnostic tools

    A rather well hidden resource.

  • Camera shake works in preview, but not in the final rendering.

    Hello. I tried Googling and searching forums and coming hands here is empty.

    I use After Effects of CS4 with the latest updates.

    I have a project with a unique model that contains an AVCHD clip related to an adjustment layer.

    I used the earthquake keyframe mode some fake camera shake by manipulating the 'Transform-> Position' field moments adaptation layer keys in the images. If I scrub through or do a preview (press 0 and let pre render) it looks fantastic with the music video of shake exactly how I like it.

    But when I save the project and add it to my queue to render the final output has * no * of the camera shake!

    I'm completely baffled as to why this might be. That said I only use AE for about a month so it is possible that I have made a simple noob mistake.

    The adjustment layer and the images are both the visible value. I see clearly the keyframes in the timeline panel and as I said the preview and cleaning shows the effect in action... But the final result (regardless of the format or resolution) have no shake in them either.

    Help!

    I just tried to do exactly the same thing and it works very well here.

    If you want, e-mail me your project folder (under the file video source) and I'll take a look: arozenfe (©) adobe.com

  • Call a dll via webutil works with Jinitator, but not with the Sun JRE

    Friends,

    I'm trying to call a DLL for Oracle forms using webutil.

    The example I use is from thread WEBUTIL_C_API demo form .

    I followed all the instructions and when I use Jinitiator 1.3.1.28 as the JRE client, then this market. However, when I use Sun JRE 1.5 (1.5.0.19) or Sun 1.6 (1.6.0.14) it does not work and I see the following errors in the java console:
    ERROR>WUL-928 [CApiFunctions.set_invokeoncespec()] Library apiwrap.dll not accessible, or does not contain function eaFindWindow
    ERROR>WUL-910 [CApiFunctions.invokeCApi()] Invoking the function failed: java.lang.NullPointerException
    It appears the problem with the version of Java? Is there something special I need to do to call a dll using the latest versions of the JRE?

    Any help would be appreciated!

    These webutil errors mean that the .dll file is not found in the JRE/bin directory... you have to force webutil to re - load the .dll file into this folder by deleting the webutil.properties file, and then try to run after it again and it should work.

    This properties file are located in either the user/home directory or in the home folder of the JRE.

    i.e.
    C:\Program Files\Java\jre1.5.0_15\webutil.properties

    This file will contain the .dll files that are downloaded to the client... such as configured in the webutil.cfg file.

    Properties of #WebUtil file
    #Mon Aug 10 10:52:10 MDT 2009
    syslib.ffisamp.dll = 1.0
    syslib.d2kwut60.dll = 1.0
    syslib. JNIsharedstubs.dll = 1.0
    syslib. Jacob.dll = 1.0
    syslib.apiwrap.dll = 1.0

  • Series works in Fusion, but not on the site?

    I finally got my license key today and could enter my installed 3 merge (so far, used the temporary key) - but when I login on my VMWare account on the website and try to save the license all I get is an error "invalid series/license.

    Anyone with a similar problem?

    I'd rather have the license working and registered (in case of future updates) of a single semester...

    We are working through some problems with registration for orders at the beginning, but hope to have solved today.

    Pat

  • C6380 works on pc but not with the help of the laptop!

    I have my main PC that is hooked to my wireless-g linksys. Also, I have a laptop that I connect with the router's wireless. I used the instructions delivered with the printer wireless and can print wireless from my pc to the printer. However, I installed the installation cd on my laptop and at halfway through installing it says it cannot find all printers. I tried again and again and don't know what else to do. I can get on my laptop wireless with no problem, I have to install my linksys on the laptop cd?

    Maybe it's that you have a software firewall installed on your laptop that it prevents to find the printer on the network. You can test it to see if this is the problem by temporarily disabling any firewall running on your laptop and see if it suits it. If this difficulty it then re-enable your firewall and configure it to allow UDP port 427 communication (which is what the software uses to find the printer on the network).

    -David

  • Hyperlink works locally but not on the Intranet

    Hello

    Behavior very strange because most of the other hyperlinks in separate projects works only on the Intranet, but not locally. All the settings for hyerlinks are the same, since they have been pulled from a template.

    All ideas

    Lisa

    Hello

    I found my problem. I was pointing to the address of the server in my button instead of the http address. This is the reason for which he worked a sense but not in the other.

    Thanks for listening.

    Lisa

  • The data are stored in the DB for the Jdeveloper test, but not in the dev environment

    The data are stored in the DB for the Jdeveloper test, but not in the dev environment

    Hi all,

    IM new with OFA and Im working with Jdeveloper, I create a form to store information using a VO and EO and add information to the current line using the attribute set of function, I noticed that when I lunch the update in the jdevelopher data is OK in the comic book, but when I install the development in the DEV environment the data stored using java code does not the table, only data that are related by the object as text fields and others.

    This is the code that I use for SAP data, it works in jd, but not in the dev environment

    {} public void saveData (String responsabilidadID)
    int respId = Integer.parseInt (responsabilidadID);
    OAViewObject vo = (OAViewObject) getQuiebresComercialesVO1 ();

    vo.getCurrentRow () .setAttribute ("ResponsabilidadId", respId);

    getTransaction () .commit ();
    }

    Any there who encounter this type of problem, something I can check?

    Thank you all.

    Just check if you bounced the server after you deploy the code. Objects Java would not reflect the changes, unless the instance is bounced.

  • Using Acrobat Pro and what impression on network printer it prints very slow. I have found that if we choose to print the image works fine. But how do I print as image remains for all of my PDF files. I have to choose each time now and it's not always r

    Using Acrobat Pro and what impression on network printer it prints very slow. I have found that if we choose to print the image works fine. But how do I print as image remains for all of my PDF files. I have to choose every time now and that is not always known.

    Hi jeans37547790,

    Please do mention it below as follows to change the settings:

    Open Acrobat > click file > print > click on advanced > and check the box that says "Print as Image".

    Here is the screenshot:

    .

    Let us know if you face any problem.

    Thank you!

    Shivam

Maybe you are looking for

  • I do pay for IMOVIE?

    I removed imovie awhile to free up space. Now theres some clips I want to change, go to the app store and its $22 .99aus... ??? what the *? Surely, he was given free initially, it should remain free?

  • Satellite Pro A660 - extended monitor on the left?

    I have some trouble getting the extended screen (2) to be positioned on the left side of my laptop A660: I have my new Toshiba (thanks to his monitor, call Lap1) set to the right of my big external flat screen (Ext2). In the nVidia control panel, I h

  • cannot turn off voiceover or access the iTouch

    Sparked the iTouch. Time, date, etc are read.  the slide to open the box goes to the camera when I try to drag.  I managed to reach the area where I enter the code but nothing happens after that I entered the code.  I tried to touch the original key

  • iPhoto for El Capitan

    I used iMovie so long that I forgot the actual name of the function in which the user can include an image in the timeline to replace the original image (for a length of time selectable). I think it's 'cut '. In any case, when I try to use IPhoto, a

  • THE PRESIDENT GOT LOWER

    Dear Sir I had problem with my laptop (inspiron 5521) speakers and he sent to dell support center and they installed new speaker but I discovered that the sound is lower than it used to be confronted with the problem. also when I used to use to conne