3 #include "AbstractStringFilter.h" 15 AbstractStringFilter::AbstractStringFilter(
16 AbstractFilter::FilterEffectivenessFlag flag,
17 int minimumForSuccess) : AbstractFilter(flag, minimumForSuccess) {
22 AbstractStringFilter::AbstractStringFilter(
23 const AbstractStringFilter &other) : AbstractFilter(other) {
27 m_lineEdit->setText(other.m_lineEdit->text());
32 AbstractStringFilter::~AbstractStringFilter() {
34 delete m_lineEditText;
35 m_lineEditText = NULL;
40 void AbstractStringFilter::nullify() {
42 m_lineEditText = NULL;
46 void AbstractStringFilter::createWidget() {
47 m_lineEditText =
new QString;
49 m_lineEdit =
new QLineEdit;
50 m_lineEdit->setMinimumWidth(250);
51 connect(m_lineEdit, SIGNAL(textChanged(QString)),
52 this, SLOT(updateLineEditText(QString)));
53 connect(m_lineEdit, SIGNAL(textChanged(QString)),
54 this, SIGNAL(filterChanged()));
56 QHBoxLayout *layout =
new QHBoxLayout;
57 QMargins margins = layout->contentsMargins();
60 layout->setContentsMargins(margins);
61 layout->addWidget(m_lineEdit);
64 getMainLayout()->addLayout(layout);
68 bool AbstractStringFilter::evaluate(QString str)
const {
69 bool evaluation =
true;
72 QString text = *m_lineEditText;
74 if (text.size() >= 1) {
75 bool match = str.contains(text, Qt::CaseInsensitive);
78 evaluation = !(inclusive() ^ match);
85 QString AbstractStringFilter::descriptionSuffix()
const {
89 suffix +=
"containing \"";
91 suffix +=
"not containing \"";
93 suffix += *m_lineEditText;
100 void AbstractStringFilter::updateLineEditText(QString newText) {
101 *m_lineEditText = newText;
Namespace for ISIS/Bullet specific routines.