Replace foreach function by for, please try and report problem

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4900 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
scorpio810
2017-02-04 21:43:23 +00:00
parent 6ed750b355
commit 6422dd096f
98 changed files with 606 additions and 606 deletions

View File

@@ -172,7 +172,7 @@ TitleBlockTemplate *TitleBlockTemplate::clone() const {
copy -> information_ = information_;
// this does not really duplicates pixmaps, only the objects that hold a key to the implicitly shared pixmaps
foreach (QString logo_key, bitmap_logos_.keys()) {
for (QString logo_key: bitmap_logos_.keys()) {
copy -> bitmap_logos_[logo_key] = QPixmap(bitmap_logos_[logo_key]);
#ifdef TITLEBLOCK_TEMPLATE_DEBUG
qDebug() << Q_FUNC_INFO << "copying " << bitmap_logos_[logo_key] -> cacheKey() << "to" << copy -> bitmap_logos_[logo_key] -> cacheKey();
@@ -180,7 +180,7 @@ TitleBlockTemplate *TitleBlockTemplate::clone() const {
}
// we have to create new QSvgRenderer objects from the data (no copy constructor)
foreach (QString logo_key, vector_logos_.keys()) {
for (QString logo_key: vector_logos_.keys()) {
copy -> vector_logos_[logo_key] = new QSvgRenderer(data_logos_[logo_key]);
}
@@ -336,7 +336,7 @@ void TitleBlockTemplate::parseRows(const QString &rows_string) {
bool conv_ok;
QStringList rows_descriptions = rows_string.split(QChar(';'), QString::SkipEmptyParts);
foreach (QString rows_description, rows_descriptions) {
for (QString rows_description: rows_descriptions) {
if (row_size_format.exactMatch(rows_description)) {
int row_size = row_size_format.capturedTexts().at(1).toInt(&conv_ok);
if (conv_ok) rows_heights_ << row_size;
@@ -359,7 +359,7 @@ void TitleBlockTemplate::parseColumns(const QString &cols_string) {
bool conv_ok;
QStringList cols_descriptions = cols_string.split(QChar(';'), QString::SkipEmptyParts);
foreach (QString cols_description, cols_descriptions) {
for (QString cols_description: cols_descriptions) {
if (abs_col_size_format.exactMatch(cols_description)) {
int col_size = abs_col_size_format.capturedTexts().at(1).toInt(&conv_ok);
if (conv_ok) columns_width_ << TitleBlockDimension(col_size, QET::Absolute);
@@ -370,7 +370,7 @@ void TitleBlockTemplate::parseColumns(const QString &cols_string) {
}
}
#ifdef TITLEBLOCK_TEMPLATE_DEBUG
foreach (TitleBlockColDimension icd, columns_width_) {
for (TitleBlockColDimension icd, columns_width_) {
qDebug() << Q_FUNC_INFO << QString("%1 [%2]").arg(icd.value).arg(QET::titleBlockColumnLengthToString(icd.type));
}
#endif
@@ -423,7 +423,7 @@ void TitleBlockTemplate::saveInformation(QDomElement &xml_element) const {
*/
void TitleBlockTemplate::saveLogos(QDomElement &xml_element) const {
QDomElement logos_element = xml_element.ownerDocument().createElement("logos");
foreach(QString logo_name, type_logos_.keys()) {
for (QString logo_name: type_logos_.keys()) {
QDomElement logo_element = xml_element.ownerDocument().createElement("logo");
saveLogo(logo_name, logo_element);
logos_element.appendChild(logo_element);
@@ -462,8 +462,8 @@ void TitleBlockTemplate::saveGrid(QDomElement &xml_element) const {
QDomElement grid_element = xml_element.ownerDocument().createElement("grid");
QString rows_attr, cols_attr;
foreach(int row_height, rows_heights_) rows_attr += QString("%1;").arg(row_height);
foreach(TitleBlockDimension col_width, columns_width_) cols_attr += col_width.toShortString();
for (int row_height: rows_heights_) rows_attr += QString("%1;").arg(row_height);
for (TitleBlockDimension col_width: columns_width_) cols_attr += col_width.toShortString();
grid_element.setAttribute("rows", rows_attr);
grid_element.setAttribute("cols", cols_attr);
@@ -719,7 +719,7 @@ QList<int> TitleBlockTemplate::columnsWidth(int total_width) const {
int share = difference > 0 ? 1 : -1;
if (qAbs(difference) <= max_acceptable_difference) {
while (difference) {
foreach (int index, relative_columns) {
for (int index: relative_columns) {
final_widths[index] += share;
difference -= share;
if (!difference) break;
@@ -807,7 +807,7 @@ int TitleBlockTemplate::maximumWidth() {
*/
int TitleBlockTemplate::width(int total_width) {
int width = 0;
foreach (int col_width, columnsWidth(total_width)) {
for (int col_width: columnsWidth(total_width)) {
width += col_width;
}
return(width);
@@ -818,7 +818,7 @@ int TitleBlockTemplate::width(int total_width) {
*/
int TitleBlockTemplate::height() const {
int height = 0;
foreach(int row_height, rows_heights_) {
for (int row_height: rows_heights_) {
height += row_height;
}
return(height);
@@ -1011,7 +1011,7 @@ QHash<TitleBlockCell *, QPair<int, int> > TitleBlockTemplate::getAllSpans() cons
Restore a set of span parameters.
*/
void TitleBlockTemplate::setAllSpans(const QHash<TitleBlockCell *, QPair<int, int> > &spans) {
foreach (TitleBlockCell *cell, spans.keys()) {
for (TitleBlockCell *cell: spans.keys()) {
cell -> row_span = spans[cell].first;
cell -> col_span = spans[cell].second;
}
@@ -1362,7 +1362,7 @@ QString TitleBlockTemplate::finalTextForCell(const TitleBlockCell &cell, const D
*/
QString TitleBlockTemplate::interpreteVariables(const QString &string, const DiagramContext &diagram_context) const {
QString interpreted_string = string;
foreach (QString key, diagram_context.keys(DiagramContext::DecreasingLength)) {
for (QString key: diagram_context.keys(DiagramContext::DecreasingLength)) {
interpreted_string.replace("%{" + key + "}", diagram_context[key].toString());
interpreted_string.replace("%" + key, diagram_context[key].toString());
}
@@ -1505,7 +1505,7 @@ void TitleBlockTemplate::forgetSpanning() {
*/
void TitleBlockTemplate::forgetSpanning(TitleBlockCell *spanning_cell, bool modify_cell) {
if (!spanning_cell) return;
foreach (TitleBlockCell *spanned_cell, spannedCells(spanning_cell)) {
for (TitleBlockCell *spanned_cell: spannedCells(spanning_cell)) {
spanned_cell -> spanner_cell = 0;
}
if (modify_cell) {