PDA

View Full Version : How to do in case of unused event



franco.amato
18th October 2010, 22:13
Hi to all,
I have an event where I don't do nothing with the 'event' variable so:


void WaveWidget::focusInEvent( QFocusEvent *event )
{
m_panel->setFocusLedColor(Qt::green);
}

As you can see I don't do nothing with the event variable (in my case I turn on a QLed) and when compile I get an warning that I would remove. Is there any way to avoid such warning? For example the wxWidgets toolkit has a macro named WX_UNUSED for this kind of problems.

Regards

Lykurg
18th October 2010, 22:21
If you use gcc there are also several switches to turn off warnings, but here you can simply use use the Q_UNUSED macro or just delete the "event", so that you have
void WaveWidget::focusInEvent( QFocusEvent *).

franco.amato
18th October 2010, 22:30
If you use gcc there are also several switches to turn off warnings, but here you can simply use use the Q_UNUSED macro or just delete the "event", so that you have
void WaveWidget::focusInEvent( QFocusEvent *).

I use visual studio.
Meanwhile your suggestion works.
Thank you