diff --git a/tests/auto/other/lancelot/paintcommands.cpp b/tests/auto/other/lancelot/paintcommands.cpp index 8419f93e3b..4e0cb3b835 100644 --- a/tests/auto/other/lancelot/paintcommands.cpp +++ b/tests/auto/other/lancelot/paintcommands.cpp @@ -192,7 +192,7 @@ QList > PaintCommands::s_enumsTable = QList PaintCommands::s_commandHash; #define DECL_PAINTCOMMAND(identifier, method, regexp, syntax, sample) \ - s_commandInfoTable << PaintCommandInfos(QLatin1String(identifier), &PaintCommands::method, QRegExp(regexp), \ + s_commandInfoTable << PaintCommandInfos(QLatin1String(identifier), &PaintCommands::method, QRegularExpression(regexp, QRegularExpression::OptimizeOnFirstUsageOption), \ QLatin1String(syntax), QLatin1String(sample) ); #define DECL_PAINTCOMMANDSECTION(title) \ @@ -418,7 +418,7 @@ void PaintCommands::staticInit() "\n- a width or height of -1 means maximum space", "drawImage :/images/face.png 0 0 -1 -1 0 0 -1 -1"); DECL_PAINTCOMMAND("drawPolygon", command_drawPolygon, - "^drawPolygon\\s+\\[([\\w\\s-.]*)\\]\\s*(\\w*)$", + "^drawPolygon\\s+\\[([\\w\\s\\-.]*)\\]\\s*(\\w*)$", "drawPolygon <[ ... ]> ", "drawPolygon [ 1 4 6 8 5 3 ] Winding"); DECL_PAINTCOMMAND("drawConvexPolygon", command_drawConvexPolygon, @@ -683,19 +683,21 @@ void PaintCommands::insertAt(int commandIndex, const QStringList &newCommands) void PaintCommands::runCommand(const QString &scriptLine) { if (scriptLine.isEmpty()) { - command_noop(QRegExp()); + command_noop(QRegularExpressionMatch()); return; } if (scriptLine.startsWith('#')) { - command_comment(QRegExp()); + command_comment(QRegularExpressionMatch()); return; } - QString firstWord = scriptLine.section(QRegExp("\\s"), 0, 0); + QString firstWord = scriptLine.section(QRegularExpression("\\s"), 0, 0); QList indices = s_commandHash.values(firstWord); foreach(int idx, indices) { PaintCommandInfos command = s_commandInfoTable.at(idx); - if (command.regExp.indexIn(scriptLine) >= 0) { - (this->*(command.paintMethod))(command.regExp); + Q_ASSERT(command.regExp.isValid()); + QRegularExpressionMatch match = command.regExp.match(scriptLine); + if (match.hasMatch()) { + (this->*(command.paintMethod))(match); return; } } @@ -751,7 +753,7 @@ float PaintCommands::convertToFloat(const QString &str) double PaintCommands::convertToDouble(const QString &str) { - static QRegExp re("cp([0-9])([xy])"); + static QRegularExpression re("cp([0-9])([xy])"); if (str.toLower() == "width") { if (m_painter->device()->devType() == Qt::Widget) return m_painter->window().width(); @@ -764,9 +766,10 @@ double PaintCommands::convertToDouble(const QString &str) else return 800; } - if (re.indexIn(str) >= 0) { - int index = re.cap(1).toInt(); - bool is_it_x = re.cap(2) == "x"; + QRegularExpressionMatch match = re.match(str); + if (match.hasMatch()) { + int index = match.captured(1).toInt(); + bool is_it_x = match.captured(2) == "x"; if (index < 0 || index >= m_controlPoints.size()) { qWarning("ERROR: control point index=%d is out of bounds", index); return 0; @@ -778,21 +781,23 @@ double PaintCommands::convertToDouble(const QString &str) QColor PaintCommands::convertToColor(const QString &str) { - static QRegExp alphaColor("#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})"); - static QRegExp opaqueColor("#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})"); + static QRegularExpression alphaColorRe("#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})"); + static QRegularExpression opaqueColorRe("#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})"); - Q_ASSERT(alphaColor.isValid()); - Q_ASSERT(opaqueColor.isValid()); + Q_ASSERT(alphaColorRe.isValid()); + Q_ASSERT(opaqueColorRe.isValid()); - if (alphaColor.indexIn(str) >= 0) { - return QColor(alphaColor.cap(2).toInt(0, 16), - alphaColor.cap(3).toInt(0, 16), - alphaColor.cap(4).toInt(0, 16), - alphaColor.cap(1).toInt(0, 16)); - } else if (opaqueColor.indexIn(str) >= 0) { - return QColor(opaqueColor.cap(1).toInt(0, 16), - opaqueColor.cap(2).toInt(0, 16), - opaqueColor.cap(3).toInt(0, 16)); + QRegularExpressionMatch alphaColor = alphaColorRe.match(str); + QRegularExpressionMatch opaqueColor = opaqueColorRe.match(str); + if (alphaColor.hasMatch()) { + return QColor(alphaColor.captured(2).toInt(0, 16), + alphaColor.captured(3).toInt(0, 16), + alphaColor.captured(4).toInt(0, 16), + alphaColor.captured(1).toInt(0, 16)); + } else if (opaqueColor.hasMatch()) { + return QColor(opaqueColor.captured(1).toInt(0, 16), + opaqueColor.captured(2).toInt(0, 16), + opaqueColor.captured(3).toInt(0, 16)); } return QColor(str); } @@ -800,16 +805,16 @@ QColor PaintCommands::convertToColor(const QString &str) /********************************************************************************* ** command implementations **********************************************************************************/ -void PaintCommands::command_comment(QRegExp) +void PaintCommands::command_comment(QRegularExpressionMatch) { if (m_verboseMode) printf(" -(lance) comment: %s\n", qPrintable(m_currentCommand)); } /***************************************************************************************************/ -void PaintCommands::command_import(QRegExp re) +void PaintCommands::command_import(QRegularExpressionMatch re) { - QString importFile(re.cap(1)); + QString importFile(re.captured(1)); QFileInfo fi(m_filepath); QDir dir = fi.absoluteDir(); QFile *file = new QFile(dir.absolutePath() + QDir::separator() + importFile); @@ -862,9 +867,9 @@ void PaintCommands::command_import(QRegExp re) } /***************************************************************************************************/ -void PaintCommands::command_begin_block(QRegExp re) +void PaintCommands::command_begin_block(QRegularExpressionMatch re) { - const QString &blockName = re.cap(1); + const QString &blockName = re.captured(1); if (m_verboseMode) printf(" -(lance) begin_block (%s)\n", qPrintable(blockName)); @@ -891,7 +896,7 @@ void PaintCommands::command_begin_block(QRegExp re) } /***************************************************************************************************/ -void PaintCommands::command_end_block(QRegExp) +void PaintCommands::command_end_block(QRegularExpressionMatch) { printf(" - end_block should be consumed by begin_block command.\n"); printf(" You will never see this if your block markers are in sync\n"); @@ -899,9 +904,9 @@ void PaintCommands::command_end_block(QRegExp) } /***************************************************************************************************/ -void PaintCommands::command_repeat_block(QRegExp re) +void PaintCommands::command_repeat_block(QRegularExpressionMatch re) { - QString blockName = re.cap(1); + QString blockName = re.captured(1); if (m_verboseMode) printf(" -(lance) repeating block (%s)\n", qPrintable(blockName)); @@ -916,7 +921,7 @@ void PaintCommands::command_repeat_block(QRegExp re) } /***************************************************************************************************/ -void PaintCommands::command_drawLine(QRegExp re) +void PaintCommands::command_drawLine(QRegularExpressionMatch re) { QStringList caps = re.capturedTexts(); double x1 = convertToDouble(caps.at(1)); @@ -931,28 +936,28 @@ void PaintCommands::command_drawLine(QRegExp re) } /***************************************************************************************************/ -void PaintCommands::command_drawPath(QRegExp re) +void PaintCommands::command_drawPath(QRegularExpressionMatch re) { if (m_verboseMode) - printf(" -(lance) drawPath(name=%s)\n", qPrintable(re.cap(1))); + printf(" -(lance) drawPath(name=%s)\n", qPrintable(re.captured(1))); - QPainterPath &path = m_pathMap[re.cap(1)]; + QPainterPath &path = m_pathMap[re.captured(1)]; m_painter->drawPath(path); } /***************************************************************************************************/ -void PaintCommands::command_drawPixmap(QRegExp re) +void PaintCommands::command_drawPixmap(QRegularExpressionMatch re) { QPixmap pm; - pm = m_pixmapMap[re.cap(1)]; // try cache first + pm = m_pixmapMap[re.captured(1)]; // try cache first if (pm.isNull()) - pm = image_load(re.cap(1)); + pm = image_load(re.captured(1)); if (pm.isNull()) { QFileInfo fi(m_filepath); QDir dir = fi.absoluteDir(); dir.cdUp(); dir.cd("images"); - QString fileName = dir.absolutePath() + QLatin1Char('/') + re.cap(1); + QString fileName = dir.absolutePath() + QLatin1Char('/') + re.captured(1); pm = QPixmap(fileName); if (pm.isNull() && !fileName.endsWith(".png")) { fileName.append(".png"); @@ -961,19 +966,19 @@ void PaintCommands::command_drawPixmap(QRegExp re) } if (pm.isNull()) { fprintf(stderr, "ERROR(drawPixmap): failed to load pixmap: '%s'\n", - qPrintable(re.cap(1))); + qPrintable(re.captured(1))); return; } - qreal tx = convertToFloat(re.cap(2)); - qreal ty = convertToFloat(re.cap(3)); - qreal tw = convertToFloat(re.cap(4)); - qreal th = convertToFloat(re.cap(5)); + qreal tx = convertToFloat(re.captured(2)); + qreal ty = convertToFloat(re.captured(3)); + qreal tw = convertToFloat(re.captured(4)); + qreal th = convertToFloat(re.captured(5)); - qreal sx = convertToFloat(re.cap(6)); - qreal sy = convertToFloat(re.cap(7)); - qreal sw = convertToFloat(re.cap(8)); - qreal sh = convertToFloat(re.cap(9)); + qreal sx = convertToFloat(re.captured(6)); + qreal sy = convertToFloat(re.captured(7)); + qreal sw = convertToFloat(re.captured(8)); + qreal sh = convertToFloat(re.captured(9)); if (tw == 0) tw = -1; if (th == 0) th = -1; @@ -982,26 +987,26 @@ void PaintCommands::command_drawPixmap(QRegExp re) if (m_verboseMode) printf(" -(lance) drawPixmap('%s' dim=(%d, %d), depth=%d, (%f, %f, %f, %f), (%f, %f, %f, %f)\n", - qPrintable(re.cap(1)), pm.width(), pm.height(), pm.depth(), + qPrintable(re.captured(1)), pm.width(), pm.height(), pm.depth(), tx, ty, tw, th, sx, sy, sw, sh); m_painter->drawPixmap(QRectF(tx, ty, tw, th), pm, QRectF(sx, sy, sw, sh)); } /***************************************************************************************************/ -void PaintCommands::command_drawImage(QRegExp re) +void PaintCommands::command_drawImage(QRegularExpressionMatch re) { QImage im; - im = m_imageMap[re.cap(1)]; // try cache first + im = m_imageMap[re.captured(1)]; // try cache first if (im.isNull()) - im = image_load(re.cap(1)); + im = image_load(re.captured(1)); if (im.isNull()) { QFileInfo fi(m_filepath); QDir dir = fi.absoluteDir(); dir.cdUp(); dir.cd("images"); - QString fileName = dir.absolutePath() + QLatin1Char('/') + re.cap(1); + QString fileName = dir.absolutePath() + QLatin1Char('/') + re.captured(1); im = QImage(fileName); if (im.isNull() && !fileName.endsWith(".png")) { fileName.append(".png"); @@ -1009,19 +1014,19 @@ void PaintCommands::command_drawImage(QRegExp re) } } if (im.isNull()) { - fprintf(stderr, "ERROR(drawImage): failed to load image: '%s'\n", qPrintable(re.cap(1))); + fprintf(stderr, "ERROR(drawImage): failed to load image: '%s'\n", qPrintable(re.captured(1))); return; } - qreal tx = convertToFloat(re.cap(2)); - qreal ty = convertToFloat(re.cap(3)); - qreal tw = convertToFloat(re.cap(4)); - qreal th = convertToFloat(re.cap(5)); + qreal tx = convertToFloat(re.captured(2)); + qreal ty = convertToFloat(re.captured(3)); + qreal tw = convertToFloat(re.captured(4)); + qreal th = convertToFloat(re.captured(5)); - qreal sx = convertToFloat(re.cap(6)); - qreal sy = convertToFloat(re.cap(7)); - qreal sw = convertToFloat(re.cap(8)); - qreal sh = convertToFloat(re.cap(9)); + qreal sx = convertToFloat(re.captured(6)); + qreal sy = convertToFloat(re.captured(7)); + qreal sw = convertToFloat(re.captured(8)); + qreal sh = convertToFloat(re.captured(9)); if (tw == 0) tw = -1; if (th == 0) th = -1; @@ -1030,24 +1035,24 @@ void PaintCommands::command_drawImage(QRegExp re) if (m_verboseMode) printf(" -(lance) drawImage('%s' dim=(%d, %d), (%f, %f, %f, %f), (%f, %f, %f, %f)\n", - qPrintable(re.cap(1)), im.width(), im.height(), tx, ty, tw, th, sx, sy, sw, sh); + qPrintable(re.captured(1)), im.width(), im.height(), tx, ty, tw, th, sx, sy, sw, sh); m_painter->drawImage(QRectF(tx, ty, tw, th), im, QRectF(sx, sy, sw, sh), Qt::OrderedDither | Qt::OrderedAlphaDither); } /***************************************************************************************************/ -void PaintCommands::command_drawTiledPixmap(QRegExp re) +void PaintCommands::command_drawTiledPixmap(QRegularExpressionMatch re) { QPixmap pm; - pm = m_pixmapMap[re.cap(1)]; // try cache first + pm = m_pixmapMap[re.captured(1)]; // try cache first if (pm.isNull()) - pm = image_load(re.cap(1)); + pm = image_load(re.captured(1)); if (pm.isNull()) { QFileInfo fi(m_filepath); QDir dir = fi.absoluteDir(); dir.cdUp(); dir.cd("images"); - QString fileName = dir.absolutePath() + QLatin1Char('/') + re.cap(1); + QString fileName = dir.absolutePath() + QLatin1Char('/') + re.captured(1); pm = QPixmap(fileName); if (pm.isNull() && !fileName.endsWith(".png")) { fileName.append(".png"); @@ -1056,30 +1061,30 @@ void PaintCommands::command_drawTiledPixmap(QRegExp re) } if (pm.isNull()) { fprintf(stderr, "ERROR(drawTiledPixmap): failed to load pixmap: '%s'\n", - qPrintable(re.cap(1))); + qPrintable(re.captured(1))); return; } - int tx = convertToInt(re.cap(2)); - int ty = convertToInt(re.cap(3)); - int tw = convertToInt(re.cap(4)); - int th = convertToInt(re.cap(5)); + int tx = convertToInt(re.captured(2)); + int ty = convertToInt(re.captured(3)); + int tw = convertToInt(re.captured(4)); + int th = convertToInt(re.captured(5)); - int sx = convertToInt(re.cap(6)); - int sy = convertToInt(re.cap(7)); + int sx = convertToInt(re.captured(6)); + int sy = convertToInt(re.captured(7)); if (tw == 0) tw = -1; if (th == 0) th = -1; if (m_verboseMode) printf(" -(lance) drawTiledPixmap('%s' dim=(%d, %d), (%d, %d, %d, %d), (%d, %d)\n", - qPrintable(re.cap(1)), pm.width(), pm.height(), tx, ty, tw, th, sx, sy); + qPrintable(re.captured(1)), pm.width(), pm.height(), tx, ty, tw, th, sx, sy); m_painter->drawTiledPixmap(tx, ty, tw, th, pm, sx, sy); } /***************************************************************************************************/ -void PaintCommands::command_drawPoint(QRegExp re) +void PaintCommands::command_drawPoint(QRegularExpressionMatch re) { QStringList caps = re.capturedTexts(); float x = convertToFloat(caps.at(1)); @@ -1092,9 +1097,9 @@ void PaintCommands::command_drawPoint(QRegExp re) } /***************************************************************************************************/ -void PaintCommands::command_drawPolygon(QRegExp re) +void PaintCommands::command_drawPolygon(QRegularExpressionMatch re) { - static QRegExp separators("\\s"); + static QRegularExpression separators("\\s"); QStringList caps = re.capturedTexts(); QString cap = caps.at(1); QStringList numbers = cap.split(separators, QString::SkipEmptyParts); @@ -1110,10 +1115,10 @@ void PaintCommands::command_drawPolygon(QRegExp re) } /***************************************************************************************************/ -void PaintCommands::command_drawPolyline(QRegExp re) +void PaintCommands::command_drawPolyline(QRegularExpressionMatch re) { - static QRegExp separators("\\s"); - QStringList numbers = re.cap(1).split(separators, QString::SkipEmptyParts); + static QRegularExpression separators("\\s"); + QStringList numbers = re.captured(1).split(separators, QString::SkipEmptyParts); QPolygonF array; for (int i=0; i + 1drawText(x, y, txt); } -void PaintCommands::command_drawStaticText(QRegExp re) +void PaintCommands::command_drawStaticText(QRegularExpressionMatch re) { if (!m_shouldDrawText) return; @@ -1276,7 +1281,7 @@ void PaintCommands::command_drawStaticText(QRegExp re) } /***************************************************************************************************/ -void PaintCommands::command_noop(QRegExp) +void PaintCommands::command_noop(QRegularExpressionMatch) { if (m_verboseMode) printf(" -(lance) noop: %s\n", qPrintable(m_currentCommand)); @@ -1287,7 +1292,7 @@ void PaintCommands::command_noop(QRegExp) } /***************************************************************************************************/ -void PaintCommands::command_path_addText(QRegExp re) +void PaintCommands::command_path_addText(QRegularExpressionMatch re) { QStringList caps = re.capturedTexts(); QString name = caps.at(1); @@ -1302,7 +1307,7 @@ void PaintCommands::command_path_addText(QRegExp re) } /***************************************************************************************************/ -void PaintCommands::command_path_addEllipse(QRegExp re) +void PaintCommands::command_path_addEllipse(QRegularExpressionMatch re) { QStringList caps = re.capturedTexts(); QString name = caps.at(1); @@ -1318,7 +1323,7 @@ void PaintCommands::command_path_addEllipse(QRegExp re) } /***************************************************************************************************/ -void PaintCommands::command_path_addRect(QRegExp re) +void PaintCommands::command_path_addRect(QRegularExpressionMatch re) { QStringList caps = re.capturedTexts(); QString name = caps.at(1); @@ -1334,9 +1339,9 @@ void PaintCommands::command_path_addRect(QRegExp re) } /***************************************************************************************************/ -void PaintCommands::command_path_addPolygon(QRegExp re) +void PaintCommands::command_path_addPolygon(QRegularExpressionMatch re) { - static QRegExp separators("\\s"); + static QRegularExpression separators("\\s"); QStringList caps = re.capturedTexts(); QString name = caps.at(1); QString cap = caps.at(2); @@ -1353,7 +1358,7 @@ void PaintCommands::command_path_addPolygon(QRegExp re) } /***************************************************************************************************/ -void PaintCommands::command_path_arcTo(QRegExp re) +void PaintCommands::command_path_arcTo(QRegularExpressionMatch re) { QStringList caps = re.capturedTexts(); QString name = caps.at(1); @@ -1371,7 +1376,7 @@ void PaintCommands::command_path_arcTo(QRegExp re) } /***************************************************************************************************/ -void PaintCommands::command_path_createOutline(QRegExp re) +void PaintCommands::command_path_createOutline(QRegularExpressionMatch re) { QStringList caps = re.capturedTexts(); QString name = caps.at(1); @@ -1395,7 +1400,7 @@ void PaintCommands::command_path_createOutline(QRegExp re) } /***************************************************************************************************/ -void PaintCommands::command_path_cubicTo(QRegExp re) +void PaintCommands::command_path_cubicTo(QRegularExpressionMatch re) { QStringList caps = re.capturedTexts(); QString name = caps.at(1); @@ -1413,7 +1418,7 @@ void PaintCommands::command_path_cubicTo(QRegExp re) } /***************************************************************************************************/ -void PaintCommands::command_path_moveTo(QRegExp re) +void PaintCommands::command_path_moveTo(QRegularExpressionMatch re) { QStringList caps = re.capturedTexts(); QString name = caps.at(1); @@ -1427,7 +1432,7 @@ void PaintCommands::command_path_moveTo(QRegExp re) } /***************************************************************************************************/ -void PaintCommands::command_path_lineTo(QRegExp re) +void PaintCommands::command_path_lineTo(QRegularExpressionMatch re) { QStringList caps = re.capturedTexts(); QString name = caps.at(1); @@ -1441,7 +1446,7 @@ void PaintCommands::command_path_lineTo(QRegExp re) } /***************************************************************************************************/ -void PaintCommands::command_path_setFillRule(QRegExp re) +void PaintCommands::command_path_setFillRule(QRegularExpressionMatch re) { QStringList caps = re.capturedTexts(); QString name = caps.at(1); @@ -1454,7 +1459,7 @@ void PaintCommands::command_path_setFillRule(QRegExp re) } /***************************************************************************************************/ -void PaintCommands::command_path_closeSubpath(QRegExp re) +void PaintCommands::command_path_closeSubpath(QRegularExpressionMatch re) { QStringList caps = re.capturedTexts(); QString name = caps.at(1); @@ -1466,7 +1471,7 @@ void PaintCommands::command_path_closeSubpath(QRegExp re) } /***************************************************************************************************/ -void PaintCommands::command_path_getClipPath(QRegExp re) +void PaintCommands::command_path_getClipPath(QRegularExpressionMatch re) { QStringList caps = re.capturedTexts(); QString name = caps.at(1); @@ -1496,7 +1501,7 @@ static void qt_debug_path(const QPainterPath &path, const QString &name) } /***************************************************************************************************/ -void PaintCommands::command_path_debugPrint(QRegExp re) +void PaintCommands::command_path_debugPrint(QRegularExpressionMatch re) { QStringList caps = re.capturedTexts(); QString name = caps.at(1); @@ -1504,7 +1509,7 @@ void PaintCommands::command_path_debugPrint(QRegExp re) } /***************************************************************************************************/ -void PaintCommands::command_region_addRect(QRegExp re) +void PaintCommands::command_region_addRect(QRegularExpressionMatch re) { QStringList caps = re.capturedTexts(); QString name = caps.at(1); @@ -1520,7 +1525,7 @@ void PaintCommands::command_region_addRect(QRegExp re) } /***************************************************************************************************/ -void PaintCommands::command_region_addEllipse(QRegExp re) +void PaintCommands::command_region_addEllipse(QRegularExpressionMatch re) { QStringList caps = re.capturedTexts(); QString name = caps.at(1); @@ -1536,7 +1541,7 @@ void PaintCommands::command_region_addEllipse(QRegExp re) } /***************************************************************************************************/ -void PaintCommands::command_region_getClipRegion(QRegExp re) +void PaintCommands::command_region_getClipRegion(QRegularExpressionMatch re) { QStringList caps = re.capturedTexts(); QString name = caps.at(1); @@ -1553,7 +1558,7 @@ void PaintCommands::command_region_getClipRegion(QRegExp re) } /***************************************************************************************************/ -void PaintCommands::command_resetMatrix(QRegExp) +void PaintCommands::command_resetMatrix(QRegularExpressionMatch) { if (m_verboseMode) printf(" -(lance) resetMatrix()\n"); @@ -1562,7 +1567,7 @@ void PaintCommands::command_resetMatrix(QRegExp) } /***************************************************************************************************/ -void PaintCommands::command_restore(QRegExp) +void PaintCommands::command_restore(QRegularExpressionMatch) { if (m_verboseMode) printf(" -(lance) restore()\n"); @@ -1571,7 +1576,7 @@ void PaintCommands::command_restore(QRegExp) } /***************************************************************************************************/ -void PaintCommands::command_rotate(QRegExp re) +void PaintCommands::command_rotate(QRegularExpressionMatch re) { QStringList caps = re.capturedTexts(); double angle = convertToDouble(caps.at(1)); @@ -1583,7 +1588,7 @@ void PaintCommands::command_rotate(QRegExp re) } /***************************************************************************************************/ -void PaintCommands::command_rotate_x(QRegExp re) +void PaintCommands::command_rotate_x(QRegularExpressionMatch re) { QStringList caps = re.capturedTexts(); double angle = convertToDouble(caps.at(1)); @@ -1597,7 +1602,7 @@ void PaintCommands::command_rotate_x(QRegExp re) } /***************************************************************************************************/ -void PaintCommands::command_rotate_y(QRegExp re) +void PaintCommands::command_rotate_y(QRegularExpressionMatch re) { QStringList caps = re.capturedTexts(); double angle = convertToDouble(caps.at(1)); @@ -1611,7 +1616,7 @@ void PaintCommands::command_rotate_y(QRegExp re) } /***************************************************************************************************/ -void PaintCommands::command_save(QRegExp) +void PaintCommands::command_save(QRegularExpressionMatch) { if (m_verboseMode) printf(" -(lance) save()\n"); @@ -1620,7 +1625,7 @@ void PaintCommands::command_save(QRegExp) } /***************************************************************************************************/ -void PaintCommands::command_mapQuadToQuad(QRegExp re) +void PaintCommands::command_mapQuadToQuad(QRegularExpressionMatch re) { QStringList caps = re.capturedTexts(); double x1 = convertToDouble(caps.at(1)); @@ -1666,7 +1671,7 @@ void PaintCommands::command_mapQuadToQuad(QRegExp re) } /***************************************************************************************************/ -void PaintCommands::command_setMatrix(QRegExp re) +void PaintCommands::command_setMatrix(QRegularExpressionMatch re) { QStringList caps = re.capturedTexts(); double m11 = convertToDouble(caps.at(1)); @@ -1692,7 +1697,7 @@ void PaintCommands::command_setMatrix(QRegExp re) } /***************************************************************************************************/ -void PaintCommands::command_scale(QRegExp re) +void PaintCommands::command_scale(QRegularExpressionMatch re) { QStringList caps = re.capturedTexts(); double sx = convertToDouble(caps.at(1)); @@ -1706,7 +1711,7 @@ void PaintCommands::command_scale(QRegExp re) } /***************************************************************************************************/ -void PaintCommands::command_setBackground(QRegExp re) +void PaintCommands::command_setBackground(QRegularExpressionMatch re) { QStringList caps = re.capturedTexts(); QColor color = convertToColor(caps.at(1)); @@ -1723,7 +1728,7 @@ void PaintCommands::command_setBackground(QRegExp re) } /***************************************************************************************************/ -void PaintCommands::command_setOpacity(QRegExp re) +void PaintCommands::command_setOpacity(QRegularExpressionMatch re) { QStringList caps = re.capturedTexts(); double opacity = convertToDouble(caps.at(1)); @@ -1735,9 +1740,9 @@ void PaintCommands::command_setOpacity(QRegExp re) } /***************************************************************************************************/ -void PaintCommands::command_setBgMode(QRegExp re) +void PaintCommands::command_setBgMode(QRegularExpressionMatch re) { - QString cap = re.cap(2); + QString cap = re.captured(2); Qt::BGMode mode = Qt::TransparentMode; if (cap.toLower() == QLatin1String("opaquemode") || cap.toLower() == QLatin1String("opaque")) mode = Qt::OpaqueMode; @@ -1749,7 +1754,7 @@ void PaintCommands::command_setBgMode(QRegExp re) } /***************************************************************************************************/ -void PaintCommands::command_setBrush(QRegExp re) +void PaintCommands::command_setBrush(QRegularExpressionMatch re) { QStringList caps = re.capturedTexts(); @@ -1780,10 +1785,10 @@ void PaintCommands::command_setBrush(QRegExp re) } /***************************************************************************************************/ -void PaintCommands::command_setBrushOrigin(QRegExp re) +void PaintCommands::command_setBrushOrigin(QRegularExpressionMatch re) { - int x = convertToInt(re.cap(1)); - int y = convertToInt(re.cap(2)); + int x = convertToInt(re.captured(1)); + int y = convertToInt(re.captured(2)); if (m_verboseMode) printf(" -(lance) setBrushOrigin(%d, %d)\n", x, y); @@ -1792,7 +1797,7 @@ void PaintCommands::command_setBrushOrigin(QRegExp re) } /***************************************************************************************************/ -void PaintCommands::command_brushTranslate(QRegExp re) +void PaintCommands::command_brushTranslate(QRegularExpressionMatch re) { QStringList caps = re.capturedTexts(); double dx = convertToDouble(caps.at(1)); @@ -1809,7 +1814,7 @@ void PaintCommands::command_brushTranslate(QRegExp re) } /***************************************************************************************************/ -void PaintCommands::command_brushScale(QRegExp re) +void PaintCommands::command_brushScale(QRegularExpressionMatch re) { QStringList caps = re.capturedTexts(); double sx = convertToDouble(caps.at(1)); @@ -1826,7 +1831,7 @@ void PaintCommands::command_brushScale(QRegExp re) } /***************************************************************************************************/ -void PaintCommands::command_brushRotate(QRegExp re) +void PaintCommands::command_brushRotate(QRegularExpressionMatch re) { QStringList caps = re.capturedTexts(); double rot = convertToDouble(caps.at(1)); @@ -1842,7 +1847,7 @@ void PaintCommands::command_brushRotate(QRegExp re) } /***************************************************************************************************/ -void PaintCommands::command_brushShear(QRegExp re) +void PaintCommands::command_brushShear(QRegularExpressionMatch re) { QStringList caps = re.capturedTexts(); double sx = convertToDouble(caps.at(1)); @@ -1859,9 +1864,9 @@ void PaintCommands::command_brushShear(QRegExp re) } /***************************************************************************************************/ -void PaintCommands::command_setClipping(QRegExp re) +void PaintCommands::command_setClipping(QRegularExpressionMatch re) { - bool clipping = re.cap(1).toLower() == "true"; + bool clipping = re.captured(1).toLower() == "true"; if (m_verboseMode) printf(" -(lance) setClipping(%d)\n", clipping); @@ -1870,7 +1875,7 @@ void PaintCommands::command_setClipping(QRegExp re) } /***************************************************************************************************/ -void PaintCommands::command_setClipRect(QRegExp re) +void PaintCommands::command_setClipRect(QRegularExpressionMatch re) { QStringList caps = re.capturedTexts(); int x = convertToInt(caps.at(1)); @@ -1889,48 +1894,48 @@ void PaintCommands::command_setClipRect(QRegExp re) } /***************************************************************************************************/ -void PaintCommands::command_setClipPath(QRegExp re) +void PaintCommands::command_setClipPath(QRegularExpressionMatch re) { - int combine = translateEnum(clipOperationTable, re.cap(2), Qt::IntersectClip + 1); + int combine = translateEnum(clipOperationTable, re.captured(2), Qt::IntersectClip + 1); if (combine == -1) combine = Qt::ReplaceClip; if (m_verboseMode) - printf(" -(lance) setClipPath(name=%s), %s\n", qPrintable(re.cap(1)), clipOperationTable[combine]); + printf(" -(lance) setClipPath(name=%s), %s\n", qPrintable(re.captured(1)), clipOperationTable[combine]); - if (!m_pathMap.contains(re.cap(1))) + if (!m_pathMap.contains(re.captured(1))) fprintf(stderr, " - setClipPath, no such path"); - m_painter->setClipPath(m_pathMap[re.cap(1)], Qt::ClipOperation(combine)); + m_painter->setClipPath(m_pathMap[re.captured(1)], Qt::ClipOperation(combine)); } /***************************************************************************************************/ -void PaintCommands::command_setClipRegion(QRegExp re) +void PaintCommands::command_setClipRegion(QRegularExpressionMatch re) { - int combine = translateEnum(clipOperationTable, re.cap(2), Qt::IntersectClip + 1); + int combine = translateEnum(clipOperationTable, re.captured(2), Qt::IntersectClip + 1); if (combine == -1) combine = Qt::ReplaceClip; - QRegion r = m_regionMap[re.cap(1)]; + QRegion r = m_regionMap[re.captured(1)]; if (m_verboseMode) printf(" -(lance) setClipRegion(name=%s), bounds=[%d, %d, %d, %d], %s\n", - qPrintable(re.cap(1)), + qPrintable(re.captured(1)), r.boundingRect().x(), r.boundingRect().y(), r.boundingRect().width(), r.boundingRect().height(), clipOperationTable[combine]); - m_painter->setClipRegion(m_regionMap[re.cap(1)], Qt::ClipOperation(combine)); + m_painter->setClipRegion(m_regionMap[re.captured(1)], Qt::ClipOperation(combine)); } /***************************************************************************************************/ -void PaintCommands::command_setFont(QRegExp re) +void PaintCommands::command_setFont(QRegularExpressionMatch re) { QStringList caps = re.capturedTexts(); QString family = caps.at(1); int size = convertToInt(caps.at(2)); - int weight = translateEnum(fontWeightTable, re.cap(3).toLower(), 5); + int weight = translateEnum(fontWeightTable, re.captured(3).toLower(), 5); if (weight != -1) { switch (weight) { case 0: weight = QFont::Light; break; @@ -1940,7 +1945,7 @@ void PaintCommands::command_setFont(QRegExp re) case 4: weight = QFont::Black; break; } } else { - weight = convertToInt(re.cap(3)); + weight = convertToInt(re.captured(3)); } bool italic = caps.at(4).toLower() == "true" || caps.at(4).toLower() == "italic"; @@ -1960,9 +1965,9 @@ void PaintCommands::command_setFont(QRegExp re) } /***************************************************************************************************/ -void PaintCommands::command_setPen(QRegExp re) +void PaintCommands::command_setPen(QRegularExpressionMatch re) { - QString cap = re.cap(1); + QString cap = re.captured(1); int style = translateEnum(penStyleTable, cap, Qt::DashDotDotLine + 1); if (style >= 0) { if (m_verboseMode) @@ -1986,7 +1991,7 @@ void PaintCommands::command_setPen(QRegExp re) } /***************************************************************************************************/ -void PaintCommands::command_setPen2(QRegExp re) +void PaintCommands::command_setPen2(QRegularExpressionMatch re) { QStringList caps = re.capturedTexts(); @@ -2024,10 +2029,10 @@ void PaintCommands::command_setPen2(QRegExp re) } /***************************************************************************************************/ -void PaintCommands::command_setRenderHint(QRegExp re) +void PaintCommands::command_setRenderHint(QRegularExpressionMatch re) { - QString hintString = re.cap(1).toLower(); - bool on = re.cap(2).isEmpty() || re.cap(2).toLower() == "true"; + QString hintString = re.captured(1).toLower(); + bool on = re.captured(2).isEmpty() || re.captured(2).toLower() == "true"; if (hintString.contains("antialiasing")) { if (m_verboseMode) printf(" -(lance) setRenderHint Antialiasing\n"); @@ -2043,7 +2048,7 @@ void PaintCommands::command_setRenderHint(QRegExp re) } /***************************************************************************************************/ -void PaintCommands::command_clearRenderHint(QRegExp /*re*/) +void PaintCommands::command_clearRenderHint(QRegularExpressionMatch /*re*/) { m_painter->setRenderHint(QPainter::Antialiasing, false); m_painter->setRenderHint(QPainter::SmoothPixmapTransform, false); @@ -2052,9 +2057,9 @@ void PaintCommands::command_clearRenderHint(QRegExp /*re*/) } /***************************************************************************************************/ -void PaintCommands::command_setCompositionMode(QRegExp re) +void PaintCommands::command_setCompositionMode(QRegularExpressionMatch re) { - QString modeString = re.cap(1).toLower(); + QString modeString = re.captured(1).toLower(); int mode = translateEnum(compositionModeTable, modeString, 33); if (mode < 0 || mode > QPainter::RasterOp_SourceAndNotDestination) { @@ -2069,7 +2074,7 @@ void PaintCommands::command_setCompositionMode(QRegExp re) } /***************************************************************************************************/ -void PaintCommands::command_translate(QRegExp re) +void PaintCommands::command_translate(QRegularExpressionMatch re) { QStringList caps = re.capturedTexts(); double dx = convertToDouble(caps.at(1)); @@ -2082,7 +2087,7 @@ void PaintCommands::command_translate(QRegExp re) } /***************************************************************************************************/ -void PaintCommands::command_pixmap_load(QRegExp re) +void PaintCommands::command_pixmap_load(QRegularExpressionMatch re) { QStringList caps = re.capturedTexts(); @@ -2104,7 +2109,7 @@ void PaintCommands::command_pixmap_load(QRegExp re) } /***************************************************************************************************/ -void PaintCommands::command_bitmap_load(QRegExp re) +void PaintCommands::command_bitmap_load(QRegularExpressionMatch re) { QStringList caps = re.capturedTexts(); @@ -2125,7 +2130,7 @@ void PaintCommands::command_bitmap_load(QRegExp re) } /***************************************************************************************************/ -void PaintCommands::command_pixmap_setMask(QRegExp re) +void PaintCommands::command_pixmap_setMask(QRegularExpressionMatch re) { QStringList caps = re.capturedTexts(); QBitmap mask = image_load(caps.at(2)); @@ -2138,7 +2143,7 @@ void PaintCommands::command_pixmap_setMask(QRegExp re) } /***************************************************************************************************/ -void PaintCommands::command_image_load(QRegExp re) +void PaintCommands::command_image_load(QRegularExpressionMatch re) { QStringList caps = re.capturedTexts(); @@ -2159,7 +2164,7 @@ void PaintCommands::command_image_load(QRegExp re) } /***************************************************************************************************/ -void PaintCommands::command_image_setColorCount(QRegExp re) +void PaintCommands::command_image_setColorCount(QRegularExpressionMatch re) { QStringList caps = re.capturedTexts(); @@ -2174,7 +2179,7 @@ void PaintCommands::command_image_setColorCount(QRegExp re) } /***************************************************************************************************/ -void PaintCommands::command_image_setColor(QRegExp re) +void PaintCommands::command_image_setColor(QRegularExpressionMatch re) { QStringList caps = re.capturedTexts(); @@ -2189,13 +2194,13 @@ void PaintCommands::command_image_setColor(QRegExp re) } /***************************************************************************************************/ -void PaintCommands::command_abort(QRegExp) +void PaintCommands::command_abort(QRegularExpressionMatch) { m_abort = true; } /***************************************************************************************************/ -void PaintCommands::command_gradient_clearStops(QRegExp) +void PaintCommands::command_gradient_clearStops(QRegularExpressionMatch) { if (m_verboseMode) printf(" -(lance) gradient_clearStops\n"); @@ -2203,7 +2208,7 @@ void PaintCommands::command_gradient_clearStops(QRegExp) } /***************************************************************************************************/ -void PaintCommands::command_gradient_appendStop(QRegExp re) +void PaintCommands::command_gradient_appendStop(QRegularExpressionMatch re) { QStringList caps = re.capturedTexts(); double pos = convertToDouble(caps.at(1)); @@ -2216,7 +2221,7 @@ void PaintCommands::command_gradient_appendStop(QRegExp re) } /***************************************************************************************************/ -void PaintCommands::command_gradient_setLinear(QRegExp re) +void PaintCommands::command_gradient_setLinear(QRegularExpressionMatch re) { QStringList caps = re.capturedTexts(); double x1 = convertToDouble(caps.at(1)); @@ -2239,7 +2244,7 @@ void PaintCommands::command_gradient_setLinear(QRegExp re) } /***************************************************************************************************/ -void PaintCommands::command_gradient_setLinearPen(QRegExp re) +void PaintCommands::command_gradient_setLinearPen(QRegularExpressionMatch re) { QStringList caps = re.capturedTexts(); double x1 = convertToDouble(caps.at(1)); @@ -2261,7 +2266,7 @@ void PaintCommands::command_gradient_setLinearPen(QRegExp re) } /***************************************************************************************************/ -void PaintCommands::command_gradient_setRadial(QRegExp re) +void PaintCommands::command_gradient_setRadial(QRegularExpressionMatch re) { QStringList caps = re.capturedTexts(); double cx = convertToDouble(caps.at(1)); @@ -2286,7 +2291,7 @@ void PaintCommands::command_gradient_setRadial(QRegExp re) } /***************************************************************************************************/ -void PaintCommands::command_gradient_setRadialExtended(QRegExp re) +void PaintCommands::command_gradient_setRadialExtended(QRegularExpressionMatch re) { QStringList caps = re.capturedTexts(); double cx = convertToDouble(caps.at(1)); @@ -2312,7 +2317,7 @@ void PaintCommands::command_gradient_setRadialExtended(QRegExp re) } /***************************************************************************************************/ -void PaintCommands::command_gradient_setConical(QRegExp re) +void PaintCommands::command_gradient_setConical(QRegularExpressionMatch re) { QStringList caps = re.capturedTexts(); double cx = convertToDouble(caps.at(1)); @@ -2335,9 +2340,9 @@ void PaintCommands::command_gradient_setConical(QRegExp re) } /***************************************************************************************************/ -void PaintCommands::command_gradient_setSpread(QRegExp re) +void PaintCommands::command_gradient_setSpread(QRegularExpressionMatch re) { - int spreadMethod = translateEnum(spreadMethodTable, re.cap(1), 3); + int spreadMethod = translateEnum(spreadMethodTable, re.captured(1), 3); if (m_verboseMode) printf(" -(lance) gradient_setSpread %d=[%s]\n", spreadMethod, spreadMethodTable[spreadMethod]); @@ -2345,9 +2350,9 @@ void PaintCommands::command_gradient_setSpread(QRegExp re) m_gradientSpread = QGradient::Spread(spreadMethod); } -void PaintCommands::command_gradient_setCoordinateMode(QRegExp re) +void PaintCommands::command_gradient_setCoordinateMode(QRegularExpressionMatch re) { - int coord = translateEnum(coordinateMethodTable, re.cap(1), 3); + int coord = translateEnum(coordinateMethodTable, re.captured(1), 3); if (m_verboseMode) printf(" -(lance) gradient_setCoordinateMode %d=[%s]\n", coord, @@ -2357,7 +2362,7 @@ void PaintCommands::command_gradient_setCoordinateMode(QRegExp re) } /***************************************************************************************************/ -void PaintCommands::command_surface_begin(QRegExp re) +void PaintCommands::command_surface_begin(QRegularExpressionMatch re) { QStringList caps = re.capturedTexts(); double x = convertToDouble(caps.at(1)); @@ -2417,7 +2422,7 @@ void PaintCommands::command_surface_begin(QRegExp re) } /***************************************************************************************************/ -void PaintCommands::command_surface_end(QRegExp) +void PaintCommands::command_surface_end(QRegularExpressionMatch) { if (!m_surface_painter) { fprintf(stderr, "ERROR: surface not active"); @@ -2466,7 +2471,7 @@ void PaintCommands::command_surface_end(QRegExp) } /***************************************************************************************************/ -void PaintCommands::command_image_convertToFormat(QRegExp re) +void PaintCommands::command_image_convertToFormat(QRegularExpressionMatch re) { QStringList caps = re.capturedTexts(); @@ -2499,7 +2504,7 @@ void PaintCommands::command_image_convertToFormat(QRegExp re) } /***************************************************************************************************/ -void PaintCommands::command_textlayout_draw(QRegExp re) +void PaintCommands::command_textlayout_draw(QRegularExpressionMatch re) { QStringList caps = re.capturedTexts(); @@ -2532,7 +2537,7 @@ void PaintCommands::command_textlayout_draw(QRegExp re) } /***************************************************************************************************/ -void PaintCommands::command_pen_setDashOffset(QRegExp re) +void PaintCommands::command_pen_setDashOffset(QRegularExpressionMatch re) { QStringList caps = re.capturedTexts(); double offset = convertToDouble(caps.at(1)); @@ -2546,9 +2551,9 @@ void PaintCommands::command_pen_setDashOffset(QRegExp re) } /***************************************************************************************************/ -void PaintCommands::command_pen_setDashPattern(QRegExp re) +void PaintCommands::command_pen_setDashPattern(QRegularExpressionMatch re) { - static QRegExp separators("\\s"); + static QRegularExpression separators("\\s"); QStringList caps = re.capturedTexts(); QString cap = caps.at(1); QStringList numbers = cap.split(separators, QString::SkipEmptyParts); @@ -2566,7 +2571,7 @@ void PaintCommands::command_pen_setDashPattern(QRegExp re) } /***************************************************************************************************/ -void PaintCommands::command_pen_setCosmetic(QRegExp re) +void PaintCommands::command_pen_setCosmetic(QRegularExpressionMatch re) { QString hm = re.capturedTexts().at(1); bool on = hm == "true" || hm == "yes" || hm == "on"; @@ -2582,9 +2587,9 @@ void PaintCommands::command_pen_setCosmetic(QRegExp re) } /***************************************************************************************************/ -void PaintCommands::command_drawConvexPolygon(QRegExp re) +void PaintCommands::command_drawConvexPolygon(QRegularExpressionMatch re) { - static QRegExp separators("\\s"); + static QRegularExpression separators("\\s"); QStringList caps = re.capturedTexts(); QString cap = caps.at(1); QStringList numbers = cap.split(separators, QString::SkipEmptyParts); diff --git a/tests/auto/other/lancelot/paintcommands.h b/tests/auto/other/lancelot/paintcommands.h index fc7496ce11..e3fb96744c 100644 --- a/tests/auto/other/lancelot/paintcommands.h +++ b/tests/auto/other/lancelot/paintcommands.h @@ -32,13 +32,13 @@ #include #include #include +#include #include #include #include #include QT_FORWARD_DECLARE_CLASS(QPainter) -QT_FORWARD_DECLARE_CLASS(QRegExp) #ifndef QT_NO_OPENGL QT_FORWARD_DECLARE_CLASS(QOpenGLFramebufferObject) QT_FORWARD_DECLARE_CLASS(QOpenGLPaintDevice) @@ -128,121 +128,121 @@ private: QColor convertToColor(const QString &str); // commands: comments - void command_comment(QRegExp re); + void command_comment(QRegularExpressionMatch re); // commands: importer - void command_import(QRegExp re); + void command_import(QRegularExpressionMatch re); // commands: blocks - void command_begin_block(QRegExp re); - void command_end_block(QRegExp re); - void command_repeat_block(QRegExp re); + void command_begin_block(QRegularExpressionMatch re); + void command_end_block(QRegularExpressionMatch re); + void command_repeat_block(QRegularExpressionMatch re); // commands: misc - void command_textlayout_draw(QRegExp re); - void command_abort(QRegExp re); + void command_textlayout_draw(QRegularExpressionMatch re); + void command_abort(QRegularExpressionMatch re); // commands: noops - void command_noop(QRegExp re); + void command_noop(QRegularExpressionMatch re); // commands: setters - void command_setBgMode(QRegExp re); - void command_setBackground(QRegExp re); - void command_setOpacity(QRegExp re); - void command_path_setFillRule(QRegExp re); - void command_setBrush(QRegExp re); - void command_setBrushOrigin(QRegExp re); - void command_brushTranslate(QRegExp re); - void command_brushRotate(QRegExp re); - void command_brushScale(QRegExp re); - void command_brushShear(QRegExp re); - void command_setClipPath(QRegExp re); - void command_setClipRect(QRegExp re); - void command_setClipRectangle(QRegExp re); - void command_setClipRegion(QRegExp re); - void command_setClipping(QRegExp re); - void command_setCompositionMode(QRegExp re); - void command_setFont(QRegExp re); - void command_setPen(QRegExp re); - void command_setPen2(QRegExp re); - void command_pen_setDashOffset(QRegExp re); - void command_pen_setDashPattern(QRegExp re); - void command_pen_setCosmetic(QRegExp re); - void command_setRenderHint(QRegExp re); - void command_clearRenderHint(QRegExp re); - void command_gradient_appendStop(QRegExp re); - void command_gradient_clearStops(QRegExp re); - void command_gradient_setConical(QRegExp re); - void command_gradient_setLinear(QRegExp re); - void command_gradient_setRadial(QRegExp re); - void command_gradient_setRadialExtended(QRegExp re); - void command_gradient_setLinearPen(QRegExp re); - void command_gradient_setSpread(QRegExp re); - void command_gradient_setCoordinateMode(QRegExp re); + void command_setBgMode(QRegularExpressionMatch re); + void command_setBackground(QRegularExpressionMatch re); + void command_setOpacity(QRegularExpressionMatch re); + void command_path_setFillRule(QRegularExpressionMatch re); + void command_setBrush(QRegularExpressionMatch re); + void command_setBrushOrigin(QRegularExpressionMatch re); + void command_brushTranslate(QRegularExpressionMatch re); + void command_brushRotate(QRegularExpressionMatch re); + void command_brushScale(QRegularExpressionMatch re); + void command_brushShear(QRegularExpressionMatch re); + void command_setClipPath(QRegularExpressionMatch re); + void command_setClipRect(QRegularExpressionMatch re); + void command_setClipRectangle(QRegularExpressionMatch re); + void command_setClipRegion(QRegularExpressionMatch re); + void command_setClipping(QRegularExpressionMatch re); + void command_setCompositionMode(QRegularExpressionMatch re); + void command_setFont(QRegularExpressionMatch re); + void command_setPen(QRegularExpressionMatch re); + void command_setPen2(QRegularExpressionMatch re); + void command_pen_setDashOffset(QRegularExpressionMatch re); + void command_pen_setDashPattern(QRegularExpressionMatch re); + void command_pen_setCosmetic(QRegularExpressionMatch re); + void command_setRenderHint(QRegularExpressionMatch re); + void command_clearRenderHint(QRegularExpressionMatch re); + void command_gradient_appendStop(QRegularExpressionMatch re); + void command_gradient_clearStops(QRegularExpressionMatch re); + void command_gradient_setConical(QRegularExpressionMatch re); + void command_gradient_setLinear(QRegularExpressionMatch re); + void command_gradient_setRadial(QRegularExpressionMatch re); + void command_gradient_setRadialExtended(QRegularExpressionMatch re); + void command_gradient_setLinearPen(QRegularExpressionMatch re); + void command_gradient_setSpread(QRegularExpressionMatch re); + void command_gradient_setCoordinateMode(QRegularExpressionMatch re); // commands: drawing ops - void command_drawArc(QRegExp re); - void command_drawChord(QRegExp re); - void command_drawConvexPolygon(QRegExp re); - void command_drawEllipse(QRegExp re); - void command_drawImage(QRegExp re); - void command_drawLine(QRegExp re); - void command_drawPath(QRegExp re); - void command_drawPie(QRegExp re); - void command_drawPixmap(QRegExp re); - void command_drawPoint(QRegExp re); - void command_drawPolygon(QRegExp re); - void command_drawPolyline(QRegExp re); - void command_drawRect(QRegExp re); - void command_drawRoundedRect(QRegExp re); - void command_drawRoundRect(QRegExp re); - void command_drawText(QRegExp re); - void command_drawStaticText(QRegExp re); - void command_drawTiledPixmap(QRegExp re); - void command_path_addEllipse(QRegExp re); - void command_path_addPolygon(QRegExp re); - void command_path_addRect(QRegExp re); - void command_path_addText(QRegExp re); - void command_path_arcTo(QRegExp re); - void command_path_closeSubpath(QRegExp re); - void command_path_createOutline(QRegExp re); - void command_path_cubicTo(QRegExp re); - void command_path_debugPrint(QRegExp re); - void command_path_lineTo(QRegExp re); - void command_path_moveTo(QRegExp re); - void command_region_addEllipse(QRegExp re); - void command_region_addRect(QRegExp re); + void command_drawArc(QRegularExpressionMatch re); + void command_drawChord(QRegularExpressionMatch re); + void command_drawConvexPolygon(QRegularExpressionMatch re); + void command_drawEllipse(QRegularExpressionMatch re); + void command_drawImage(QRegularExpressionMatch re); + void command_drawLine(QRegularExpressionMatch re); + void command_drawPath(QRegularExpressionMatch re); + void command_drawPie(QRegularExpressionMatch re); + void command_drawPixmap(QRegularExpressionMatch re); + void command_drawPoint(QRegularExpressionMatch re); + void command_drawPolygon(QRegularExpressionMatch re); + void command_drawPolyline(QRegularExpressionMatch re); + void command_drawRect(QRegularExpressionMatch re); + void command_drawRoundedRect(QRegularExpressionMatch re); + void command_drawRoundRect(QRegularExpressionMatch re); + void command_drawText(QRegularExpressionMatch re); + void command_drawStaticText(QRegularExpressionMatch re); + void command_drawTiledPixmap(QRegularExpressionMatch re); + void command_path_addEllipse(QRegularExpressionMatch re); + void command_path_addPolygon(QRegularExpressionMatch re); + void command_path_addRect(QRegularExpressionMatch re); + void command_path_addText(QRegularExpressionMatch re); + void command_path_arcTo(QRegularExpressionMatch re); + void command_path_closeSubpath(QRegularExpressionMatch re); + void command_path_createOutline(QRegularExpressionMatch re); + void command_path_cubicTo(QRegularExpressionMatch re); + void command_path_debugPrint(QRegularExpressionMatch re); + void command_path_lineTo(QRegularExpressionMatch re); + void command_path_moveTo(QRegularExpressionMatch re); + void command_region_addEllipse(QRegularExpressionMatch re); + void command_region_addRect(QRegularExpressionMatch re); // getters - void command_region_getClipRegion(QRegExp re); - void command_path_getClipPath(QRegExp re); + void command_region_getClipRegion(QRegularExpressionMatch re); + void command_path_getClipPath(QRegularExpressionMatch re); // commands: surface begin/end - void command_surface_begin(QRegExp re); - void command_surface_end(QRegExp re); + void command_surface_begin(QRegularExpressionMatch re); + void command_surface_end(QRegularExpressionMatch re); // commands: save/restore painter state - void command_restore(QRegExp re); - void command_save(QRegExp re); + void command_restore(QRegularExpressionMatch re); + void command_save(QRegularExpressionMatch re); // commands: pixmap/image - void command_pixmap_load(QRegExp re); - void command_pixmap_setMask(QRegExp re); - void command_bitmap_load(QRegExp re); - void command_image_convertToFormat(QRegExp re); - void command_image_load(QRegExp re); - void command_image_setColor(QRegExp re); - void command_image_setColorCount(QRegExp re); + void command_pixmap_load(QRegularExpressionMatch re); + void command_pixmap_setMask(QRegularExpressionMatch re); + void command_bitmap_load(QRegularExpressionMatch re); + void command_image_convertToFormat(QRegularExpressionMatch re); + void command_image_load(QRegularExpressionMatch re); + void command_image_setColor(QRegularExpressionMatch re); + void command_image_setColorCount(QRegularExpressionMatch re); // commands: transformation - void command_resetMatrix(QRegExp re); - void command_translate(QRegExp re); - void command_rotate(QRegExp re); - void command_rotate_x(QRegExp re); - void command_rotate_y(QRegExp re); - void command_scale(QRegExp re); - void command_mapQuadToQuad(QRegExp re); - void command_setMatrix(QRegExp re); + void command_resetMatrix(QRegularExpressionMatch re); + void command_translate(QRegularExpressionMatch re); + void command_rotate(QRegularExpressionMatch re); + void command_rotate_x(QRegularExpressionMatch re); + void command_rotate_y(QRegularExpressionMatch re); + void command_scale(QRegularExpressionMatch re); + void command_mapQuadToQuad(QRegularExpressionMatch re); + void command_setMatrix(QRegularExpressionMatch re); // attributes QPainter *m_painter; @@ -302,7 +302,7 @@ private: public: struct PaintCommandInfos { - PaintCommandInfos(QString id, void (PaintCommands::*p)(QRegExp), QRegExp r, QString sy, QString sa) + PaintCommandInfos(QString id, void (PaintCommands::*p)(QRegularExpressionMatch), QRegularExpression r, QString sy, QString sa) : identifier(id) , regExp(r) , syntax(sy) @@ -313,10 +313,10 @@ public: : identifier(title), paintMethod(0) {} bool isSectionHeader() const { return paintMethod == 0; } QString identifier; - QRegExp regExp; + QRegularExpression regExp; QString syntax; QString sample; - void (PaintCommands::*paintMethod)(QRegExp); + void (PaintCommands::*paintMethod)(QRegularExpressionMatch); }; static PaintCommandInfos *findCommandById(const QString &identifier) {