GUI: Add Collapse/Expand all -items to View-menu.

This commit is contained in:
Kimmo Varis 2009-06-02 01:26:44 +03:00
parent acedcebf25
commit 0178fed611
4 changed files with 40 additions and 1 deletions

View File

@ -42,6 +42,8 @@ MainWindow::MainWindow() :
mActionShowErrors(tr("Show &common errors"), this),
mActionShowCheckAll(tr("Check all"), this),
mActionShowUncheckAll(tr("Uncheck all"), this),
mActionShowCollapseAll(tr("Collapse all"), this),
mActionShowExpandAll(tr("Expand all"), this),
mActionAbout(tr("About"), this),
mActionStop(tr("Stop checking"), this),
mActionSave(tr("Save results to a file"), this),
@ -72,6 +74,9 @@ MainWindow::MainWindow() :
menuview->addSeparator();
menuview->addAction(&mActionShowCheckAll);
menuview->addAction(&mActionShowUncheckAll);
menuview->addSeparator();
menuview->addAction(&mActionShowCollapseAll);
menuview->addAction(&mActionShowExpandAll);
QMenu *menuprogram = menuBar()->addMenu(tr("&Program"));
menuprogram->addAction(&mActionSettings);
@ -95,6 +100,8 @@ MainWindow::MainWindow() :
connect(&mActionShowErrors, SIGNAL(toggled(bool)), this, SLOT(ShowErrors(bool)));
connect(&mActionShowCheckAll, SIGNAL(triggered()), this, SLOT(CheckAll()));
connect(&mActionShowUncheckAll, SIGNAL(triggered()), this, SLOT(UncheckAll()));
connect(&mActionShowCollapseAll, SIGNAL(triggered()), &mResults, SLOT(CollapseAllResults()));
connect(&mActionShowExpandAll, SIGNAL(triggered()), &mResults, SLOT(ExpandAllResults()));
connect(&mActionReCheck, SIGNAL(triggered()), this, SLOT(ReCheck()));

View File

@ -274,6 +274,18 @@ protected:
*/
QAction mActionShowUncheckAll;
/**
* @brief Action to collapse all items in the result tree.
*
*/
QAction mActionShowCollapseAll;
/**
* @brief Action to expand all items in the result tree.
*
*/
QAction mActionShowExpandAll;
/**
* @brief Action show about dialog
*
@ -292,7 +304,6 @@ protected:
*/
QAction mActionSave;
/**
* @brief Results for checking
*

View File

@ -67,3 +67,13 @@ void ResultsView::ShowResults(ShowTypes type, bool show)
{
mTree->ShowResults(type, show);
}
void ResultsView::CollapseAllResults()
{
mTree->collapseAll();
}
void ResultsView::ExpandAllResults()
{
mTree->expandAll();
}

View File

@ -78,6 +78,17 @@ public slots:
const QString &message,
const QStringList &files,
const QVariantList &lines);
/**
* @brief Collapse all results in the result list.
*/
void CollapseAllResults();
/**
* @brief Expand all results in the result list.
*/
void ExpandAllResults();
protected:
/**
* @brief Tree to show cppcheck's results