fix deprecated warning QString::SplitBehavior

enum QString::SplitBehavior This enum is obsolete.

Use Qt::SplitBehavior instead.
This enum was introduced or modified in Qt 5.14.
This commit is contained in:
Simon De Backer
2020-06-09 22:41:01 +02:00
committed by Laurent Trinques
parent 2570108caf
commit 2ec018a4e9
6 changed files with 31 additions and 4 deletions

View File

@@ -638,7 +638,11 @@ void ElementsCollectionWidget::search()
} }
hideCollection(true); hideCollection(true);
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) // ### Qt 6: remove
QStringList text_list = text.split("+", QString::SkipEmptyParts); QStringList text_list = text.split("+", QString::SkipEmptyParts);
#else
QStringList text_list = text.split("+", Qt::SkipEmptyParts);
#endif
QModelIndexList match_index; QModelIndexList match_index;
foreach (QString txt, text_list) { foreach (QString txt, text_list) {
match_index << m_model->match(m_showed_index.isValid() ? m_model->index(0,0,m_showed_index) : m_model->index(0,0), match_index << m_model->match(m_showed_index.isValid() ? m_model->index(0,0,m_showed_index) : m_model->index(0,0),

View File

@@ -730,7 +730,11 @@ void ConductorProperties::readStyle(const QString &style_string) {
if (style_string.isEmpty()) return; if (style_string.isEmpty()) return;
// recupere la liste des couples style / valeur // recupere la liste des couples style / valeur
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) // ### Qt 6: remove
QStringList styles = style_string.split(";", QString::SkipEmptyParts); QStringList styles = style_string.split(";", QString::SkipEmptyParts);
#else
QStringList styles = style_string.split(";", Qt::SkipEmptyParts);
#endif
QRegExp rx("^\\s*([a-z-]+)\\s*:\\s*([a-z-]+)\\s*$"); QRegExp rx("^\\s*([a-z-]+)\\s*:\\s*([a-z-]+)\\s*$");
foreach (QString style_str, styles) { foreach (QString style_str, styles) {

View File

@@ -495,7 +495,11 @@ void CustomElementGraphicPart::stylesFromXml(const QDomElement &qde)
resetStyles(); resetStyles();
//Get the list of pair style/value //Get the list of pair style/value
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) // ### Qt 6: remove
QStringList styles = qde.attribute("style").split(";", QString::SkipEmptyParts); QStringList styles = qde.attribute("style").split(";", QString::SkipEmptyParts);
#else
QStringList styles = qde.attribute("style").split(";", Qt::SkipEmptyParts);
#endif
//Check each pair of style //Check each pair of style
QRegExp rx("^\\s*([a-z-]+)\\s*:\\s*([a-zA-Z-]+)\\s*$"); QRegExp rx("^\\s*([a-z-]+)\\s*:\\s*([a-zA-Z-]+)\\s*$");

View File

@@ -556,8 +556,11 @@ void ElementPictureFactory::setPainterStyle(const QDomElement &dom, QPainter &pa
pen.setCapStyle(Qt::SquareCap); pen.setCapStyle(Qt::SquareCap);
//Get the couples style/value //Get the couples style/value
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) // ### Qt 6: remove
const QStringList styles = dom.attribute("style").split(";", QString::SkipEmptyParts); const QStringList styles = dom.attribute("style").split(";", QString::SkipEmptyParts);
#else
const QStringList styles = dom.attribute("style").split(";", Qt::SkipEmptyParts);
#endif
QRegExp rx("^\\s*([a-z-]+)\\s*:\\s*([a-zA-Z-]+)\\s*$"); QRegExp rx("^\\s*([a-z-]+)\\s*:\\s*([a-zA-Z-]+)\\s*$");
for (QString style : styles) { for (QString style : styles) {
if (rx.exactMatch(style)) { if (rx.exactMatch(style)) {

View File

@@ -447,8 +447,12 @@ QString QET::joinWithSpaces(const QStringList &string_list) {
*/ */
QStringList QET::splitWithSpaces(const QString &string) { QStringList QET::splitWithSpaces(const QString &string) {
// les chaines sont separees par des espaces non echappes = avec un nombre nul ou pair de backslashes devant // les chaines sont separees par des espaces non echappes = avec un nombre nul ou pair de backslashes devant
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) // ### Qt 6: remove
QStringList escaped_strings = string.split(QRegExp("[^\\]?(?:\\\\)* "), QString::SkipEmptyParts); QStringList escaped_strings = string.split(QRegExp("[^\\]?(?:\\\\)* "), QString::SkipEmptyParts);
#else
QStringList escaped_strings = string.split(QRegExp("[^\\]?(?:\\\\)* "), Qt::SkipEmptyParts);
#endif
QStringList returned_list; QStringList returned_list;
foreach(QString escaped_string, escaped_strings) { foreach(QString escaped_string, escaped_strings) {
returned_list << QET::unescapeSpaces(escaped_string); returned_list << QET::unescapeSpaces(escaped_string);

View File

@@ -334,8 +334,12 @@ void TitleBlockTemplate::parseRows(const QString &rows_string) {
// parse the rows attribute: we expect a serie of absolute heights // parse the rows attribute: we expect a serie of absolute heights
QRegExp row_size_format("^([0-9]+)(?:px)?$", Qt::CaseInsensitive); QRegExp row_size_format("^([0-9]+)(?:px)?$", Qt::CaseInsensitive);
bool conv_ok; bool conv_ok;
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) // ### Qt 6: remove
QStringList rows_descriptions = rows_string.split(QChar(';'), QString::SkipEmptyParts); QStringList rows_descriptions = rows_string.split(QChar(';'), QString::SkipEmptyParts);
#else
QStringList rows_descriptions = rows_string.split(QChar(';'), Qt::SkipEmptyParts);
#endif
foreach (QString rows_description, rows_descriptions) { foreach (QString rows_description, rows_descriptions) {
if (row_size_format.exactMatch(rows_description)) { if (row_size_format.exactMatch(rows_description)) {
int row_size = row_size_format.capturedTexts().at(1).toInt(&conv_ok); int row_size = row_size_format.capturedTexts().at(1).toInt(&conv_ok);
@@ -357,8 +361,12 @@ void TitleBlockTemplate::parseColumns(const QString &cols_string) {
QRegExp abs_col_size_format("^([0-9]+)(?:px)?$", Qt::CaseInsensitive); QRegExp abs_col_size_format("^([0-9]+)(?:px)?$", Qt::CaseInsensitive);
QRegExp rel_col_size_format("^([rt])([0-9]+)%$", Qt::CaseInsensitive); QRegExp rel_col_size_format("^([rt])([0-9]+)%$", Qt::CaseInsensitive);
bool conv_ok; bool conv_ok;
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) // ### Qt 6: remove
QStringList cols_descriptions = cols_string.split(QChar(';'), QString::SkipEmptyParts); QStringList cols_descriptions = cols_string.split(QChar(';'), QString::SkipEmptyParts);
#else
QStringList cols_descriptions = cols_string.split(QChar(';'), Qt::SkipEmptyParts);
#endif
foreach (QString cols_description, cols_descriptions) { foreach (QString cols_description, cols_descriptions) {
if (abs_col_size_format.exactMatch(cols_description)) { if (abs_col_size_format.exactMatch(cols_description)) {
int col_size = abs_col_size_format.capturedTexts().at(1).toInt(&conv_ok); int col_size = abs_col_size_format.capturedTexts().at(1).toInt(&conv_ok);