Re: [Interest] QtThread

2014-01-22 Thread Thiago Macieira
On quarta-feira, 22 de janeiro de 2014 10:29:42, André Somers wrote: > Disagree there. There is every reason to run debug application code > against debug Qt libraries. If only because it enables asserts that > catch programming mistakes There aren't many of those. The Qt front-end API does not

Re: [Interest] QtThread

2014-01-22 Thread Etienne Sandré-Chardonnal
To follow André and Yves: - If you debug code within signal/slots or event mechanisms for instance, it's very handy to trace through Qt code. In Qt, your code is often called by Qt's classes. - It also activates many Q_ASSERT checks, for instance with out-of-bounds indices. With release qt libs,

Re: [Interest] QtThread

2014-01-22 Thread Yves Bailly
Le 21/01/2014 18:48, Constantin Makshin a écrit : > There's no real need to use debug version of Qt if you don't want to debug Qt > itself, so in most > cases the programmer won't see that warning. Sorry, but I strongly disagree with that... sometimes when facing a bug or some strange, hard-to-tr

Re: [Interest] QtThread

2014-01-22 Thread André Somers
Constantin Makshin schreef op 21-1-2014 18:48: > > There's no real need to use debug version of Qt if you don't want to > debug Qt itself, so in most cases the programmer won't see that warning. > Disagree there. There is every reason to run debug application code against debug Qt libraries. If o

Re: [Interest] QtThread

2014-01-21 Thread Constantin Makshin
There's no real need to use debug version of Qt if you don't want to debug Qt itself, so in most cases the programmer won't see that warning. On Jan 21, 2014 5:08 PM, wrote: > Le Mon, 20 Jan 2014 08:32:28 -0800, Thiago Macieira > écrivait: > > >I'd rather not add a check for things you shouldn'

Re: [Interest] QtThread

2014-01-21 Thread Thiago Macieira
On terça-feira, 21 de janeiro de 2014 10:43:34, Bo Thorsen wrote: > This point I won't just take, though. moveToThread is not an operation > that will be used often, so optimization is almost irrelevant. Well, I > certainly hope that noone does moveToThread a lot moveToThread is not a virtual, s

Re: [Interest] QtThread

2014-01-21 Thread qt . dantec
Le Mon, 20 Jan 2014 08:32:28 -0800, Thiago Macieira écrivait: >I'd rather not add a check for things you shouldn't do but that might still >work nonetheless. That's wasted CPU cycles for people who did the right thing. Then only check it in debug mode : Programmer will be warned against bad pr

Re: [Interest] QtThread

2014-01-21 Thread Till Oliver Knoll
Am 21.01.2014 um 10:54 schrieb George Tasopoulos : > ... > Does Qt have a way to check code before it's given to the compiler? > In theory yes: the moc pre-processor does parse the code (but only for relevant classes). But I don't think that adding "code validation" to moc would be a good idea

Re: [Interest] QtThread

2014-01-21 Thread George Tasopoulos
You're right. I've not read the docs in a while and remembered it wrong. --- Yours sincerely, George Tasopoulos On 21 Jan 2014 10:05, "Etienne Sandré-Chardonnal" wrote: > I don't see what is complicated here? > > if( (QObject*)targetThread==(QObject*)this ) > { > qWarning("That's wrong'); >

Re: [Interest] QtThread

2014-01-21 Thread Etienne Sandré-Chardonnal
I don't see what is complicated here? if( (QObject*)targetThread==(QObject*)this ) { qWarning("That's wrong'); return; } Etienne 2014/1/21 George Tasopoulos > Would it even be possible to check for such a thing? moveToThread accepts > a pointer to a QObject, and this pointer is passe

Re: [Interest] QtThread

2014-01-21 Thread George Tasopoulos
Would it even be possible to check for such a thing? moveToThread accepts a pointer to a QObject, and this pointer is passed by value. How could the function know whether this value was given to it as "QObject* pObject" or "QObject* this"? Does Qt have a way to check code before it's given to the c

Re: [Interest] QtThread

2014-01-21 Thread Bo Thorsen
Den 20-01-2014 17:32, Thiago Macieira skrev: > On segunda-feira, 20 de janeiro de 2014 12:41:33, Bo Thorsen wrote: >> I have just created a suggestion in the bug tracker to make it illegal >> to do moveToThread(this): >> >> https://bugreports.qt-project.org/browse/QTBUG-36278 >> >> It can't be said

Re: [Interest] QtThread

2014-01-20 Thread Thiago Macieira
On segunda-feira, 20 de janeiro de 2014 12:41:33, Bo Thorsen wrote: > I have just created a suggestion in the bug tracker to make it illegal > to do moveToThread(this): > > https://bugreports.qt-project.org/browse/QTBUG-36278 > > It can't be said often enough: Don't do this! But if it was illega

Re: [Interest] QtThread

2014-01-20 Thread Bo Thorsen
Den 13-01-2014 17:05, Etienne Sandré-Chardonnal skrev: > Thanks for the link! > > You are right, in fact only the moveToThread(this) approach should be > really avoided. > > > 2014/1/13 Sze Howe Koh > > > To balance things out, here's a direct response to Etienne'

Re: [Interest] QtThread

2014-01-14 Thread Graham Labdon
-project.org Subject: Re: [Interest] QtThread On 13 January 2014 18:26, Etienne Sandré-Chardonnal wrote: > Hi, > > As Andrey pointed out, there is not a single way. But if you want to > use a QThread for running QObjects with its event loop, the most > simple way is not to subclass, a

Re: [Interest] QtThread

2014-01-13 Thread Thiago Macieira
On segunda-feira, 13 de janeiro de 2014 11:35:12, Chaser wrote: > Derive from QThread and moveToThread() are two correctly use-case of > QThread. Just to be clear: those are two correct use-cases but they can't be used at the same time. Option 1: derive from QThread (and override run(), writing

Re: [Interest] QtThread

2014-01-13 Thread Etienne Sandré-Chardonnal
Thanks for the link! You are right, in fact only the moveToThread(this) approach should be really avoided. 2014/1/13 Sze Howe Koh > To balance things out, here's a direct response to Etienne's first > link: http://woboq.com/blog/qthread-you-were-not-doing-so-wrong.html > >

Re: [Interest] QtThread

2014-01-13 Thread Sze Howe Koh
On 13 January 2014 18:26, Etienne Sandré-Chardonnal wrote: > Hi, > > As Andrey pointed out, there is not a single way. But if you want to use a > QThread for running QObjects with its event loop, the most simple way is not > to subclass, and moveToThread. > > This is well explained here: > http://

Re: [Interest] QtThread

2014-01-13 Thread Etienne Sandré-Chardonnal
Hi, As Andrey pointed out, there is not a single way. But if you want to use a QThread for running QObjects with its event loop, the most simple way is not to subclass, and moveToThread. This is well explained here: http://blog.qt.digia.com/blog/2010/06/17/youre-doing-it-wrong/ http://mayaposch.w

Re: [Interest] QtThread

2014-01-13 Thread Chaser
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 > Hi I have been reading about QtThread and there seems to be a lot > of discussion about how to correctly use this class. i.e. should > developers derive from QtThread or provide an QObject and move this > object to a thread. The examples provided w

[Interest] QtThread

2014-01-13 Thread Graham Labdon
Hi I have been reading about QtThread and there seems to be a lot of discussion about how to correctly use this class. i.e. should developers derive from QtThread or provide an QObject and move this object to a thread. The examples provided with Qt5 derive from QtThread whereas there is a lot of