forked from qt-creator/qt-creator
Core: Use the new Id methods in a few places
There are a lot more left. Change-Id: I97d32629aa6deef0f4819f70cc0b8437f2814257 Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
This commit is contained in:
@@ -207,6 +207,8 @@ QString Id::toString() const
|
||||
This should not be used to handle a persistent version
|
||||
of the Id, use \c{fromSetting()} instead.
|
||||
|
||||
\deprecated
|
||||
|
||||
\sa toString(), fromSetting()
|
||||
*/
|
||||
|
||||
@@ -215,6 +217,22 @@ Id Id::fromString(const QString &name)
|
||||
return Id(theId(name.toUtf8()));
|
||||
}
|
||||
|
||||
/*!
|
||||
Creates an id from a string representation.
|
||||
|
||||
This should not be used to handle a persistent version
|
||||
of the Id, use \c{fromSetting()} instead.
|
||||
|
||||
\deprecated
|
||||
|
||||
\sa toString(), fromSetting()
|
||||
*/
|
||||
|
||||
Id Id::fromName(const QByteArray &name)
|
||||
{
|
||||
return Id(theId(name));
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns a persistent value representing the id which is
|
||||
suitable to be stored in QSettings.
|
||||
@@ -239,15 +257,41 @@ Id Id::fromSetting(const QVariant &variant)
|
||||
return Id(theId(ba));
|
||||
}
|
||||
|
||||
Id Id::withSuffix(Id id, int suffix)
|
||||
/*!
|
||||
Constructs a derived id.
|
||||
|
||||
This can be used to construct groups of ids logically
|
||||
belonging together. The associated internal name
|
||||
will be generated by appending \c{suffix}.
|
||||
*/
|
||||
|
||||
Id Id::withSuffix(int suffix) const
|
||||
{
|
||||
const QByteArray ba = id.name() + QByteArray::number(suffix);
|
||||
const QByteArray ba = name() + QByteArray::number(suffix);
|
||||
return Id(ba.constData());
|
||||
}
|
||||
|
||||
Id Id::withSuffix(Id id, const char *suffix)
|
||||
/*!
|
||||
\overload
|
||||
*/
|
||||
|
||||
Id Id::withSuffix(const char *suffix) const
|
||||
{
|
||||
const QByteArray ba = id.name() + suffix;
|
||||
const QByteArray ba = name() + suffix;
|
||||
return Id(ba.constData());
|
||||
}
|
||||
|
||||
/*!
|
||||
Constructs a derived id.
|
||||
|
||||
This can be used to construct groups of ids logically
|
||||
belonging together. The associated internal name
|
||||
will be generated by prepending \c{prefix}.
|
||||
*/
|
||||
|
||||
Id Id::withPrefix(const char *prefix) const
|
||||
{
|
||||
const QByteArray ba = prefix + name();
|
||||
return Id(ba.constData());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user