Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 6

Qt-interest Archive, March 2007
Slots do nothing with Qt 4.2 and 4.3.0beta on Windows Vista


Message 1 in thread

Hello !

My problem is, that when I click a button in my app, nothing happens.

The same source works on Linux, Mac OS X and Windows XP (Qt 4.2 and Qt 
4.3-beta).

But on Windows Vista nothing happens, the same source compiles without 
errors and warnings,
but when I click on the menu or on a button nothing happens.

The example programs work.

Is there anything to do on Windows Vista ?

Thanks a lot for helping me !

Heiko

--
 [ signature omitted ] 

Message 2 in thread

Heiko Steindl schrieb:
> Hello !
> ..
> But on Windows Vista nothing happens, the same source compiles without
> errors and warnings,
> but when I click on the menu or on a button nothing happens.

Did you try building in Debug mode and watch for suspicious "Slot not
available" messages generated by Qt in the Visual Studio debug output?
(Or try building your app as "Console app" and watch the debug
statements on the console?)

I know that this is the very first and obvious step (you might have
already taken), but usually it leads to the solution ;)

Cheers, Oliver

--
 [ signature omitted ] 

Message 3 in thread

Hi Oliver !

Thanks for your quick help !

The tip with CONFIG += console helped a lot !

The problem is by emitting the QAction::activated().

I looked in the documentation of Qt 4.3.0 and I saw, that I should use 
triggered() instead.

I'll try this ! ;-)

Thanks a lot !!

Heiko

Till Oliver Knoll schrieb:
> Heiko Steindl schrieb:
>   
>> Hello !
>> ..
>> But on Windows Vista nothing happens, the same source compiles without
>> errors and warnings,
>> but when I click on the menu or on a button nothing happens.
>>     
>
> Did you try building in Debug mode and watch for suspicious "Slot not
> available" messages generated by Qt in the Visual Studio debug output?
> (Or try building your app as "Console app" and watch the debug
> statements on the console?)
>
> I know that this is the very first and obvious step (you might have
> already taken), but usually it leads to the solution ;)
>
> Cheers, Oliver
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
>
>   


Message 4 in thread

Heiko Steindl schrieb:
>   Hi Oliver !
> ...
> I looked in the documentation of Qt 4.3.0 and I saw, that I should use
> triggered() instead.

Hmmm, in Qt 4.2 it is also the signal triggered(bool), but note the
parameter bool!

  http://doc.trolltech.com/4.2/qaction.html

Are you sure it works on the other platforms? If you really got the
connection wrong then I would expect that it fails on any platform.

Anyway, maybe you have written something like:

  // wrong
  connect (theaAction, SIGNAL(triggered()),
           this, SLOT(handleTriggered()));

This is also *wrong* (don't write parameter names, moc gets confused (at
least in Qt 3 you did not even get a compile warning AFAIK, don't know
about Qt 4); a typical copy/paste mistake):

  // also wrong
  connect (theAction, SIGNAL(triggered(bool checked)),
           this, SLOT(handleTriggered(bool checked)));

instead of:

  // correct
  connect (theaAction, SIGNAL(triggered(bool)),
           this, SLOT(handleTriggered()));

(or: SLOT(handleTriggered(bool)));

?

Anyway, the debug output should quickly help in this case :)

Good luck, Oliver

--
 [ signature omitted ] 

Message 5 in thread

On 26.03.07 18:14:57, Till Oliver Knoll wrote:
> Heiko Steindl schrieb:
> >   Hi Oliver !
> > ...
> > I looked in the documentation of Qt 4.3.0 and I saw, that I should use
> > triggered() instead.
> 
> Hmmm, in Qt 4.2 it is also the signal triggered(bool), but note the
> parameter bool!

That doesn't matter, one can connect a signal with n parameters to a
slot with 0-n parameters, if the n parameters in the signal have default
values assigned to them (see QAction docs, its false there)

>   http://doc.trolltech.com/4.2/qaction.html
> 
> Are you sure it works on the other platforms? If you really got the
> connection wrong then I would expect that it fails on any platform.

But only if he had Qt3Support deactivated on Windows (either via QT
variable or by not even compiling it in). The activated signal is still
part of the Qt3-compatibility API for QAction.

Andreas

-- 
 [ signature omitted ] 

Message 6 in thread

Andreas Pakulat schrieb:
> On 26.03.07 18:14:57, Till Oliver Knoll wrote:
>> Heiko Steindl schrieb:
>>>   Hi Oliver !
>>> ...
>>> I looked in the documentation of Qt 4.3.0 and I saw, that I should use
>>> triggered() instead.
>> Hmmm, in Qt 4.2 it is also the signal triggered(bool), but note the
>> parameter bool!
> 
> That doesn't matter, one can connect a signal with n parameters to a
> slot with 0-n parameters, if the n parameters in the signal have default
> values assigned to them (see QAction docs, its false there)

Not sure if I understood you correctly: In my previous post I actually
gave an example where I connected triggered(bool) (1 parameter) to
handleTriggered() (no parameter in the slot).

AFAIK default parameters in the signal (and yes, I noticed that the
'checked' parameter defaults to false) have nothing to do with that, you
/still/ have to write:

  connect (this, SIGNAL(triggered(bool)), // bool parameter is a must
           that, SLOT(...)));  // with or without bool parameter here

At least that was the case with Qt 3 I think. Does the moc in Qt 4 parse
this correctly when default parameters are available?

  // default signal parameter
  connect (this, SIGNAL(triggered()),   // does that work?
           tat, SLOT(...)));


Uhmm.. and now I'm not even sure about Qt 3, maybe the moc handled
default /signal/ parameters in a similar way?

> ...
> But only if he had Qt3Support deactivated on Windows (either via QT
> variable or by not even compiling it in). The activated signal is still
> part of the Qt3-compatibility API for QAction.

Good point :)

Cheers, Oliver

--
 [ signature omitted ] 

Message 7 in thread

On 27.03.07 10:55:33, Till Oliver Knoll wrote:
> Andreas Pakulat schrieb:
> > On 26.03.07 18:14:57, Till Oliver Knoll wrote:
> >> Heiko Steindl schrieb:
> >>>   Hi Oliver !
> >>> ...
> >>> I looked in the documentation of Qt 4.3.0 and I saw, that I should use
> >>> triggered() instead.
> >> Hmmm, in Qt 4.2 it is also the signal triggered(bool), but note the
> >> parameter bool!
> > 
> > That doesn't matter, one can connect a signal with n parameters to a
> > slot with 0-n parameters, if the n parameters in the signal have default
> > values assigned to them (see QAction docs, its false there)
> 
> Not sure if I understood you correctly: In my previous post I actually
> gave an example where I connected triggered(bool) (1 parameter) to
> handleTriggered() (no parameter in the slot).

Thats what I meant originally, missed that you already said that :)
However...

> AFAIK default parameters in the signal (and yes, I noticed that the
> 'checked' parameter defaults to false) have nothing to do with that, you
> /still/ have to write:
> 
>   connect (this, SIGNAL(triggered(bool)), // bool parameter is a must
>            that, SLOT(...)));  // with or without bool parameter here
> 
> At least that was the case with Qt 3 I think. Does the moc in Qt 4 parse
> this correctly when default parameters are available?
> 
>   // default signal parameter
>   connect (this, SIGNAL(triggered()),   // does that work?
>            tat, SLOT(...)));

Yes it does, a quick grep over kdevelop4 sources should >20 such
connects and they work well. I have no idea if this is also the case for
Qt3.

Andreas

-- 
 [ signature omitted ] 

Message 8 in thread

Heiko Steindl schrieb:
> ...
> The problem is by emitting the QAction::activated().

Seems like you are porting the app from Qt 3 ;)

  http://doc.trolltech.com/3.3/qaction.html

The signal is called triggered(*bool*) since Qt 4.

Cheers, Oliver


--
 [ signature omitted ] 

Message 9 in thread

First: Thank you all for helping !

With triggered() it works perfectly !

the strange thing is, that on all other platforms than windows vista, 
the activated() Signal works without any problems...

I changed all QAction::activated() signals in my application to 
triggered() and now it works ;-)

Thank you very much for helping !!!

Heiko

Heiko Steindl schrieb:
> Hello !
>
> My problem is, that when I click a button in my app, nothing happens.
>
> The same source works on Linux, Mac OS X and Windows XP (Qt 4.2 and Qt 
> 4.3-beta).
>
> But on Windows Vista nothing happens, the same source compiles without 
> errors and warnings,
> but when I click on the menu or on a button nothing happens.
>
> The example programs work.
>
> Is there anything to do on Windows Vista ?
>
> Thanks a lot for helping me !
>
> Heiko
>
> -- 
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with 
> "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
>

--
 [ signature omitted ] 

Message 10 in thread

I connected the SIGNAL( triggered(bool) ) to SLOT( doSomething().

And now I (think) found the problem: on all platforms I have qt3support 
activated, but on the Vista installation I have qt3support disabled.

Anyway, with triggered it works correctly ;-)

Thanks a lot !

Heiko

Heiko Steindl schrieb:
> First: Thank you all for helping !
>
> With triggered() it works perfectly !
>
> the strange thing is, that on all other platforms than windows vista, 
> the activated() Signal works without any problems...
>
> I changed all QAction::activated() signals in my application to 
> triggered() and now it works ;-)
>
> Thank you very much for helping !!!
>
> Heiko
>
> Heiko Steindl schrieb:
>> Hello !
>>
>> My problem is, that when I click a button in my app, nothing happens.
>>
>> The same source works on Linux, Mac OS X and Windows XP (Qt 4.2 and 
>> Qt 4.3-beta).
>>
>> But on Windows Vista nothing happens, the same source compiles 
>> without errors and warnings,
>> but when I click on the menu or on a button nothing happens.
>>
>> The example programs work.
>>
>> Is there anything to do on Windows Vista ?
>>
>> Thanks a lot for helping me !
>>
>> Heiko
>>
>> -- 
>> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx 
>> with "unsubscribe" in the subject or the body.
>> List archive and information: http://lists.trolltech.com/qt-interest/
>>
>>
>
> -- 
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with 
> "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
>

--
 [ signature omitted ]