Commit debe237a authored by Tobias Hunger's avatar Tobias Hunger

QtVersion: Add features for major/minor/patchlevel of Qt version

This is more fine-grained than the "Qt4" or "Qt5" we used to support
and will allow for wizards to specify things like "Make sure we get
a Qt version > 5.x" for the kit selection page.

That page is provided by the ProjectExplorer, so we can not access
the Qt version there, so Features seem the only possible way to go.

Change-Id: I0f4b3a0b5be91fb331924a560414e8f73bccca41
Reviewed-by: Orgad Shaneh's avatarOrgad Shaneh <orgads@gmail.com>
Reviewed-by: default avatarDaniel Teske <daniel.teske@theqtcompany.com>
parent 4dd95aa5
......@@ -96,6 +96,19 @@ QtVersionNumber::QtVersionNumber()
majorVersion = minorVersion = patchVersion = -1;
}
FeatureSet QtVersionNumber::features() const
{
FeatureSet result;
result |= Feature(Constants::FEATURE_QT);
if (majorVersion >= 0) {
QString featureMajor = QString::fromLatin1(Constants::FEATURE_QT) + QString::number(majorVersion);
result |= Feature(Id::fromString(featureMajor));
for (int i = 0; i <= minorVersion; ++i)
result |= Feature(Id::fromString(featureMajor + QLatin1Char('.') + QString::number(i)));
}
return result;
}
bool QtVersionNumber::operator <(const QtVersionNumber &b) const
{
if (majorVersion != b.majorVersion)
......@@ -348,15 +361,11 @@ QString BaseQtVersion::defaultUnexpandedDisplayName(const FileName &qmakePath, b
FeatureSet BaseQtVersion::availableFeatures() const
{
FeatureSet features = FeatureSet(Constants::FEATURE_QWIDGETS)
| FeatureSet(Constants::FEATURE_QT)
| FeatureSet(Constants::FEATURE_QT_WEBKIT)
| FeatureSet(Constants::FEATURE_QT_CONSOLE);
FeatureSet features = qtVersion().features(); // Qt Version features
if (qtVersion() < QtVersionNumber(5, 0, 0))
features |= FeatureSet(Constants::FEATURE_QT4);
else
features |= FeatureSet(Constants::FEATURE_QT5);
features |= (FeatureSet(Constants::FEATURE_QWIDGETS)
| FeatureSet(Constants::FEATURE_QT_WEBKIT)
| FeatureSet(Constants::FEATURE_QT_CONSOLE));
if (qtVersion() < QtVersionNumber(4, 7, 0))
return features;
......
......@@ -68,6 +68,8 @@ public:
QtVersionNumber(const QString &versionString);
QtVersionNumber();
Core::FeatureSet features() const;
int majorVersion;
int minorVersion;
int patchVersion;
......
......@@ -51,8 +51,6 @@ static const char QTVERSIONNAME[] = "Name";
//Qt Features
const char FEATURE_QT[] = "QtSupport.Wizards.FeatureQt";
const char FEATURE_QT4[] = "QtSupport.Wizards.FeatureQt4";
const char FEATURE_QT5[] = "QtSupport.Wizards.FeatureQt5";
const char FEATURE_QWIDGETS[] = "QtSupport.Wizards.FeatureQWidgets";
const char FEATURE_QT_QUICK[] = "QtSupport.Wizards.FeatureQtQuick";
const char FEATURE_QMLPROJECT[] = "QtSupport.Wizards.FeatureQtQuickProject";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment