PDA

View Full Version : QMenu



Viper666
5th October 2012, 14:29
Hi,
I have problem with QMenu :
When I delete file where i save history and bookmarks it work fine
8288
but after time it look so:
8287
Save method:
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();
load method:
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()));
}

amleto
5th October 2012, 20:15
I dont understand what is wrong.

Viper666
6th October 2012, 08:54
look at second picture the menu show at top. But i solved it :D

amleto
6th October 2012, 13:34
oh, right. so how did you solve it?