Esempio n. 1
0
QString QMLManager::getVersion() const
{
	QRegExp versionRe(".*:([()\\.,\\d]+).*");
	if (!versionRe.exactMatch(getUserAgent()))
		return QString();

	return versionRe.cap(1);
}
Esempio n. 2
0
//! Reads the version from the string. Sets it to 0.0 on failure.
QsVersion::QsVersion( const QString& a_versionString ) :
    mMajor(0),
    mMinor(0),
    mRelease(0)
{
    enum
    {
        MajorPart = 1,
        MinorPart,
        ReleasePart
    };
    const int partCount = 3;
    QRegExp versionRe("^(\\d{1,3})\\.(\\d{1,3})(?:\\.(\\d{1,4}))*$");
    if (a_versionString.contains(versionRe)) {
        mMajor = versionRe.cap(MajorPart).toInt();
        mMinor = versionRe.cap(MinorPart).toInt();
        if (partCount == versionRe.captureCount())
            mRelease = versionRe.cap(ReleasePart).toInt();
    }
}