WidgetMenuExtended removeItem

2006-12-27
2013-04-08
  • Nobody/Anonymous

    Calling removeItem more than twice causes the application to crash.
    Using Version 2.0.0 RC1. I want to remove several items from a context menu by iterating through it like:

    for ( int i = start; i < end; ++i )
        contextMenu->removeItem(i);

     
    • Conrado PLG

      Conrado PLG - 2006-12-27

      You should remove from end to start. removeItem is based on the menu position, when you remove an item, all subsequent items change positions!

      for ( int i = end - 1; i >= start; --i )
        contextMenu->removeItem(i);

      or (a little bit less intuitive):

      for ( int i = start; i < end; ++i )
        contextMenu->removeItem(start);

       

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks