forked from qt-creator/qt-creator
Implement drag-and-drop from Assets View to Texture Editor
The asset (i.e. image) can now be dragged to the "Source" property of the Texture Editor. Task-number: QDS-8341 Change-Id: I2d30bdf245a8328a864c116c727d3faaaad347cc Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
@@ -821,10 +821,15 @@ void QmlDesigner::TextureEditorView::highlightSupportedProperties(bool highlight
|
||||
QTC_ASSERT(metaInfo.isValid(), return);
|
||||
|
||||
for (const QString &propName : propNames) {
|
||||
if (metaInfo.property(propName.toUtf8()).propertyType().isQtQuick3DTexture()) { // TODO: support dropping to texture source
|
||||
if (metaInfo.property(propName.toUtf8()).propertyType().isQtQuick3DTexture()) {
|
||||
QObject *propEditorValObj = propMap.value(propName).value<QObject *>();
|
||||
PropertyEditorValue *propEditorVal = qobject_cast<PropertyEditorValue *>(propEditorValObj);
|
||||
propEditorVal->setHasActiveDrag(highlight);
|
||||
} else if (metaInfo.property(propName.toUtf8()).propertyType().isUrl()) {
|
||||
QObject *propEditorValObj = propMap.value(propName).value<QObject *>();
|
||||
PropertyEditorValue *propEditorVal = qobject_cast<PropertyEditorValue *>(propEditorValObj);
|
||||
if (propEditorVal)
|
||||
propEditorVal->setHasActiveDrag(highlight);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -841,6 +846,9 @@ void TextureEditorView::dragStarted(QMimeData *mimeData)
|
||||
return;
|
||||
|
||||
highlightSupportedProperties();
|
||||
|
||||
const QString suffix = "*." + assetPath.split('.').last().toLower();
|
||||
m_qmlBackEnd->contextObject()->setActiveDragSuffix(suffix);
|
||||
}
|
||||
|
||||
void TextureEditorView::dragEnded()
|
||||
|
||||
Reference in New Issue
Block a user