Hi,
I have problem with QMenu :
When I delete file where i save history and bookmarks it work fine
WebBrowser2.png
but after time it look so:
WebBrowser.png
Save method:
Qt Code:
  1. QFile DataFile("Data.ini");
  2. if(!DataFile.open(QIODevice::WriteOnly))
  3. {
  4. return;
  5. }
  6. DataFile.resize(0);
  7. QDataStream out(&DataFile);
  8. out.setVersion(QDataStream::Qt_4_8);
  9. out << allHistoryAction << bookmarks->actions();
  10. qDebug() << "save data";
  11. DataFile.flush();
  12. DataFile.close();
To copy to clipboard, switch view to plain text mode 
load method:
Qt Code:
  1. QFile DataFile("Data.ini");
  2. if(!DataFile.open(QIODevice::ReadOnly))
  3. {
  4. return;
  5. }
  6. QDataStream in(&DataFile);
  7. in.setVersion(QDataStream::Qt_4_8);
  8. QList<QAction*> actions;
  9. in >> allHistoryAction >> actions;
  10. bookmarks->clear();
  11. bookmarks->addActions(actions);
  12. qDebug() << "loading data";
  13. history->clear();
  14. history->addActions(allHistoryAction);
  15. DataFile.close();
  16. foreach (QAction *action, allHistoryAction)
  17. {
  18. connect(action, SIGNAL(triggered()), this, SLOT(HistoryAction()));
  19. }
  20. foreach (QAction *action, actions)
  21. {
  22. connect(action, SIGNAL(triggered()), this, SLOT(HistoryAction()));
  23. }
To copy to clipboard, switch view to plain text mode