diff options
author | Liang Qi <liang.qi@qt.io> | 2017-02-16 21:46:20 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2017-02-16 21:51:11 +0100 |
commit | c577f6edafef7c40a5f78092ec4fcd78bb820b2c (patch) | |
tree | 9ca3819e5cca9b7e61f305a874b682e5a2085e83 /examples/widgets/tools/codecs/mainwindow.cpp | |
parent | 99ce1d3d97c0423c3ee63ccf58deed964db0770e (diff) | |
parent | de225ccdf95efb57866d62bc80872c1a2ab99703 (diff) |
Merge remote-tracking branch 'origin/5.8' into 5.9
Conflicts:
src/corelib/plugin/qlibrary_unix.cpp
src/plugins/platforms/xcb/qxcbconnection.cpp
tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp
Change-Id: I632c400d909f8c204f55743aadc7886af2f15dfb
Diffstat (limited to 'examples/widgets/tools/codecs/mainwindow.cpp')
-rw-r--r-- | examples/widgets/tools/codecs/mainwindow.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/examples/widgets/tools/codecs/mainwindow.cpp b/examples/widgets/tools/codecs/mainwindow.cpp index 5e4810dd4d..28f904d1a7 100644 --- a/examples/widgets/tools/codecs/mainwindow.cpp +++ b/examples/widgets/tools/codecs/mainwindow.cpp @@ -138,7 +138,8 @@ void MainWindow::aboutToShowSaveAsMenu() void MainWindow::findCodecs() { QMap<QString, QTextCodec *> codecMap; - QRegExp iso8859RegExp("ISO[- ]8859-([0-9]+).*"); + QRegularExpression iso8859RegExp("^ISO[- ]8859-([0-9]+).*$"); + QRegularExpressionMatch match; foreach (int mib, QTextCodec::availableMibs()) { QTextCodec *codec = QTextCodec::codecForMib(mib); @@ -150,8 +151,8 @@ void MainWindow::findCodecs() rank = 1; } else if (sortKey.startsWith(QLatin1String("UTF-16"))) { rank = 2; - } else if (iso8859RegExp.exactMatch(sortKey)) { - if (iso8859RegExp.cap(1).size() == 1) + } else if ((match = iso8859RegExp.match(sortKey)).hasMatch()) { + if (match.captured(1).size() == 1) rank = 3; else rank = 4; |