QT GUI freezes when download starts
-
Tried ::fromUIserInput(), the effect is the same. I've made a separate call from QNetwork request and commented QNetworkAccessManager::get(). No freeze.
When I use QNetworkAccessManager::get() the problem rises again.
I have no idea, what's going on -
Take a look at "QNAM documentation":http://qt-project.org/doc/qt-4.8/qnetworkaccessmanager.html, especially provided snippets. Try doing it how it's done there (connect with QNAM::finished or QNetworkReply::readyRead()). Might also be a good idea to check with Wireshark for actual network traffic.
-
Well, problem is really strange. I take your code, add missing header file and run it. It works correctly. At least I did not observe any freeze. I just use qDebug() to check steps of program execution. The difference is only in system. I used Linux.
-
When I did this call to get my parameters:
QNetworkConfiguration config = networkManager->activeConfiguration();
Values like bearerName, identifier are empty. Do I need to provide some values to my network configuration?
Guziemic, it's very strange. I agree. -
No, you shouldn't need to provide those values. Some websites will refuse to serve you if you don't provide a User-Agent value, but that doesn't seem to be the case for your site.
This is a strange problem; I don't think it's a coding error.
Some more questions:
- Can you double-check that you are indeed using Qt 4.8.1 for MSVC2010? The MSVC2008 or MinGW variants won't work with your compiler.
- Have you tried running your program in a debugger?
- Are you compiling a 32-bit or 64-bit executable?
-
Ok
- running on a 64bit machine;
- Qt 4.8.1 for MSVC 2010;
- I tried to debug in MSVC. It can't reach QNAM::get() method.
I'm now running the very same project on QtCreator. The screen doesn't freeze but the problem remains with the get() method.
Running wireshark I can see requests from QNetworkAccessManager. But any signal is sent on my program.
Very, very strange. -
[quote author="qtBeginner" date="1348846736"]- running on a 64bit machine;
[/quote]Running a 64bit machine isn't an issue. The question is, are you COMPILING a 64bit program?[quote author="qtBeginner" date="1348846736"]- I tried to debug in MSVC. It can't reach QNAM::get() method.[/quote]What do you mean "can't reach QNAM::get()"? What happens? What's the last thing it reaches?
[quote author="qtBeginner" date="1348846736"]But any signal is sent on my program.[/quote] Sorry, I don't understand this line. Could you please explain again?
-
Sorry, I'll clarify myself.
- I'm compilng a 32bit program;
- Debugging program, inserting a breakpoint in the line where QNAM::get() is, the program freezes;
- When I say signal, I mean the signal function inserted on QObject::connect.
Is this ok? Thanks for help
-
Fellows it works. I think this is a bug related to qt plugin for VS2010. Running the project with QtCreator the image was downloaded fine.
On Qt, screen was not freezing because I wasn't calling QObject::connect to my button.
Really, the very same code works on QtCreator, but not in VS2010.
Can someone explains how this occurs? -
You're probably right; it sounds like a bug with the VS2010 plugin. I've never encountered this before, so I don't know what's happening, sorry. It would be good to search if anyone else has had this problem, and if not, file a bug report at https://bugreports.qt-project.org
Check if the build type affects the freeze -- does it freeze with both Debug and Release builds?
Also, what happens if you launch your program by itself? Copy your .exe, and the required DLLs to a separate folder, and open the .exe from Windows Explorer
If you can't get it to work on VS2010, I can think of 2 options:
Develop this program on QtCreator
Upgrade to Qt 4.8.3