QT: Don't use qAsConst and C+11 on QT < 5.7

Introduced QT 5.7 calls in my recent change (also C+11, which is
required for QT >= 5.7). Providing an alternate code path for QT < 5.7

Change-Id: I866af35138d4691a659aee756ce9c3ce4ffb933f
Reviewed-on: https://code.wireshark.org/review/37779
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
This commit is contained in:
John Thacker 2020-07-07 17:32:00 -04:00 committed by Alexis La Goutte
parent 416ccd18c4
commit e84d431e39
2 changed files with 8 additions and 0 deletions

View File

@ -161,7 +161,11 @@ void FollowStreamDialog::addCodecs(const QMap<QString, QTextCodec *> &codecMap)
// Make the combobox respect max visible items?
//ui->cbCharset->setStyleSheet("QComboBox { combobox-popup: 0;}");
ui->cbCharset->insertSeparator(ui->cbCharset->count());
#if QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
for (const auto &codec : qAsConst(codecMap)) {
#else
foreach (const QTextCodec *codec, codecMap) {
#endif
// This is already in the menu and handled separately
if (codec->name() != "US-ASCII" && codec->name() != "UTF-8")
ui->cbCharset->addItem(tr(codec->name()), SHOW_CODEC);

View File

@ -107,7 +107,11 @@ void ShowPacketBytesDialog::addCodecs(const QMap<QString, QTextCodec *> &codecMa
// Make the combobox respect max visible items?
//ui->cbShowAs->setStyleSheet("QComboBox { combobox-popup: 0;}");
ui->cbShowAs->insertSeparator(ui->cbShowAs->count());
#if QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
for (const auto &codec : qAsConst(codecMap)) {
#else
foreach (const QTextCodec *codec, codecMap) {
#endif
// This is already placed in the menu and handled separately
if (codec->name() != "US-ASCII" && codec->name() != "UTF-8")
ui->cbShowAs->addItem(tr(codec->name()), ShowAsCodec);