mirror of
https://github.com/OpenMW/openmw.git
synced 2025-03-27 05:10:26 +00:00
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"
|
#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)
|
: QLineEdit (parent), mParser (data)
|
||||||
{
|
{
|
||||||
mPalette = palette();
|
mPalette = palette();
|
||||||
connect (this, SIGNAL (textChanged (const QString&)), this, SLOT (textChanged (const QString&)));
|
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)
|
void CSVFilter::EditWidget::textChanged (const QString& text)
|
||||||
|
@ -24,3 +40,19 @@ void CSVFilter::EditWidget::textChanged (const QString& text)
|
||||||
/// \todo improve error reporting; mark only the faulty part
|
/// \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/parser.hpp"
|
||||||
#include "../../model/filter/node.hpp"
|
#include "../../model/filter/node.hpp"
|
||||||
|
|
||||||
|
class QModelIndex;
|
||||||
|
|
||||||
namespace CSMWorld
|
namespace CSMWorld
|
||||||
{
|
{
|
||||||
class Data;
|
class Data;
|
||||||
|
@ -25,7 +27,7 @@ namespace CSVFilter
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
EditWidget (const CSMWorld::Data& data, QWidget *parent = 0);
|
EditWidget (CSMWorld::Data& data, QWidget *parent = 0);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
|
@ -34,6 +36,12 @@ namespace CSVFilter
|
||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
void textChanged (const QString& text);
|
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"
|
#include "recordfilterbox.hpp"
|
||||||
|
|
||||||
CSVFilter::FilterBox::FilterBox (const CSMWorld::Data& data, QWidget *parent)
|
CSVFilter::FilterBox::FilterBox (CSMWorld::Data& data, QWidget *parent)
|
||||||
: QWidget (parent)
|
: QWidget (parent)
|
||||||
{
|
{
|
||||||
QHBoxLayout *layout = new QHBoxLayout (this);
|
QHBoxLayout *layout = new QHBoxLayout (this);
|
||||||
|
|
|
@ -18,7 +18,7 @@ namespace CSVFilter
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
FilterBox (const CSMWorld::Data& data, QWidget *parent = 0);
|
FilterBox (CSMWorld::Data& data, QWidget *parent = 0);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
#include "editwidget.hpp"
|
#include "editwidget.hpp"
|
||||||
|
|
||||||
CSVFilter::RecordFilterBox::RecordFilterBox (const CSMWorld::Data& data, QWidget *parent)
|
CSVFilter::RecordFilterBox::RecordFilterBox (CSMWorld::Data& data, QWidget *parent)
|
||||||
: QWidget (parent)
|
: QWidget (parent)
|
||||||
{
|
{
|
||||||
QHBoxLayout *layout = new QHBoxLayout (this);
|
QHBoxLayout *layout = new QHBoxLayout (this);
|
||||||
|
|
|
@ -22,7 +22,7 @@ namespace CSVFilter
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
RecordFilterBox (const CSMWorld::Data& data, QWidget *parent = 0);
|
RecordFilterBox (CSMWorld::Data& data, QWidget *parent = 0);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue