title: How to gray out a menu item again in Qt
body: <p>I am working with qt and have created a menu bar like "File" with some sub menu items "Open", "Save", "SaveAs", "Close", "Quit". I also created actions like "actionNew", "actionOpen", ... and so on. I used the same actions for the tool bar and disable the menu and tool bar items into the constructor with the "disableItems()" function, that works fine and the tool bar and menu items are gray out. If I clicked the sub menu item "New", the tool bar and menu items are enabled and not gray out, that also works fine, but if I clicked the sub menu item "Close" only the tool bar items gray out and the menu items are still enabled :(. How can i fix it? Hope you can help me and sorry for my bad English ;)</p>
  
  <pre><code>MainWindow::MainWindow(QWidget *parent)
  :QMainWindow(parent), ui(new Ui::MainWindow)
  {
    ui-&gt;setupUi(this);
    /* disable menu items and tool bar items */
    disableItems();
  }
  void MainWindow::disableItems()
  {
    ui-&gt;actionSave-&gt;setEnabled(false);
    ui-&gt;actionSaveAs-&gt;setEnabled(false);
    ui-&gt;actionClose-&gt;setEnabled(false);
  }
  void MainWindow::enableItems()
  {
    ui-&gt;actionSave-&gt;setEnabled(true);
    ui-&gt;actionSaveAs-&gt;setEnabled(true);
    ui-&gt;actionClose-&gt;setEnabled(true);
  }
  void MainWindow::on_actionNew_triggered()
  {
    enableItems();
  }
  void MainWindow::on_actionClose_triggered()
  {
    disableItems();
  }
  </code></pre>