-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
338 additions
and
172 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,65 +1,64 @@ | ||
#include "filteritem.h" | ||
#include "filterview.h" | ||
|
||
FilterItem::FilterItem(const cvar::Field &field, Operator::Type op, const QVariant &value) | ||
:QStandardItem(), mField(field) | ||
ConditionItem::ConditionItem(const cvar::Field &field, Operator::Type op, const QVariant &value) | ||
:QTreeWidgetItem(FilterView::ConditionType), mField(field), mOperator(op), mValue(value) | ||
{ | ||
|
||
setData(field.expression(), FieldRole); | ||
setData(op, OperatorRole); | ||
setData(value, ValueRole); | ||
updateText(); | ||
setEditable(false); | ||
} | ||
updateItem(); | ||
|
||
|
||
} | ||
|
||
void FilterItem::setField(const cvar::Field &f) | ||
void ConditionItem::setField(const cvar::Field &f) | ||
{ | ||
setData(f.expression(),FieldRole); | ||
mField = f; | ||
updateText(); | ||
updateItem(); | ||
} | ||
|
||
void FilterItem::setOperator(Operator::Type op) | ||
void ConditionItem::setOperator(Operator::Type op) | ||
{ | ||
setData(op, OperatorRole); | ||
updateText(); | ||
mOperator = op; | ||
updateItem(); | ||
} | ||
|
||
void FilterItem::setValue(const QVariant &value) | ||
void ConditionItem::setValue(const QVariant &value) | ||
{ | ||
setData(value, ValueRole); | ||
updateText(); | ||
mValue = value; | ||
updateItem(); | ||
} | ||
|
||
int FilterItem::type() const | ||
const cvar::Field& ConditionItem::field() const | ||
{ | ||
return FilterModel::ConditionalType; | ||
return mField; | ||
} | ||
|
||
const cvar::Field& FilterItem::field() const | ||
QString ConditionItem::operatorName() const | ||
{ | ||
return mField; | ||
return Operator::symbol(mOperator); | ||
} | ||
|
||
QString FilterItem::operatorName() const | ||
Operator::Type ConditionItem::currentOperator() const | ||
{ | ||
return Operator::symbol(Operator::Type(data(OperatorRole).toInt())); | ||
return mOperator; | ||
} | ||
|
||
Operator::Type FilterItem::operatorType() const | ||
QVariant ConditionItem::value() const | ||
{ | ||
return Operator::Type(data(OperatorRole).toInt()); | ||
return mValue; | ||
} | ||
|
||
QVariant FilterItem::value() const | ||
QString ConditionItem::expression() const | ||
{ | ||
return data(ValueRole); | ||
return QString("%1 %2 %3").arg(mField.expression(), Operator::symbol(mOperator), mValue.toString()); | ||
} | ||
|
||
void FilterItem::updateText() | ||
void ConditionItem::updateItem() | ||
{ | ||
setText(QString("%1 %2 %3").arg(field().expression()).arg(operatorName()).arg(value().toString())); | ||
setData(QString("%1 %2 %3").arg(field().expression()).arg(operatorName()).arg(value().toString()), ConditionRole); | ||
setText(0, field().name()); | ||
setText(1, operatorName()); | ||
setText(2, value().toString()); | ||
|
||
setToolTip(0, mField.description()); | ||
|
||
|
||
} |
Oops, something went wrong.