forked from mirror/openmw-tes3mp
update tables on filter record changes
This commit is contained in:
parent
20bd0707dc
commit
aa935ff03d
6 changed files with 47 additions and 7 deletions
|
@ -1,11 +1,27 @@
|
|||
|
||||
#include "editwidget.hpp"
|
||||
|
||||
CSVFilter::EditWidget::EditWidget (const CSMWorld::Data& data, QWidget *parent)
|
||||
#include <QAbstractItemModel>
|
||||
|
||||
#include "../../model/world/data.hpp"
|
||||
|
||||
CSVFilter::EditWidget::EditWidget (CSMWorld::Data& data, QWidget *parent)
|
||||
: QLineEdit (parent), mParser (data)
|
||||
{
|
||||
mPalette = palette();
|
||||
connect (this, SIGNAL (textChanged (const QString&)), this, SLOT (textChanged (const QString&)));
|
||||
|
||||
QAbstractItemModel *model = data.getTableModel (CSMWorld::UniversalId::Type_Filters);
|
||||
|
||||
connect (model, SIGNAL (dataChanged (const QModelIndex &, const QModelIndex&)),
|
||||
this, SLOT (filterDataChanged (const QModelIndex &, const QModelIndex&)),
|
||||
Qt::QueuedConnection);
|
||||
connect (model, SIGNAL (rowsRemoved (const QModelIndex&, int, int)),
|
||||
this, SLOT (filterRowsRemoved (const QModelIndex&, int, int)),
|
||||
Qt::QueuedConnection);
|
||||
connect (model, SIGNAL (rowsInserted (const QModelIndex&, int, int)),
|
||||
this, SLOT (filterRowsInserted (const QModelIndex&, int, int)),
|
||||
Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
void CSVFilter::EditWidget::textChanged (const QString& text)
|
||||
|
@ -23,4 +39,20 @@ void CSVFilter::EditWidget::textChanged (const QString& text)
|
|||
|
||||
/// \todo improve error reporting; mark only the faulty part
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CSVFilter::EditWidget::filterDataChanged (const QModelIndex& topLeft,
|
||||
const QModelIndex& bottomRight)
|
||||
{
|
||||
textChanged (text());
|
||||
}
|
||||
|
||||
void CSVFilter::EditWidget::filterRowsRemoved (const QModelIndex& parent, int start, int end)
|
||||
{
|
||||
textChanged (text());
|
||||
}
|
||||
|
||||
void CSVFilter::EditWidget::filterRowsInserted (const QModelIndex& parent, int start, int end)
|
||||
{
|
||||
textChanged (text());
|
||||
}
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
#include "../../model/filter/parser.hpp"
|
||||
#include "../../model/filter/node.hpp"
|
||||
|
||||
class QModelIndex;
|
||||
|
||||
namespace CSMWorld
|
||||
{
|
||||
class Data;
|
||||
|
@ -25,7 +27,7 @@ namespace CSVFilter
|
|||
|
||||
public:
|
||||
|
||||
EditWidget (const CSMWorld::Data& data, QWidget *parent = 0);
|
||||
EditWidget (CSMWorld::Data& data, QWidget *parent = 0);
|
||||
|
||||
signals:
|
||||
|
||||
|
@ -34,6 +36,12 @@ namespace CSVFilter
|
|||
private slots:
|
||||
|
||||
void textChanged (const QString& text);
|
||||
|
||||
void filterDataChanged (const QModelIndex& topLeft, const QModelIndex& bottomRight);
|
||||
|
||||
void filterRowsRemoved (const QModelIndex& parent, int start, int end);
|
||||
|
||||
void filterRowsInserted (const QModelIndex& parent, int start, int end);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
#include "recordfilterbox.hpp"
|
||||
|
||||
CSVFilter::FilterBox::FilterBox (const CSMWorld::Data& data, QWidget *parent)
|
||||
CSVFilter::FilterBox::FilterBox (CSMWorld::Data& data, QWidget *parent)
|
||||
: QWidget (parent)
|
||||
{
|
||||
QHBoxLayout *layout = new QHBoxLayout (this);
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace CSVFilter
|
|||
|
||||
public:
|
||||
|
||||
FilterBox (const CSMWorld::Data& data, QWidget *parent = 0);
|
||||
FilterBox (CSMWorld::Data& data, QWidget *parent = 0);
|
||||
|
||||
signals:
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
#include "editwidget.hpp"
|
||||
|
||||
CSVFilter::RecordFilterBox::RecordFilterBox (const CSMWorld::Data& data, QWidget *parent)
|
||||
CSVFilter::RecordFilterBox::RecordFilterBox (CSMWorld::Data& data, QWidget *parent)
|
||||
: QWidget (parent)
|
||||
{
|
||||
QHBoxLayout *layout = new QHBoxLayout (this);
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace CSVFilter
|
|||
|
||||
public:
|
||||
|
||||
RecordFilterBox (const CSMWorld::Data& data, QWidget *parent = 0);
|
||||
RecordFilterBox (CSMWorld::Data& data, QWidget *parent = 0);
|
||||
|
||||
signals:
|
||||
|
||||
|
|
Loading…
Reference in a new issue