MCPcopy Create free account
hub / github.com/KDE/kdevelop / addProfile

Method addProfile

kdevplatform/shell/settings/environmentprofilelistmodel.cpp:95–116  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

93}
94
95int EnvironmentProfileListModel::addProfile(const QString& newProfileName)
96{
97 const auto profileNames = this->profileNames();
98 if (newProfileName.isEmpty() ||
99 profileNames.contains(newProfileName)) {
100 return -1;
101 }
102
103 // estimate insert position by comparison as used by QMap for the keys
104 int insertPos = 0;
105 while (insertPos < profileNames.size() &&
106 profileNames.at(insertPos) < newProfileName) {
107 ++insertPos;
108 }
109 beginInsertRows(QModelIndex(), insertPos, insertPos);
110
111 // trigger creation of new profile
112 variables(newProfileName);
113
114 endInsertRows();
115 return insertPos;
116}
117
118void EnvironmentProfileListModel::removeProfile(int profileIndex)
119{

Callers

nothing calls this directly

Calls 6

profileNamesMethod · 0.80
QModelIndexClass · 0.70
isEmptyMethod · 0.45
containsMethod · 0.45
sizeMethod · 0.45
atMethod · 0.45

Tested by

no test coverage detected