summaryrefslogtreecommitdiffstats
path: root/tests/auto/printsupport/kernel/qprinterinfo
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2019-07-11 17:17:13 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2019-07-11 17:17:51 +0200
commit4dac45c9ee59ff6586d90d423654da91523ab679 (patch)
treecd4a4adf2cbc9e77bf86d2d11e71ec66afdf3be4 /tests/auto/printsupport/kernel/qprinterinfo
parent078cd61751aeaa310d35a3d596a21a36004a1a0f (diff)
parentf44850b5c3464cdda0ee9b1ee858d95f3ffaa3e2 (diff)
Merge remote-tracking branch 'origin/wip/qt6' into wip/cmake
Diffstat (limited to 'tests/auto/printsupport/kernel/qprinterinfo')
-rw-r--r--tests/auto/printsupport/kernel/qprinterinfo/tst_qprinterinfo.cpp23
1 files changed, 12 insertions, 11 deletions
diff --git a/tests/auto/printsupport/kernel/qprinterinfo/tst_qprinterinfo.cpp b/tests/auto/printsupport/kernel/qprinterinfo/tst_qprinterinfo.cpp
index 99083242be..d1b4ed8bcd 100644
--- a/tests/auto/printsupport/kernel/qprinterinfo/tst_qprinterinfo.cpp
+++ b/tests/auto/printsupport/kernel/qprinterinfo/tst_qprinterinfo.cpp
@@ -94,17 +94,16 @@ QString tst_QPrinterInfo::getDefaultPrinterFromSystem()
command << "lpstat" << "-d";
QString output = getOutputFromCommand(command);
- QRegExp noDefaultReg("[^:]*no .*default");
- int pos = noDefaultReg.indexIn(output);
- if (pos >= 0) {
+ QRegularExpression noDefaultReg("[^:]*no .*default");
+ QRegularExpressionMatch match;
+ match = noDefaultReg.match(output);
+ if (match.hasMatch())
return QString();
- }
- QRegExp defaultReg("default.*: *([a-zA-Z0-9_-]+)");
- defaultReg.indexIn(output);
- printer = defaultReg.cap(1);
+ QRegularExpression defaultReg("default.*: *([a-zA-Z0-9_-]+)");
+ match = defaultReg.match(output);
+ printer = match.captured(1);
#endif // Q_OS_UNIX
-
return printer;
}
@@ -121,10 +120,12 @@ QStringList tst_QPrinterInfo::getPrintersFromSystem()
QString output = getOutputFromCommand(command);
QStringList list = output.split(QChar::fromLatin1('\n'));
- QRegExp reg("^[Pp]rinter ([.a-zA-Z0-9-_@]+)");
+ QRegularExpression reg("^[Pp]rinter ([.a-zA-Z0-9-_@]+)");
+ QRegularExpressionMatch match;
for (int c = 0; c < list.size(); ++c) {
- if (reg.indexIn(list[c]) >= 0) {
- QString printer = reg.cap(1);
+ match = reg.match(list[c]);
+ if (match.hasMatch()) {
+ QString printer = match.captured(1);
ans << printer;
}
}