[Qt-interest] How to implement a `Stop Button' ?
Daniel Price
daniel.price at fxhome.com
Fri May 14 18:44:21 CEST 2010
Nice example - one thing to be aware of though is that your hasher object is constructed in another thread (presumably the main thread) from the thread that does the work in run(). This could cause issues.
A better solution would be to construct the QCryptographicHash within run(). That way everything is in the same thread.
> -----Original Message-----
> From: qt-interest-bounces at trolltech.com [mailto:qt-interest-
> bounces at trolltech.com] On Behalf Of Richard Moore
> Sent: 12 May 2010 09:42
> To: qt-interest at trolltech.com
> Subject: Re: [Qt-interest] How to implement a `Stop Button' ?
>
> On Wed, May 12, 2010 at 3:00 AM, Michael Jackson
> <mike.jackson at bluequartz.net> wrote:
> > You will need to push your searching for the strings task onto its
> own
> > thread. There are several ways to do this. The Qt Documentation goes
> into
> > detail on how to do this. Some ideas would be the following:
> >
> > Hook up some signals/slots between the gui button and the task so
> that when
> > the user clicks the "Stop" button a signal is sent to the thread that
> marks
> > it for cancelation.
> >
> > When the task is completed, signal the mail thread to set the GUI
> back to a
> > proper state.
>
> I wrote a simple example that shows how you can do this sort of thing
> at http://www.kdedevelopers.org/node/4138
>
> Rich.
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
> No virus found in this incoming message.
> Checked by AVG - www.avg.com
> Version: 9.0.819 / Virus Database: 271.1.1/2866 - Release Date:
> 05/11/10 19:40:00
This email is confidential. It may also be privileged or otherwise protected by work product immunity or other legal rules. If you are not the intended recipient please notify the sender. Please delete the message from all places in your computer where it is stored. You should not copy the email or use it for any purpose or disclose its contents to any other person.To do so may be unlawful. Email is an informal means of communicating and may be subject to data corruption accidentally or deliberately. For this reason it is inappropriate to rely on advice contained in an email without obtaining written confirmation of it first.
FXhome Limited is a limited company registered in England and Wales. Registered number: 04172812. Registered office: The Henderson Business Centre, Ivy Road, Norwich, Norfolk, NR5 8BF, U.K.
More information about the Qt-interest-old
mailing list