Remove some qBinaryFind usages from the Cocoa helpers

This is done per the mailing list discussion at
http://www.mail-archive.com/development@qt-project.org/msg01603.html

Change-Id: I374ee2c88ee18d20fb2b295c936adaca1d696199
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
This commit is contained in:
Giuseppe D'Angelo 2013-09-20 16:22:12 +02:00 committed by The Qt Project
parent 62a85ae39e
commit 458837ba09

View File

@ -325,16 +325,16 @@ QChar qt_mac_qtKey2CocoaKey(Qt::Key key)
std::sort(rev_entries.begin(), rev_entries.end(), qtKey2CocoaKeySortLessThan);
}
const QVector<KeyPair>::iterator i
= qBinaryFind(rev_entries.begin(), rev_entries.end(), key);
if (i == rev_entries.end())
= std::lower_bound(rev_entries.begin(), rev_entries.end(), key);
if ((i == rev_entries.end()) || (key < *i))
return QChar();
return i->cocoaKey;
}
Qt::Key qt_mac_cocoaKey2QtKey(QChar keyCode)
{
const KeyPair *i = qBinaryFind(entries, end, keyCode);
if (i == end)
const KeyPair *i = std::lower_bound(entries, end, keyCode);
if ((i == end) || (keyCode < *i))
return Qt::Key(keyCode.toUpper().unicode());
return i->qtKey;
}