forked from qt-creator/qt-creator
ProjectConfigurationModel: Avoid using sender()
Change-Id: I65a2da1f2e8a5d3bb98bda752942d83e4074df9d Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -64,12 +64,8 @@ int ProjectConfigurationModel::columnCount(const QModelIndex &parent) const
|
|||||||
return parent.isValid() ? 0 : 1;
|
return parent.isValid() ? 0 : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectConfigurationModel::displayNameChanged()
|
void ProjectConfigurationModel::displayNameChanged(ProjectConfiguration *pc)
|
||||||
{
|
{
|
||||||
auto pc = qobject_cast<ProjectConfiguration *>(sender());
|
|
||||||
if (!pc)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Find the old position
|
// Find the old position
|
||||||
int oldPos = m_projectConfigurations.indexOf(pc);
|
int oldPos = m_projectConfigurations.indexOf(pc);
|
||||||
if (oldPos < 0)
|
if (oldPos < 0)
|
||||||
@@ -148,7 +144,7 @@ void ProjectConfigurationModel::addProjectConfiguration(ProjectConfiguration *pc
|
|||||||
endInsertRows();
|
endInsertRows();
|
||||||
|
|
||||||
connect(pc, &ProjectConfiguration::displayNameChanged,
|
connect(pc, &ProjectConfiguration::displayNameChanged,
|
||||||
this, &ProjectConfigurationModel::displayNameChanged);
|
this, [this, pc] { displayNameChanged(pc); });
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectConfigurationModel::removeProjectConfiguration(ProjectConfiguration *pc)
|
void ProjectConfigurationModel::removeProjectConfiguration(ProjectConfiguration *pc)
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ public:
|
|||||||
void removeProjectConfiguration(ProjectConfiguration *pc);
|
void removeProjectConfiguration(ProjectConfiguration *pc);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void displayNameChanged();
|
void displayNameChanged(ProjectConfiguration *pc);
|
||||||
|
|
||||||
Target *m_target;
|
Target *m_target;
|
||||||
QList<ProjectConfiguration *> m_projectConfigurations;
|
QList<ProjectConfiguration *> m_projectConfigurations;
|
||||||
|
|||||||
Reference in New Issue
Block a user