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:
QFile DataFile
("Data.ini");
{
return;
}
DataFile.resize(0);
out << allHistoryAction << bookmarks->actions();
qDebug() << "save data";
DataFile.flush();
DataFile.close();
QFile DataFile("Data.ini");
if(!DataFile.open(QIODevice::WriteOnly))
{
return;
}
DataFile.resize(0);
QDataStream out(&DataFile);
out.setVersion(QDataStream::Qt_4_8);
out << allHistoryAction << bookmarks->actions();
qDebug() << "save data";
DataFile.flush();
DataFile.close();
To copy to clipboard, switch view to plain text mode
load method:
QFile DataFile
("Data.ini");
{
return;
}
QList<QAction*> actions;
in >> allHistoryAction >> actions;
bookmarks->clear();
bookmarks->addActions(actions);
qDebug() << "loading data";
history->clear();
history->addActions(allHistoryAction);
DataFile.close();
foreach
(QAction *action, allHistoryAction
) {
connect(action, SIGNAL(triggered()), this, SLOT(HistoryAction()));
}
{
connect(action, SIGNAL(triggered()), this, SLOT(HistoryAction()));
}
QFile DataFile("Data.ini");
if(!DataFile.open(QIODevice::ReadOnly))
{
return;
}
QDataStream in(&DataFile);
in.setVersion(QDataStream::Qt_4_8);
QList<QAction*> actions;
in >> allHistoryAction >> actions;
bookmarks->clear();
bookmarks->addActions(actions);
qDebug() << "loading data";
history->clear();
history->addActions(allHistoryAction);
DataFile.close();
foreach (QAction *action, allHistoryAction)
{
connect(action, SIGNAL(triggered()), this, SLOT(HistoryAction()));
}
foreach (QAction *action, actions)
{
connect(action, SIGNAL(triggered()), this, SLOT(HistoryAction()));
}
To copy to clipboard, switch view to plain text mode
Bookmarks