QNetworkAccessManager finished signal never happens

    static QNetworkAccessManager* netManager = new QNetworkAccessManager();
    if (netManager) {
        QUrl url("http://some.url:8080/image.png");
        QNetworkRequest networkRequest(url);
        this->connect(netManager, SIGNAL(finished()), this, SLOT(onReply()));
        QNetworkReply* networkReply = netManager->get(networkRequest);
    }

the onReply() method is:

void MyAppClassExtendsQObject::onReply(QNetworkReply* reply) {
    if (reply->error() != QNetworkReply::NoError) {
        qDebug() << "Image not available or any error";
        return;
    }
    Image image = Image(reply->readAll());
    ImageView* imageView = Glue::i()->getRoot()->findChild("id_media");
    if (imageView) {
        imageView->setImage(image);
    }
}

onReply never gets called, however this code used to work as it is in one of my previous versions of an application. What's not here?

THX!

You could paste the header file?

Make sure that the slot is declared in "slots: ' section and line Q_OBJECT is not included in the class definition. The class must inherit from QObject or its descendants.

Add some logging inside the if {} after a call to the connect() to make sure that this branch has been called.

Try to replace the connect() with QObject::connect()

Tags: BlackBerry Developers

Similar Questions

  • finished() signal for invoke() on phone app)

    I use bb::system:InvokeManager to start a call using action 'bb.action.DIAL '.

    response of bb::system:InvokeTargetReply * const = invokeMgr.invoke (invokeRequest);

    Invoke() will return an InvokeTargetReply. This response will signal finished(). I use

    Boolean result = QObject::connect (response, SIGNAL (finished (()), this, SLOT (onInvokeResult ()));

    to connect the signal with the slot. However, my CRACK onInvokeResult() is never called. Why is this?

    (1) something wrong with my application?

    (2) signal/slot mechanism only works inside your own application. If this approach can be used when calling invoke() to an external application. Signal/slot isn't an IPC mechanism.

    Documentation says errorType and errorCode is valid after the finished() signal.

    BB::System:InvokeTargetReply * response = qobject_cast(sender());
    BB::System:InvokeReplyError:type errorType = response-> error();
    int errorCode = response-> errorCode();

    If the signal/slot mechanism cannot be used internally within your own application, how can you know if the invoke() on an external application would be successful?

    I wasn't looking to extract the right aways errorType and errorCode after calling invoke()... maybe that can already tell me the result?

    BR, René

    Thanks for sharing this code. My code is almost the same. And I solved the problem. My code now looks like this:

    BB::System:InvokeManager invokeMgr;
    response of BB::System:InvokeTargetReply * = invokeMgr.invoke (invokeRequest);
    If (answer)
    {
    Set the parent for this 'response' otherwise 'response' will be deleted at the end of this function.
    response-> setParent (this);
    Boolean result = QObject::connect (response, SIGNAL (finished (()), this, SLOT (onInvokeResult ()));
    ...

    void controller:nInvokeResult()
    {
    Get the response from the sender object
    BB::System:InvokeTargetReply * response = qobject_cast(sender());
    BB::System:InvokeReplyError:type errorType = response-> error();
    int errorCode = response-> errorCode();

    response-> deleteLater();
    }

    It turns out that it is absolutely essential to add a parent to the response using the line "answer-> setParent (this);" in order to receive the signal finished(). If this line is commented out, then the slot is more will be called.

    You may not use a local variable for the answer, but a member of the class. That also seems to work.

    Thanks for the help!

    BR, René

  • InvokeTargetReply finished() signal not shooting?

    I have a problem like that in the original post in this thread:

    http://supportforums.BlackBerry.com/T5/native-development/invokation-framework-slot-for-signal-Finis...

    The poster of thread apparently solved their problem for their use case by invoking a card instead of an application, but this solution is not suitable for my use case - I simply invoke a basic application, by using a reusable code taken right out of BlackBerry tutorials, and apparently, so the launch of base app, finished() signal is not emitted.  This seems so basic that I expect others have run across it, and there is a subtle touch that is not sufficiently covered in the tutorials.

    Code:

    void ApplicationUI::launchCoreApp() {
    
        qDebug() << "The launchCoreApp() method was called";
    
        bb::system::InvokeManager invokemanager;
        bb::system::InvokeRequest request;
    
        request.setAction("bb.action.OPEN");
        request.setTarget("sys.browser");
        request.setUri("http://www.blackberry.com");
    
        bb::system::InvokeTargetReply *reply = invokemanager.invoke(request);
    
        if(reply) {
            if(reply->isFinished()) {
                qDebug() << "In launchCoreApp(), reply finished before we could connect signal to handler slot";
            } else {
                qDebug() << "In launchCoreApp(), connecting reply finished signal to handler slot";
                bool ok = connect(reply, SIGNAL(finished()), this, SLOT(onInvokeTargetFinished()));
                Q_ASSERT(ok);
            }
    
        }
    
    }
    
    void ApplicationUI::onInvokeTargetFinished() {
        qDebug() << "The onInvokeTargetFinished() slot was reached";
    }
    

    Note that this is just a test code and I didn't intend to instantiate a new InvokeManager on each call to the launchCoreApp() function - I just need to see how things work.

    So, when I run the above, launches the browser and goes to the provided URI, my debug console told me that the value of reply-> isFinished() is false, so my code takes the branch to connect the finished() signal to the onInvokeTargetFinished() slot.

    However, the slot is apparently never called, not the browser launch and not when I close the browser.

    It's reusable code light directly from the tutorials and docs, but it doesn't seem to work as announced.

    When subtle I'm missing?

    Where in the lifecycle of the invocation request response is the finished() signal is supposed to be issued?  The reference docs are very clear on this - they just say it is issued when the response message is "received", whatever that means (I understand that it is a future model, I'm not clear which is received in the life cycle integer invocation response).

    I am compiling against level API 10.2 BTW.

    I work, the only thing needed is to define the parent for the response, otherwise it will be deleted at the end of the function where it is created.

        bb::system::InvokeTargetReply *reply = invokemanager.invoke(request);
        reply->setParent(this);
    

    The parent is responsible to remove the answer, so be sure to remove it in your home.

    void ApplicationUI::onInvokeTargetFinished() {
        qDebug() << "The onInvokeTargetFinished() slot was reached";
        bb::system::InvokeTargetReply *reply = qobject_cast(sender());
        reply->deleteLater();
    }
    
  • Will be Firefox for android get firefox Hello? Or will never happen because telefonica is not interested to have in firefox for android?

    Firefox for android will get firefox Hello and when? Or will never happen because telefonica is not interested to have in firefox for android?
    Hello, Firefox is the right thing and it would be much larger if it is available on android for direct use from phone to phone.

    I don't have an ETA for you, but it is spoken, here is a list of bugs to integrate the UX, etc.:

  • Downloaded the new 31.1.1 and now, the program adds quotes in my email addresses and gets rejected by my server. Never happened before. Please fix this!

    It's never happened before. Ever since I downloaded the new version 31.1.1, Thunderbird adds automatically quotes in my email addresses in my address books, but only when I send an email in bulk for a lot of people. These quotes "" "show up on top of the same e-mail addresses in the"to"or"bcc"list of recipients, then on my server refuses to send. Please fix this. Sincerely, Doc

    your address entries have a space either before they address book so they get cited. check the entries in the address book for an attack or of trailing white space

  • Downloaded just ver9 Firefox, now I can't record passwords, what, what's the problem with worm 9, this never happened with other versions.

    Just download Firefox VER 9, now I'm unable to save passwords, this never happened with an another Version of Firefox. I have tried everything I know to solve this problem, I ticked the boxes in the options, where it says to save passwords, don't know what else to do, may be using Solution Explorer.
    Thank you bob.

    Do you hear the names and passwords in the password manager or do you mean that you are connected is no longer on to (remember to) Web sites after the closing and restarting Firefox?

    There is a difference between remembering the name and the password in the password manager and a check box "remember me" on a web page.

    The latter usually involves the creation of a special "remember me" cookie that is stored on your computer and which is sent to the server.

    If that "remember me" cookie is deleted or is corrupted or is not send to the server, then the server remember that you and you must connect once again.

    Make sure that you are not Firefox running in permanent private browsing mode.

    To view the history settings and cookies, choose:

    • Tools > Options > privacy, choose the setting Firefox will: use the custom settings for the story of
    • Uncheck the box: [] "always use the navigation mode private.
  • When I try to put on Facebook, it continues to blink on and off never happened before

    When I try to access Facebook on my IPad it continues to blink on and outside. Never happen before. What is the problem.

    App or browser?

  • Identification code of SRX never happens. Cannot continue with my Hotmail account unclocking, until I get

    My salvation account has been hacked and then blocked. I did everything to get an identification code of SRX, but it never happens in the new account, I put in place so that I can be contacted. Ive followed all the forms, filled in the forms, recent data from e-mail etc., etc.. I spoke twice on "live chat" and don't always get the case. Email ID SRX does not happen in my new account. Can someone please.

    Thank you

    Emma

    Windows Live Hotmail is supported in this forum
    http://answers.Microsoft.com/en-us/windowslive/Forum/Hotmail?tab=all

  • When you run an old compiled Basic program I get a corrupted message message string space, which has never happened before

    When you run an old compiled Basic program I get a corrupted message message string space, which has never happened before

    hch17

    I suggest that also ask you your question to the MSDN Visual Basic Forum

    Visual Basic general forum

    http://social.msdn.Microsoft.com/forums/en-us/vbgeneral/threads

    Don't forget to register

    1 Basic version of the program has been compiled with

    2. the current PC operating system

    3 environment if used programmatically

  • My hotmail account is blocked and the microsoft unlock code never happens

    My hotmail address * address email is removed from the privacy * has been blocked because it was hacked. I am told that a code of re - open this account will be sent to my email address * address email is removed from the privacy * but it never happens. Can you help me to open this account again please?

    Hello

    Answers is a peer group supported and unfortunately has no real influence on Hotmail.

    HotMail has its own Forums, so you can ask your questions there.

    Windows Live Solution Center - HotMail - HotMail Forums Solutions
    http://windowslivehelp.com/

    Hotmail - Forums
    http://windowslivehelp.com/forums.aspx?ProductID=1

    Hotmail - Solutions
    http://windowslivehelp.com/solutions.aspx?ProductID=1

    How to contact Windows Live Hotmail Support
    http://email.about.com/od/hotmailtips/Qt/et_hotmail_supp.htm

    Windows Live Hotmail Top issues and Support information
    http://support.Microsoft.com/kb/316659/en-us

    Compromised account - access unauthorized account - how to recover your account
    http://windowslivehelp.com/solution.aspx?SolutionID=6ea0c7b3-1473-4176-b03f-145b951dcb41

    Hotmail hacked? Take these steps
    http://blogs.msdn.com/b/securitytipstalk/archive/2010/07/07/Hotmail-hacked-take-these-steps.aspx

    I hope this helps.

  • Hi, windows 7 Disk Defragmenter problems daily schedule set for all discs, never happens, it sometimes takes weeks

    Hi, windows 7 Disk Defragmenter problems daily schedule set for all discs, never happens, it sometimes takes weeks. Have a disk busy on the farm that is used for the storage of video surveillance. When I realize the performance issues, I check and find tht 'daily' Setup for MS disk defragmentation is not in fact run every day. I am watching silent movies and waiting for a 500 GB drive to effectively defragment, pass it is on average 1 percent per minute (with any other IO goes on the disc and app collection closed).

    There must be (I hope) a flag I can put to Disk Defragmenter to be more aggressive in its analysis.

    It is Windows 7 64 bit running on AMD processors, disks are sATA plugged in, although there is also a matrix RAID PCI Promise, it's usually when I started Hello I/O on the Board of 2 TB or utilization of the 'C', I realize the lack of defragmentation. I recall, before the SP1 under WIN 7, he ran on a daily basis, in fact, rather than an API algorith "guess".

    System is in place 24 x 7 (I turn off the monitor at the time of sunset), there is no "powersaver" feature used on this particular device. I edited my original question because after many years of support, I realized, by asking the initial question, that I was not providing information that I would be asked a customer, if I was still doing this job.

    Kind regards

    Lorin Boyack

    Hello Lorin,

    There are several reasons why the built-in Defragmenter may not work correctly:

    Method 1: He is also a malware on the system. Solution: Run an anti-virus control and also a spyware check.

    I suggest you scan your computer with the Microsoft Security Scanner, which would help us to get rid of viruses, spyware and other malicious software.

    The Microsoft Security Scanner is a downloadable security tool for free which allows analysis at the application and helps remove viruses, spyware and other malware. It works with your current antivirus software.

    http://www.Microsoft.com/security/scanner/en-us/default.aspx

     

    Note: The Microsoft Safety Scanner ends 10 days after being downloaded. To restart a scan with the latest definitions of anti-malware, download and run the Microsoft Safety Scanner again.

    Important: During the scan of the hard drive if bad sectors are found, the scanner tries to repair this sector, all available on which data may be lost.

    Method 2: The disk is too full (you need at least 15% free space, sometimes 20%). Solution: Delete files unnecessary and programs until you have more than 20% free space.

    Delete files using disk cleanup

    http://Windows.Microsoft.com/en-us/Windows7/delete-files-using-disk-cleanup

    Method 3: The disc is damaged and must be repaired. Solution:

    a. open "Computer" and right-click on the drive that you want to disable frag.

    b. Select 'Properties' and click on 'tools '.

    c. Select "Check now" to check the drive for errors.

    d. Select the two options and click on 'start '.

    Check your hard drive for errors

    http://Windows.Microsoft.com/en-us/Windows7/check-your-hard-disk-for-errors

     

    Important: While running chkdsk (check disk) hard disk, if bad sectors are found on the hard drive when chkdsk attempts to repair this sector, the data available in this area may be lost, and it is not recoverable.

    (This can take time and can restart the PC so that it can do the check at boot time. Be patient and let it complete).

    Method 4: Disk Defragmenter may be corrupted, requiring a system restore to fix.

    System restore

    http://Windows.Microsoft.com/en-us/Windows7/products/features/system-restore

     

    NOTE: When you use system restore to restore the computer to a previous state, the programs and updates that you have installed are removed.

    Method 5: There are other programs that are running this interruption, the built-in Defragmenter. Solution:

    a. close all running programs.

    b. If you think there may be some programs that run in the background.

    c. press Ctrl + Alt + Delete and

    d. Select "start Task Manager".

    e. under the 'Applications' tab, you will find a list of all running applications - you can close these by selecting "end task."

    Hope this information helps. For any other corresponding Windows help, do not hesitate to contact us and we will be happy to help you.

  • my microsoft security essentials stops suddenly... it disappears from the lower tray and doesn't start again... Despite the relocation, the sane never happens again...

    my microsoft security essentials stops suddenly... it disappears from the lower tray and doesn't start again... Despite the relocation, the sane never happens again... Help, please

    You can be better to ask here - http://answers.microsoft.com/en-us/protect/forum/mse in the region of MSE.

    If you post here, please post error messages or event log error reports about this, if there are.

    Meanwhile check for malware on the PC which may be trying to stop the MSE by download, installation, update (by right clicking on its icon and 'run as administrator' then go to the update tab) and scan with malwarebytesfree.

  • I have been designing a new Web site and when I publish on BusinessCatalyst the index page shows a sign 'coming soon '? This has never happened before and I don't know how to solve this problem?

    I have been designing a new Web site and when I publish on BusinessCatalyst the index page shows a sign 'coming soon '? This has never happened before and I don't know how to solve this problem?

    I have published on an existing site, but also a new site, but I get the same message?

    Hello

    Open the page that wants to set as your home page,

    Click on more action-> set as start page

    Now visit the site again, it should be good.

    Let me know if you have any question.

  • Download executable never happened and I tried all day, what I do

    Download of the cc installation executable never happened and I tried all day what I do

    Make sure that you are logged on the Adobe site, having cookies enabled, clearing your cookie cache.  If it fails to connect, try to use another browser.

    If you get any kind of error messages you must include them here.

  • PDFs with parts of the text have been highlighted, and now, suddenly, these docs print without the appropriate text highlighted. Never happened before. As seen on the screen, highlighting appears, but when you print, it's gone.  Help, please.

    PDFs with parts of the text have been highlighted, and now, suddenly, these docs print without the appropriate text highlighted. Never happened before. As seen on the screen, highlighting appears, but when you print, it's gone.  Help, please.

    Try to turn on the print with comments. The comments really are your strengths.

Maybe you are looking for

  • Firefox continues to run in the background after loging out.

    I connect on firefox. Close computer. When you try to restart firefox, I get a message that firefox is still ongoing.

  • OfficeJet Pro 8620:2 - back printing on HP 8620

    I use HP Officejet Pro on Mac OS X Yosemite 10.10.5 8620. It seems that 2 sides print has stopped working for some applications. It was working fine before. I tried to print from a Web site and selected 'double-sided' but impressions are released in

  • Unable to connect TV to new router

    KDL-46HX820. In the process of setting up the TV, I properly connected by Wi - Fi on my router Linksys Valet Wi - Fi. Later, I replaced this router with a Linksys E4200. The Linksys router has generated its own network ID and password. I tried to con

  • How to check that an e-mail message is REALLY from Microsoft?

    How to check that an e-mail message is REALLY from Microsoft? I received a message from Microsoft [* address email is removed from the privacy *] and I don't know if it's really from Microsoft. This happens a lot – I use Outlook, and he sometimes sen

  • Question about Compaq XP computer

    It's a question of both parties, I tried to fix my computer friends who was a Compaq with the XP pro operating system. Internet Explorer soon connect so I offered to Mozilla Firefox. I rebooted in safe mode and when I did IE 8 is super fast and perfe