Results 1 to 3 of 3

Thread: How to do in case of unused event

  1. #1
    Join Date
    Nov 2007
    Location
    Italy
    Posts
    692
    Thanks
    59
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default How to do in case of unused event

    Hi to all,
    I have an event where I don't do nothing with the 'event' variable so:

    Qt Code:
    1. void WaveWidget::focusInEvent( QFocusEvent *event )
    2. {
    3. m_panel->setFocusLedColor(Qt::green);
    4. }
    To copy to clipboard, switch view to plain text mode 

    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
    Franco Amato

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: How to do in case of unused event

    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
    Qt Code:
    1. void WaveWidget::focusInEvent( QFocusEvent *)
    To copy to clipboard, switch view to plain text mode 
    .

  3. #3
    Join Date
    Nov 2007
    Location
    Italy
    Posts
    692
    Thanks
    59
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to do in case of unused event

    Quote Originally Posted by Lykurg View Post
    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
    Qt Code:
    1. void WaveWidget::focusInEvent( QFocusEvent *)
    To copy to clipboard, switch view to plain text mode 
    .
    I use visual studio.
    Meanwhile your suggestion works.
    Thank you
    Franco Amato

Similar Threads

  1. Event propagation-Windows key special case
    By hanumanth in forum Qt Programming
    Replies: 0
    Last Post: 16th April 2010, 15:46
  2. how to get MouseClick Event in this case
    By yxmaomao in forum Qt Programming
    Replies: 3
    Last Post: 17th July 2008, 03:03
  3. It seems that Qt does not release unused memory
    By iw2nhl in forum Qt Programming
    Replies: 31
    Last Post: 25th November 2007, 20:02
  4. Problem with unused parameter
    By devilj in forum Qt Programming
    Replies: 5
    Last Post: 4th July 2007, 18:48
  5. Unused parameters in slots
    By ePharaoh in forum Qt Programming
    Replies: 3
    Last Post: 22nd March 2006, 08:30

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.