tools/templates/mainform.cpp
changeset 1774 3627ba6099ca
parent 361 c3eebac100c0
child 8442 535a00ca0d35
equal deleted inserted replaced
1773:bc6ad6136675 1774:3627ba6099ca
    65 		stream << "      (" << endl;
    65 		stream << "      (" << endl;
    66 		for(int i = 0; i < xy->rects.size(); i++)
    66 		for(int i = 0; i < xy->rects.size(); i++)
    67 		{
    67 		{
    68 			QRect r = xy->rects[i].normalized();
    68 			QRect r = xy->rects[i].normalized();
    69 			stream << QString("       (x: %1; y: %2; w: %3; h: %4),").
    69 			stream << QString("       (x: %1; y: %2; w: %3; h: %4),").
    70 					arg(r.x() * 2, 4).arg(r.y() * 2, 4).arg(r.width() * 2, 4).arg(r.height() * 2, 4) << endl;
    70 					arg(r.x() * 4, 4).arg(r.y() * 4, 4).arg(r.width() * 4, 4).arg(r.height() * 4, 4) << endl;
    71 		}
    71 		}
    72 		stream << "      );" << endl;
    72 		stream << "      );" << endl;
    73 		f.close();
    73 		f.close();
    74 	}
    74 	}
    75 }
    75 }
   101 		QRegExp re("x:\\s+(\\d+);\\sy:\\s+(\\d+);\\sw:\\s+(\\d+);\\sh:\\s+(\\d+)");
   101 		QRegExp re("x:\\s+(\\d+);\\sy:\\s+(\\d+);\\sw:\\s+(\\d+);\\sh:\\s+(\\d+)");
   102 		re.indexIn(sl.at(i));
   102 		re.indexIn(sl.at(i));
   103 		QStringList coords = re.capturedTexts();
   103 		QStringList coords = re.capturedTexts();
   104 		qDebug() << sl.at(i) << coords;
   104 		qDebug() << sl.at(i) << coords;
   105 		if ((coords.size() == 5) && (coords[0].size()))
   105 		if ((coords.size() == 5) && (coords[0].size()))
   106 			xy->rects.push_back(QRect(coords[1].toInt() / 2, coords[2].toInt() / 2, coords[3].toInt() / 2, coords[4].toInt() / 2));
   106 			xy->rects.push_back(QRect(coords[1].toInt() / 4, coords[2].toInt() / 4, coords[3].toInt() / 4, coords[4].toInt() / 4));
   107 	}
   107 	}
   108 	f.close();
   108 	f.close();
   109 	xy->repaint();
   109 	xy->repaint();
   110 }
   110 }