update refresh menu item on stateChanged signal instead of when opening the menu

This commit is contained in:
Marc Zinnschlag 2015-06-25 13:05:57 +02:00
parent 6fbdbb11d5
commit 69db0179ca
3 changed files with 16 additions and 3 deletions

View file

@ -15,7 +15,12 @@ CSVTools::ReportSubView::ReportSubView (const CSMWorld::UniversalId& id, CSMDoc:
SIGNAL (focusId (const CSMWorld::UniversalId&, const std::string&)));
if (mRefreshState==CSMDoc::State_Verifying)
{
connect (mTable, SIGNAL (refreshRequest()), this, SLOT (refreshRequest()));
connect (&document, SIGNAL (stateChanged (int, CSMDoc::Document *)),
mTable, SLOT (stateChanged (int, CSMDoc::Document *)));
}
}
void CSVTools::ReportSubView::setEditLock (bool locked)

View file

@ -77,10 +77,7 @@ void CSVTools::ReportTable::contextMenuEvent (QContextMenuEvent *event)
}
if (mRefreshAction)
{
mRefreshAction->setEnabled ((mDocument.getState() & mRefreshState)==0);
menu.addAction (mRefreshAction);
}
menu.exec (event->globalPos());
}
@ -181,6 +178,7 @@ CSVTools::ReportTable::ReportTable (CSMDoc::Document& document,
if (mRefreshState)
{
mRefreshAction = new QAction (tr ("Refresh"), this);
mRefreshAction->setEnabled (!(mDocument.getState() & mRefreshState));
connect (mRefreshAction, SIGNAL (triggered()), this, SIGNAL (refreshRequest()));
addAction (mRefreshAction);
}
@ -301,3 +299,9 @@ void CSVTools::ReportTable::clear()
{
mModel->clear();
}
void CSVTools::ReportTable::stateChanged (int state, CSMDoc::Document *document)
{
if (mRefreshAction)
mRefreshAction->setEnabled (!(state & mRefreshState));
}

View file

@ -76,6 +76,10 @@ namespace CSVTools
void removeSelection();
public slots:
void stateChanged (int state, CSMDoc::Document *document);
signals:
void editRequest (const CSMWorld::UniversalId& id, const std::string& hint);