QComboBox: use NRVO from QAIM::match() and prevent a detach attempt
Receiving the QStringList return value through RVO instead of move-assigning it saves 48b in text size on optimized GCC 4.9 Linux AMD 64 builds. Marking the QStringList const saves another 112b because the following first() doesn't need to attempt a detach. Change-Id: If6f25399e80de12114ce41c557bff6ee8c24938b Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>bb10
parent
d681107f1f
commit
08adcc62a7
|
|
@ -1548,9 +1548,8 @@ void QComboBox::setDuplicatesEnabled(bool enable)
|
|||
int QComboBox::findData(const QVariant &data, int role, Qt::MatchFlags flags) const
|
||||
{
|
||||
Q_D(const QComboBox);
|
||||
QModelIndexList result;
|
||||
QModelIndex start = d->model->index(0, d->modelColumn, d->root);
|
||||
result = d->model->match(start, role, data, 1, flags);
|
||||
const QModelIndexList result = d->model->match(start, role, data, 1, flags);
|
||||
if (result.isEmpty())
|
||||
return -1;
|
||||
return result.first().row();
|
||||
|
|
|
|||
Loading…
Reference in New Issue