GUI: Improve updating details view.
After previous patches the details view was only updated when the item was clicked with mouse. This patch improves the updating and now it works also when changing selected item using keyboard.
This commit is contained in:
parent
f1b511a366
commit
0da55d6477
|
@ -36,6 +36,7 @@
|
|||
#include <QFileDialog>
|
||||
#include <QClipboard>
|
||||
#include <QContextMenuEvent>
|
||||
#include <QModelIndex>
|
||||
#include "erroritem.h"
|
||||
#include "settings.h"
|
||||
#include "applicationlist.h"
|
||||
|
@ -939,3 +940,8 @@ void ResultsTree::Translate()
|
|||
//TODO go through all the errors in the tree and translate severity and message
|
||||
}
|
||||
|
||||
void ResultsTree::currentChanged(const QModelIndex ¤t, const QModelIndex &previous)
|
||||
{
|
||||
QTreeView::currentChanged(current, previous);
|
||||
emit SelectionChanged(current);
|
||||
}
|
||||
|
|
|
@ -32,6 +32,8 @@
|
|||
class Report;
|
||||
class ErrorItem;
|
||||
class ErrorLine;
|
||||
class QModelIndex;
|
||||
class QWidget;
|
||||
|
||||
/// @addtogroup GUI
|
||||
/// @{
|
||||
|
@ -122,6 +124,16 @@ public:
|
|||
*
|
||||
*/
|
||||
void Translate();
|
||||
|
||||
signals:
|
||||
|
||||
/**
|
||||
* @brief Signal for selection change in result tree.
|
||||
*
|
||||
* @param index Model index to specify new selected item.
|
||||
*/
|
||||
void SelectionChanged(const QModelIndex ¤t);
|
||||
|
||||
protected slots:
|
||||
/**
|
||||
* @brief Slot to quickstart an error with default application
|
||||
|
@ -161,6 +173,14 @@ protected slots:
|
|||
*/
|
||||
void HideResult();
|
||||
|
||||
/**
|
||||
* @brief Slot for selection change in the results tree.
|
||||
*
|
||||
* @param index Model index to specify new selected item.
|
||||
* @param index Model index to specify previous selected item.
|
||||
*/
|
||||
virtual void currentChanged(const QModelIndex ¤t, const QModelIndex &previous);
|
||||
|
||||
protected:
|
||||
|
||||
/**
|
||||
|
|
|
@ -39,7 +39,7 @@ ResultsView::ResultsView(QWidget * parent) :
|
|||
mShowNoErrorsMessage(true)
|
||||
{
|
||||
mUI.setupUi(this);
|
||||
connect(mUI.mTree, SIGNAL(clicked(const QModelIndex &)), this, SLOT(ItemClicked(const QModelIndex &)));
|
||||
connect(mUI.mTree, SIGNAL(SelectionChanged(const QModelIndex &)), this, SLOT(UpdateDetails(const QModelIndex &)));
|
||||
}
|
||||
|
||||
void ResultsView::Initialize(QSettings *settings, ApplicationList *list)
|
||||
|
@ -54,13 +54,11 @@ void ResultsView::Initialize(QSettings *settings, ApplicationList *list)
|
|||
mUI.mTree->Initialize(settings, list);
|
||||
}
|
||||
|
||||
|
||||
ResultsView::~ResultsView()
|
||||
{
|
||||
//dtor
|
||||
}
|
||||
|
||||
|
||||
void ResultsView::Clear()
|
||||
{
|
||||
mUI.mTree->Clear();
|
||||
|
@ -266,7 +264,7 @@ void ResultsView::ReadErrorsXml(const QString &filename)
|
|||
mUI.mTree->SetCheckDirectory("");
|
||||
}
|
||||
|
||||
void ResultsView::ItemClicked(const QModelIndex &index)
|
||||
void ResultsView::UpdateDetails(const QModelIndex &index)
|
||||
{
|
||||
QStandardItemModel *model = qobject_cast<QStandardItemModel*>(mUI.mTree->model());
|
||||
QStandardItem *item = model->itemFromIndex(index);
|
||||
|
|
|
@ -182,11 +182,11 @@ public slots:
|
|||
void ShowHiddenResults();
|
||||
|
||||
/**
|
||||
* @brief Update detailed message when item is clicked.
|
||||
* @brief Update detailed message when selected item is changed.
|
||||
*
|
||||
* @param index Position of item clicked.
|
||||
* @param index Position of new selected item.
|
||||
*/
|
||||
void ItemClicked(const QModelIndex &index);
|
||||
void UpdateDetails(const QModelIndex &index);
|
||||
|
||||
protected:
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue