Mime type conversion: clarify and clean up documentation
The converters need to be instantiated (which implicitly registers) after QPA has been initialized, i.e. after QGuiApplication has been instantiated. Clarify this in the documentation of the types. Remove the dead documentation for the explicit registration function. The API does not exist, and the documentation was never generated for Qt 6 either. The function does not need to be called as long as new mime converters are instantiated correctly (after QPA was initialized). Pick-to: 6.6 6.5 Task-number: QTBUG-119216 Change-Id: I4e31b3773e88f7a6d579265f093bab46847cb028 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
parent
bf946e8e3b
commit
0b60450eee
@ -21,20 +21,6 @@ Q_GLOBAL_STATIC(QStringList, globalDraggedTypesList)
|
||||
// implemented in qutimimeconverter.mm
|
||||
void registerBuiltInTypes();
|
||||
|
||||
/*!
|
||||
\fn void qRegisterDraggedTypes(const QStringList &types)
|
||||
\relates QUtiMimeConverter
|
||||
|
||||
Registers the given \a types as custom pasteboard types.
|
||||
|
||||
This function should be called to enable the Drag and Drop events
|
||||
for custom pasteboard types on Cocoa implementations. This is required
|
||||
in addition to a QUtiMimeConverter subclass implementation. By default
|
||||
drag and drop is enabled for all standard pasteboard types.
|
||||
|
||||
\sa QUtiMimeConverter
|
||||
*/
|
||||
|
||||
void registerDraggedTypes(const QStringList &types)
|
||||
{
|
||||
(*globalDraggedTypesList()) += types;
|
||||
|
@ -53,7 +53,21 @@ using namespace Qt::StringLiterals;
|
||||
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.
|
||||
Construct an instance of your converter implementation after instantiating
|
||||
QGuiApplication:
|
||||
|
||||
\code
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
QGuiApplication app(argc, argv);
|
||||
JsonMimeConverter jsonConverter;
|
||||
}
|
||||
\endcode
|
||||
|
||||
Destroying the instance will unregister the converter and remove support
|
||||
for the conversion. It is also valid to heap-allocate the converter
|
||||
instance; Qt takes ownership and will delete the converter object during
|
||||
QGuiApplication shut-down.
|
||||
|
||||
Qt has predefined support for the following UTIs:
|
||||
\list
|
||||
@ -94,6 +108,8 @@ QUtiMimeConverter::QUtiMimeConverter(HandlerScope scope)
|
||||
/*!
|
||||
Constructs a new conversion object and adds it to the
|
||||
globally accessed list of available converters.
|
||||
|
||||
Call this constructor after QGuiApplication has been created.
|
||||
*/
|
||||
QUtiMimeConverter::QUtiMimeConverter()
|
||||
: QUtiMimeConverter(HandlerScopeFlag::All)
|
||||
|
@ -25,6 +25,22 @@ QT_BEGIN_NAMESPACE
|
||||
conversions between Windows Clipboard and MIME formats, you can convert
|
||||
proprietary clipboard formats to MIME formats.
|
||||
|
||||
Construct an instance of your converter implementation after instantiating
|
||||
QGuiApplication:
|
||||
|
||||
\code
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
QGuiApplication app(argc, argv);
|
||||
JsonMimeConverter jsonConverter;
|
||||
}
|
||||
\endcode
|
||||
|
||||
Destroying the instance will unregister the converter and remove support
|
||||
for the conversion. It is also valid to heap-allocate the converter
|
||||
instance; Qt takes ownership and will delete the converter object during
|
||||
QGuiApplication shut-down.
|
||||
|
||||
Qt has predefined support for the following Windows Clipboard formats:
|
||||
|
||||
\table
|
||||
@ -112,6 +128,8 @@ QT_BEGIN_NAMESPACE
|
||||
|
||||
The instance is automatically registered, and will be called to convert data during
|
||||
clipboard or drag'n'drop operations.
|
||||
|
||||
Call this constructor after QGuiApplication has been created.
|
||||
*/
|
||||
QWindowsMimeConverter::QWindowsMimeConverter()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user