Skip to content

Commit

Permalink
stapjes
Browse files Browse the repository at this point in the history
  • Loading branch information
JorisGoosen committed Jan 23, 2025
1 parent fb42ce1 commit 82fae62
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
12 changes: 7 additions & 5 deletions CommonData/filter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,7 @@ void Filter::dbLoad()
if(oldConstructorJson != _constructorJson) _constructorJsonChanged();
if(oldConstructorR != _constructorR) _constructorRChanged();

db().filterSelect(_id, _filtered);
calculateFilteredRowCount();
dbLoadResultAndError();

db().transactionReadEnd();
}
Expand Down Expand Up @@ -124,15 +123,18 @@ void Filter::setRowCount(size_t rows)
_filtered.resize(rows);
}

bool Filter::dbLoadResultAndError()
void Filter::dbLoadResultAndError()
{
assert(_id != -1);

_errorMsg = db().filterLoadErrorMsg(_id);
bool changed = db().filterSelect(_id, _filtered);

if(db().filterSelect(_id, _filtered))
_filteredChanged();

calculateFilteredRowCount();
return changed;


}

void Filter::dbDelete()
Expand Down
5 changes: 3 additions & 2 deletions CommonData/filter.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class Filter : public DataSetBaseNode
void dbUpdate();
void dbUpdateErrorMsg();
void dbLoad();
bool dbLoadResultAndError(); ///< Loads (updated) filtervalues from database and the (possible) error msg, returns true if an error is set

void dbDelete();
void incRevision() override;
bool checkForUpdates();
Expand All @@ -76,8 +76,9 @@ class Filter : public DataSetBaseNode

DatabaseInterface & db();
const DatabaseInterface & db() const;

protected:
void dbLoadResultAndError(); ///< Loads (updated) filtervalues from database and the (possible) error msg, returns true if an error is set
void calculateFilteredRowCount();
void rescanForColumns();

Expand Down
6 changes: 3 additions & 3 deletions Desktop/data/filtermodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,19 @@ QString FilterModel::constructorJson() const { return !filter() ? DEFAULT_FILTER
void FilterModel::applyConstructorJson(QString newConstructorJson)
{
if (newConstructorJson != constructorJson())
_undoStack->pushCommand(new SetJsonFilterCommand(filter(), newConstructorJson));
UndoStack::singleton()->pushCommand(new SetJsonFilterCommand(filter(), newConstructorJson));
}

void FilterModel::applyRFilter(QString newRFilter)
{
if (newRFilter != rFilter())
_undoStack->pushCommand(new SetRFilterCommand(filter(), newRFilter));
UndoStack::singleton()->pushCommand(new SetRFilterCommand(filter(), newRFilter));
}


void FilterModel::processFilterResult()
{
if(filter())
if(!filter())
return;

//Load new filter values from database
Expand Down

0 comments on commit 82fae62

Please sign in to comment.