mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 23:10:05 +00:00
Don't allow placefiles with an empty name
This commit is contained in:
parent
e14db6cd21
commit
df4500478c
2 changed files with 23 additions and 10 deletions
|
|
@ -257,6 +257,7 @@ bool PlacefileModel::setData(const QModelIndex& index,
|
|||
}
|
||||
|
||||
const auto& placefileName = p->placefileNames_.at(index.row());
|
||||
bool result = false;
|
||||
|
||||
switch (index.column())
|
||||
{
|
||||
|
|
@ -265,7 +266,7 @@ bool PlacefileModel::setData(const QModelIndex& index,
|
|||
{
|
||||
p->placefileManager_->set_placefile_enabled(placefileName,
|
||||
value.toBool());
|
||||
return true;
|
||||
result = true;
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
@ -274,16 +275,20 @@ bool PlacefileModel::setData(const QModelIndex& index,
|
|||
{
|
||||
p->placefileManager_->set_placefile_thresholded(placefileName,
|
||||
value.toBool());
|
||||
return true;
|
||||
result = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case static_cast<int>(Column::Placefile):
|
||||
if (role == Qt::ItemDataRole::EditRole)
|
||||
{
|
||||
p->placefileManager_->set_placefile_url(
|
||||
placefileName, value.toString().toStdString());
|
||||
return true;
|
||||
QString str = value.toString();
|
||||
if (!str.isEmpty())
|
||||
{
|
||||
p->placefileManager_->set_placefile_url(placefileName,
|
||||
str.toStdString());
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
@ -291,7 +296,12 @@ bool PlacefileModel::setData(const QModelIndex& index,
|
|||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
if (result)
|
||||
{
|
||||
Q_EMIT dataChanged(index, index);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void PlacefileModel::HandlePlacefileRemoved(const std::string& name)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue