how to create asynchronus thread in qt ?
-
I have to show the file copy's value on progress bar using non blocking gui thread.
How to do this ?
-
I have to show the file copy's value on progress bar using non blocking gui thread.
How to do this ?
@Qt-embedded-developer said in how to create asynchronus thread in qt ?:
How to do this ?
You're long enough here to know that you won't get code form us.
Create a thread, copy the data from one file to another and emit the progress via a signal so you can show it in the main thread.
-
@Qt-embedded-developer said in how to create asynchronus thread in qt ?:
How to do this ?
You're long enough here to know that you won't get code form us.
Create a thread, copy the data from one file to another and emit the progress via a signal so you can show it in the main thread.
@Christian-Ehrlicher thread is blocking my main application gui so i requested how to create non blocking gui thread ?
-
@Christian-Ehrlicher thread is blocking my main application gui so i requested how to create non blocking gui thread ?
@Qt-embedded-developer said in how to create asynchronus thread in qt ?:
thread is blocking my main application gui
Then you use your thread in a wrong way - a thread will never block another thread by itself. Read the docs.
-
@Qt-embedded-developer said in how to create asynchronus thread in qt ?:
How to do this ?
You're long enough here to know that you won't get code form us.
Create a thread, copy the data from one file to another and emit the progress via a signal so you can show it in the main thread.
@Christian-Ehrlicher said in how to create asynchronus thread in qt ?:
copy the data from one file to another and emit the progress via a signal
But one cannot use any
QFile::copy()
for this because it does not offer to send any progress signal, so you are intended to write the copy yourself? Since people often ask for this it would have been nice ifQFile::copy()
had such an option? -
@Christian-Ehrlicher said in how to create asynchronus thread in qt ?:
copy the data from one file to another and emit the progress via a signal
But one cannot use any
QFile::copy()
for this because it does not offer to send any progress signal, so you are intended to write the copy yourself? Since people often ask for this it would have been nice ifQFile::copy()
had such an option?@JonB said in how to create asynchronus thread in qt ?:
Since people often ask for this it would have been nice if QFile::copy() had such an option?
-
@JonB said in how to create asynchronus thread in qt ?:
Since people often ask for this it would have been nice if QFile::copy() had such an option?
@Christian-Ehrlicher
Ah, I did not know it was using a C runtimecopyfile()
, I assumed it was doing it itself (own source code).I can tell you one thing: there was no
copyfile(3)
in the standard C library when I started under System V.0 at least :) (Maybe it was always there in BSD, that wasn't what I was using.) I never looked to see they apparently added this/others to Clibc
!In that man page I'm reading that
copyfile()
already has a Progress Callback support mechanism which could be used from Qt? -
@Christian-Ehrlicher
Ah, I did not know it was using a C runtimecopyfile()
, I assumed it was doing it itself (own source code).I can tell you one thing: there was no
copyfile(3)
in the standard C library when I started under System V.0 at least :) (Maybe it was always there in BSD, that wasn't what I was using.) I never looked to see they apparently added this/others to Clibc
!In that man page I'm reading that
copyfile()
already has a Progress Callback support mechanism which could be used from Qt?@JonB said in how to create asynchronus thread in qt ?:
I can tell you one thing: there was no copyfile(3) in the standard C library when I started under System V.0 at least :)
modern filecopy operations often use mmap alchemy and let the OS virtual memory manager handle the IO with source and destination file handles. It can be much more efficient than block IO copies to/from user space.
-
@Christian-Ehrlicher
Ah, I did not know it was using a C runtimecopyfile()
, I assumed it was doing it itself (own source code).I can tell you one thing: there was no
copyfile(3)
in the standard C library when I started under System V.0 at least :) (Maybe it was always there in BSD, that wasn't what I was using.) I never looked to see they apparently added this/others to Clibc
!In that man page I'm reading that
copyfile()
already has a Progress Callback support mechanism which could be used from Qt?@JonB said in how to create asynchronus thread in qt ?:
In that man page I'm reading that copyfile() already has a Progress Callback support mechanism which could be used from Qt?
I don't see a reason why this should be added to Qt. As my other link shows it's not available for windows and if someone really needs it it can be simply done by themself as written in my first post.