QUtiMimeConverter Class▲
-
Header: QUtiMimeConverter
-
Since: Qt 6.5
-
CMake:
find_package(Qt6 REQUIRED COMPONENTS Gui)
target_link_libraries(mytarget PRIVATE Qt6::Gui)
-
qmake: QT += gui
-
Group: QUtiMimeConverter is part of draganddrop
Detailed Description▲
Qt's drag and drop and clipboard facilities use the MIME standard. On X11, this maps trivially to the Xdnd protocol. On Mac, although some applications use MIME to describe clipboard contents, it is more common to use Apple's UTI format.
QUtiMimeConverter's role is to bridge the gap between MIME and UTI; By subclasses this class, one can extend Qt's drag and drop and clipboard handling to convert to and from unsupported, or proprietary, UTI formats.
A subclass of QUtiMimeConverter will automatically be registered, and active, upon instantiation.
Qt has predefined support for the following UTIs:
-
public.utf8-plain-text - converts to "text/plain"
-
public.utf16-plain-text - converts to "text/plain"
-
public.text - converts to "text/plain"
-
public.html - converts to "text/html"
-
public.url - converts to "text/uri-list"
-
public.file-url - converts to "text/uri-list"
-
public.tiff - converts to "application/x-qt-image"
-
public.vcard - converts to "text/plain"
-
com.apple.traditional-mac-plain-text - converts to "text/plain"
-
com.apple.pict - converts to "application/x-qt-image"
When working with MIME data, Qt will iterate through all instances of QUtiMimeConverter to find find an instance that can convert to, or from, a specific MIME type. It will do this by calling mimeForUti() or utiForMime() on each instance, starting with (and choosing) the last created instance first. The actual conversions will be done by using convertToMime() and convertFromMime().
Member Function Documentation▲
QUtiMimeConverter::QUtiMimeConverter()▲
Constructs a new conversion object and adds it to the globally accessed list of available converters.
[virtual] QUtiMimeConverter::~QUtiMimeConverter()▲
Destroys a conversion object, removing it from the global list of available converters.
[virtual] int QUtiMimeConverter::count(const QMimeData *mimeData) const▲
Returns the item count for the given mimeData