Match any even if there are unnecessary characters before or after the geometry string

Fix whitespaces
master
adrido 2015-07-05 12:12:14 +02:00
parent 217979e55b
commit 4a3df34641
2 changed files with 6 additions and 6 deletions

View File

@ -72,8 +72,8 @@ Geometry::Format Geometry::set(QString str)
}
else if((match = cornerDimension.match(str)).hasMatch()){
qDebug()<<"format is CornerDimensions";
corner[0][0] = match.captured(1).toInt();
corner[0][1] = match.captured(2).toInt();
corner[0][0] = match.captured(1).toInt();
corner[0][1] = match.captured(2).toInt();
dimension[0] = match.captured(3).toInt();
dimension[1] = match.captured(4).toInt();
computeCenter();

View File

@ -49,10 +49,10 @@ public:
void setCorners(int c0x, int c0y, int c1x, int c1y);
QString getString(Geometry::Format format = Geometry::FormatNone);
private:
QRegularExpression corners = QRegularExpression("^(-?\\d*),(-?\\d*):(-?\\d*),(-?\\d*)$");
QRegularExpression centerDimension = QRegularExpression("^(-?\\d*),(-?\\d*):-?(\\d*)x-?(\\d*)$");
QRegularExpression cornerDimension = QRegularExpression("^(-?\\d*)[,x](-?\\d*)[+-](-?\\d*)[+-](-?\\d*)$");
QRegularExpression centerDimensionSimple = QRegularExpression("^(\\d*)x(\\d*)$");
QRegularExpression corners = QRegularExpression("(-?\\d*),(-?\\d*):(-?\\d*),(-?\\d*)");
QRegularExpression centerDimension = QRegularExpression("(-?\\d*),(-?\\d*):-?(\\d*)x-?(\\d*)");
QRegularExpression cornerDimension = QRegularExpression("(-?\\d*)[,x](-?\\d*)[+-](-?\\d*)[+-](-?\\d*)");
QRegularExpression centerDimensionSimple = QRegularExpression("(\\d*)x(\\d*)");
bool adjustCorners(void);
void computeCorner0(void);
void computeCorner1(void);