Fix: Root TreeItem (Object and Array) are not editable
Prevent enter in edit mode when "double click" on root item, The root item represent objects and arrays
This commit is contained in:
parent
eab788618b
commit
b7c5d9e279
@ -312,8 +312,13 @@ int QJsonModel::columnCount(const QModelIndex &parent) const
|
||||
|
||||
Qt::ItemFlags QJsonModel::flags(const QModelIndex &index) const
|
||||
{
|
||||
int col = index.column();
|
||||
if (col == 1) {
|
||||
int col = index.column();
|
||||
auto item = static_cast<QJsonTreeItem*>(index.internalPointer());
|
||||
|
||||
auto isArray = QJsonValue::Array == item->type();
|
||||
auto isObject = QJsonValue::Object == item->type();
|
||||
|
||||
if ((col == 1) && !(isArray || isObject)) {
|
||||
return Qt::ItemIsEditable | QAbstractItemModel::flags(index);
|
||||
} else {
|
||||
return QAbstractItemModel::flags(index);
|
||||
|
Loading…
Reference in New Issue
Block a user