Ticket #46536: debug-menuItem-already-in-menu.patch

File debug-menuItem-already-in-menu.patch, 1.1 KB (added by RJVB (René Bertin), 10 years ago)

a new patch that makes Qt5.4 print out more useful info when warning about a menu item already added to a menu

  • qtbase/src/plugins/platforms/cocoa/

    old new  
    303303    if (item->isMerged())
    304304        return;
    305305
    306     if ([item->nsItem() menu]) {
    307         qWarning() << Q_FUNC_INFO << "Menu item is already in a menu, remove it from the other menu first before inserting";
     306    NSMenu *m = [item->nsItem() menu];
     307    if (m) {
     308        QString mTitle = QCFString::toQString([m title]);
     309        if (beforeItem) {
     310            qWarning() << Q_FUNC_INFO << "Menu item" << item->text() << "is already in menu" << mTitle
     311                       << "after item" << beforeItem->text()
     312                       << ", remove it from the other menu first before inserting";
     313        } else {
     314            qWarning() << Q_FUNC_INFO << "Menu item" << item->text() << "is already in menu" << mTitle
     315                       << ", remove it from the other menu first before inserting";
     316        }
    308317        return;
    309318    }
    310319    // if the item we're inserting before is merged, skip along until