Fix deprecated QRegExp

Use QRegularExpression instead.

https://doc.qt.io/qt-5/qregularexpression.html#notes-for-qregexp-users

This function was introduced in Qt 5
This commit is contained in:
Simon De Backer 2020-09-18 23:04:17 +02:00
parent 0ee8f4187b
commit 46e96f0a67

View File

@ -51,9 +51,10 @@ BorderTitleBlock::BorderTitleBlock(QObject *parent) :
m_titleblock_template_renderer -> setTitleBlockTemplate(QETApp::defaultTitleBlockTemplate()); m_titleblock_template_renderer -> setTitleBlockTemplate(QETApp::defaultTitleBlockTemplate());
// disable the QPicture-based cache from Qt 4.8 to avoid rendering errors and crashes // disable the QPicture-based cache from Qt 4.8 to avoid rendering errors and crashes
if (!QRegExp("4\\.[0-7]\\.").exactMatch(qVersion())) { #if QT_VERSION < QT_VERSION_CHECK(4, 8, 0) // ### Qt 6: remove
m_titleblock_template_renderer -> setUseCache(false); #else
} m_titleblock_template_renderer -> setUseCache(false);
#endif
// dimensions par defaut du schema // dimensions par defaut du schema
importBorder(BorderProperties()); importBorder(BorderProperties());
@ -651,13 +652,13 @@ void BorderTitleBlock::drawDxf(
// dessine la numerotation des colonnes // dessine la numerotation des colonnes
if (display_border_ && if (display_border_ &&
display_columns_) { display_columns_) {
int offset = settings.value("border-columns_0", true).toBool() ? -1 : 0; int offset = settings.value("border-columns_0", true).toBool() ? -1 : 0;
for (int i = 1 ; i <= columns_count_ ; ++ i) { for (int i = 1 ; i <= columns_count_ ; ++ i) {
double xCoord = diagram_rect_.topLeft().x() * Createdxf::xScale + double xCoord = diagram_rect_.topLeft().x() * Createdxf::xScale +
(rows_header_width_ + ((i - 1) * (rows_header_width_ + ((i - 1) *
columns_width_)); columns_width_));
double yCoord = Createdxf::sheetHeight double yCoord = Createdxf::sheetHeight
- diagram_rect_.topLeft().y()*Createdxf::yScale - diagram_rect_.topLeft().y()*Createdxf::yScale
- columns_header_height_; - columns_header_height_;
double recWidth = columns_width_; double recWidth = columns_width_;
double recHeight = columns_header_height_; double recHeight = columns_header_height_;
@ -665,18 +666,18 @@ void BorderTitleBlock::drawDxf(
recWidth, recHeight, color); recWidth, recHeight, color);
Createdxf::drawTextAligned(file_path, Createdxf::drawTextAligned(file_path,
QString::number(i + offset), QString::number(i + offset),
xCoord+recWidth/4, xCoord+recWidth/4,
yCoord + recHeight*0.5, yCoord + recHeight*0.5,
recHeight*0.7, recHeight*0.7,
0, 0,
0, 0,
1, 1,
2, 2,
xCoord+recWidth/2, xCoord+recWidth/2,
1, 1,
color); color);
} }
} }
// draw line numbering // draw line numbering
@ -686,8 +687,8 @@ void BorderTitleBlock::drawDxf(
for (int i = 1 ; i <= rows_count_ ; ++ i) { for (int i = 1 ; i <= rows_count_ ; ++ i) {
double xCoord = diagram_rect_.topLeft().x() double xCoord = diagram_rect_.topLeft().x()
* Createdxf::xScale; * Createdxf::xScale;
double yCoord = Createdxf::sheetHeight double yCoord = Createdxf::sheetHeight
- diagram_rect_.topLeft().y() - diagram_rect_.topLeft().y()
*Createdxf::yScale *Createdxf::yScale
- ( - (
columns_header_height_ columns_header_height_
@ -700,15 +701,15 @@ void BorderTitleBlock::drawDxf(
recWidth, recHeight, color); recWidth, recHeight, color);
Createdxf::drawTextAligned(file_path, Createdxf::drawTextAligned(file_path,
row_string, row_string,
xCoord+recWidth*0.1, xCoord+recWidth*0.1,
yCoord + recHeight*0.4, yCoord + recHeight*0.4,
recWidth*0.7, recWidth*0.7,
0, 0,
0, 0,
1, 1,
2, 2,
xCoord+recWidth/2, xCoord+recWidth/2,
1, 1,
color); color);
row_string = incrementLetters(row_string); row_string = incrementLetters(row_string);
} }