Public Member Functions | Public Attributes | Friends

QxtStringValidatorPrivate Class Reference

#include <qxtstringvalidator_p.h>

Inheritance diagram for QxtStringValidatorPrivate:
Inheritance graph
[legend]
Collaboration diagram for QxtStringValidatorPrivate:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 QxtStringValidatorPrivate ()
QModelIndex lookupPartialMatch (const QString &value) const
QModelIndex lookupExactMatch (const QString &value) const
QModelIndex lookup (const QString &value, const Qt::MatchFlags &matchFlags) const

Public Attributes

bool isUserModel
QPointer< QAbstractItemModel > model
Qt::CaseSensitivity cs
int lookupColumn
int lookupRole
Qt::MatchFlags userFlags
QModelIndex lookupStartModelIndex

Friends

class QxtStringValidator

Detailed Description

Definition at line 35 of file qxtstringvalidator_p.h.


Constructor & Destructor Documentation

QxtStringValidatorPrivate::QxtStringValidatorPrivate (  )

Definition at line 34 of file qxtstringvalidator.cpp.

                                                     : isUserModel(false)
        , model(0)
        , cs(Qt::CaseSensitive)
        , lookupRole(Qt::EditRole)
        , userFlags(Qt::MatchWrap)
        , lookupStartModelIndex(QModelIndex())
{}

Member Function Documentation

QModelIndex QxtStringValidatorPrivate::lookup ( const QString &  value,
const Qt::MatchFlags &  matchFlags 
) const

Definition at line 64 of file qxtstringvalidator.cpp.

References lookupRole, lookupStartModelIndex, and model.

Referenced by lookupExactMatch(), and lookupPartialMatch().

{
    QModelIndex startIndex =  lookupStartModelIndex.isValid() ? lookupStartModelIndex : model->index(0, 0);

    QModelIndexList list = model->match(startIndex, lookupRole, value, 1, matchFlags);

    if (list.size() > 0)
        return list[0];
    return QModelIndex();
}
QModelIndex QxtStringValidatorPrivate::lookupExactMatch ( const QString &  value ) const

Definition at line 55 of file qxtstringvalidator.cpp.

References cs, lookup(), and userFlags.

{
    Qt::MatchFlags  matchFlags = Qt::MatchFixedString | userFlags;
    if (cs == Qt::CaseSensitive)
        matchFlags |= Qt::MatchCaseSensitive;

    return lookup(value, matchFlags);
}
QModelIndex QxtStringValidatorPrivate::lookupPartialMatch ( const QString &  value ) const

Definition at line 42 of file qxtstringvalidator.cpp.

References cs, lookup(), and userFlags.

{
    //a empty string is always invalid
    if (value.isEmpty())
        return QModelIndex();

    Qt::MatchFlags matchFlags = Qt::MatchStartsWith | userFlags;
    if (cs == Qt::CaseSensitive)
        matchFlags |= Qt::MatchCaseSensitive;

    return lookup(value, matchFlags);
}

Friends And Related Function Documentation

friend class QxtStringValidator [friend]

Definition at line 39 of file qxtstringvalidator_p.h.


Member Data Documentation

Qt::CaseSensitivity QxtStringValidatorPrivate::cs

Definition at line 43 of file qxtstringvalidator_p.h.

Referenced by lookupExactMatch(), and lookupPartialMatch().

Definition at line 39 of file qxtstringvalidator_p.h.

Definition at line 44 of file qxtstringvalidator_p.h.

Definition at line 45 of file qxtstringvalidator_p.h.

Referenced by lookup().

Definition at line 47 of file qxtstringvalidator_p.h.

Referenced by lookup().

QPointer<QAbstractItemModel> QxtStringValidatorPrivate::model

Definition at line 42 of file qxtstringvalidator_p.h.

Referenced by lookup().

Definition at line 46 of file qxtstringvalidator_p.h.

Referenced by lookupExactMatch(), and lookupPartialMatch().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines