2 This file is part of KJots.
4 Copyright (c) 2008 Stephen Kelly <steveire@gmail.com>
6 This library is free software; you can redistribute it and/or modify it
7 under the terms of the GNU Library General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or (at your
9 option) any later version.
11 This library is distributed in the hope that it will be useful, but WITHOUT
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
14 License for more details.
16 You should have received a copy of the GNU Library General Public License
17 along with this library; see the file COPYING.LIB. If not, write to the
18 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23 #include "kjotsbookshelfentryvalidator.h"
25 KJotsBookshelfEntryValidator::KJotsBookshelfEntryValidator( QAbstractItemModel
* model
, QObject
* parent
)
26 : QValidator( parent
)
31 KJotsBookshelfEntryValidator::~KJotsBookshelfEntryValidator()
36 QValidator::State
KJotsBookshelfEntryValidator::validate( QString
& input
, int& pos
) const
44 QModelIndexList list
= m_model
->match(
48 Qt::MatchStartsWith
| Qt::MatchFixedString
| Qt::MatchWrap
);
56 foreach (const QModelIndex
& index
, list
)
58 if ( 0 == QString::compare(m_model
->data(index
).toString(), input
, Qt::CaseInsensitive
) )