Turn off translation for object properties ability has been added to the object inspector

This commit is contained in:
Arin Alexander
2019-06-28 13:08:33 +03:00
parent 9a3af52cd7
commit 99757097cc
16 changed files with 121 additions and 21 deletions

View File

@@ -169,7 +169,8 @@ void QObjectPropertyModel::clearObjectsList()
}
QObjectPropertyModel::QObjectPropertyModel(QObject *parent/*=0*/)
:QAbstractItemModel(parent),m_rootNode(0),m_object(0),m_dataChanging(false), m_subclassesAsLevel(true), m_validator(0)
:QAbstractItemModel(parent),m_rootNode(0), m_object(0), m_dataChanging(false),
m_subclassesAsLevel(true), m_validator(0), m_translateProperties(true)
{}
QObjectPropertyModel::~QObjectPropertyModel()
@@ -297,16 +298,17 @@ QVariant QObjectPropertyModel::data(const QModelIndex &index, int role) const
switch (role) {
case Qt::DisplayRole:
if (!node) return QVariant();
node->setTranslateProperty(isTranslateProperties());
if (index.column()==0){
return node->displayName();
} else return node->displayValue();
break;
} else {
return node->displayValue();
}
case Qt::DecorationRole :
if (!node) return QIcon();
if (index.column()==1){
return node->iconValue();
}else return QIcon();
break;
} else return QIcon();
case Qt::UserRole:
return QVariant::fromValue(node);
default:
@@ -418,6 +420,16 @@ ObjectPropItem * QObjectPropertyModel::createPropertyItem(QMetaProperty prop, QO
}
return propertyItem;
}
bool QObjectPropertyModel::isTranslateProperties() const
{
return m_translateProperties;
}
void QObjectPropertyModel::setTranslateProperties(bool translateProperties)
{
m_translateProperties = translateProperties;
}
ValidatorIntf *QObjectPropertyModel::validator() const
{
return m_validator;