Skip to content
Extraits de code Groupes Projets
Vérifiée Valider afe4bdf4 rédigé par Kubat's avatar Kubat
Parcourir les fichiers

UI: The property view is never editable!

parent 0ec0503e
Aucune branche associée trouvée
Aucune étiquette associée trouvée
1 requête de fusion!15Video playback with mpv
......@@ -261,21 +261,6 @@ PropertyModel::columnCount(const QModelIndex & /* parent */) const noexcept
Qt::ItemFlags
PropertyModel::flags(const QModelIndex &index) const noexcept
{
// Handle the case where the model is not editable
if (!editableState) {
return /* Qt::ItemIsSelectable | */ QAbstractItemModel::flags(index);
}
// Here the model is editable
const int col = index.column();
const Item *item = static_cast<Item *>(index.internalPointer());
const bool isArray = QJsonValue::Array == item->getType();
const bool isObject = QJsonValue::Object == item->getType();
if ((col == 1) && !(isArray || isObject))
return Qt::ItemIsSelectable | Qt::ItemIsEditable | QAbstractItemModel::flags(index);
else
return QAbstractItemModel::flags(index);
}
......
......@@ -71,10 +71,7 @@ public:
root->setKey(object.getElementName());
}
~PropertyModel() noexcept = default;
void loadJson(const QJsonDocument &json);
void setEditable(const bool);
QVariant data(const QModelIndex &, int role) const noexcept override;
bool setData(const QModelIndex &, const QVariant &v, int r = Qt::EditRole) noexcept override;
......@@ -96,7 +93,6 @@ private:
QJsonValue generateJson(Item *) const noexcept;
std::unique_ptr<Item> root{ nullptr };
QStringList headers{};
bool editableState{ false };
};
}
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter