title: qt/c++ context menu - disable an item
body: <p>I'm currently developing an app such as the browser using Qt and c++.</p>
  
  <p>I have create a contextual menu to allow on right click action such as delete, rename and add folder.</p>
  
  <pre><code>void MyTreeWidget::createContextMenu() {    
      contextMenu = new QMenu();
      setContextMenuPolicy(Qt::ActionsContextMenu);
  
      addFolderAction = new QAction("Add Folder", contextMenu);
      addAction(addFolderAction);
      connect(addFolderAction, SIGNAL(triggered()),this,SLOT(onAddFolderActionTree()));
  
      deleteAction = new QAction("Delete", contextMenu);
      addAction(deleteAction);
      connect(deleteAction, SIGNAL(triggered()),this,SLOT(onDeleteAction()));
  
      RenameAction = new QAction("Rename", contextMenu);
      addAction(RenameAction);
      connect(RenameAction, SIGNAL(triggered()),this,SLOT(onRenameAction()));
  
  }
  </code></pre>
  
  <p>This is working fine. This contextual menu is used when you select a file or folder in my treewidget and make a right click. My issue is that I propose the "add folder" option even if I select a file. You can't create a folder inside a file.</p>
  
  <p>What I want is to disable the option when a file is selected and enable it when it's a folder.</p>
  
  <p>I can know if it's file or folder by getting the TreeWidgetItem class I have overloaded:</p>
  
  <p>Thanks</p>