ProjectExplorer: Use more concise code to register extra compilers

Saves some line noise and a function.

(void) new Foo(this); is not really a new pattern in Creator code,
but a bit of a new pattern for "registering things".

Change-Id: Ie1bb409ed77bc20833fc07ca14715b9ecbc9bd5d
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
hjk
2017-01-31 17:37:13 +01:00
parent 79e73ea4ee
commit 5b50854e57
3 changed files with 6 additions and 11 deletions

View File

@@ -353,15 +353,12 @@ void ExtraCompiler::setContent(const Utils::FileName &file, const QByteArray &co
ExtraCompilerFactory::ExtraCompilerFactory(QObject *parent) : QObject(parent)
{
factories->append(this);
}
void ExtraCompilerFactory::registerExtraCompilerFactory(ExtraCompilerFactory *factory)
ExtraCompilerFactory::~ExtraCompilerFactory()
{
QList<ExtraCompilerFactory *> *factoryList = factories();
factoryList->append(factory);
connect(factory, &QObject::destroyed, [factoryList, factory]() {
factoryList->removeAll(factory);
});
factories->removeAll(this);
}
QList<ExtraCompilerFactory *> ExtraCompilerFactory::extraCompilerFactories()