#14544 Make mime data hasFormat() consistent with formats()

MimeDataWithIndexes and MimeDataWithReferences advertised every stored format in formats() but denied all of them except their own format name in hasFormat(). The object reference paths that the tree view stores under the ObjectReferenceList mime type were therefore reported as absent, and only worked because QMimeData::data() does not consult hasFormat().

Fall back to QMimeData::hasFormat() so the two functions agree.
This commit is contained in:
Magne Sjaastad
2026-08-19 10:32:17 +02:00
parent d57abe525d
commit 508804d6ab
@@ -55,7 +55,7 @@ const QModelIndexList& MimeDataWithIndexes::indexes() const
//--------------------------------------------------------------------------------------------------
bool MimeDataWithIndexes::hasFormat( const QString& mimetype ) const
{
return ( mimetype == formatName() );
return ( mimetype == formatName() ) || QMimeData::hasFormat( mimetype );
}
//--------------------------------------------------------------------------------------------------
@@ -114,7 +114,7 @@ const std::vector<QString>& MimeDataWithReferences::references() const
//--------------------------------------------------------------------------------------------------
bool MimeDataWithReferences::hasFormat( const QString& mimetype ) const
{
return ( mimetype == formatName() );
return ( mimetype == formatName() ) || QMimeData::hasFormat( mimetype );
}
//--------------------------------------------------------------------------------------------------