1/* This file is part of the KDE libraries
2 SPDX-FileCopyrightText: 1999 Steffen Hansen <hansen@kde.org>
3 SPDX-FileCopyrightText: 2005 Joseph Wenninger <jowenn@kde.org>
4
5 SPDX-License-Identifier: LGPL-2.0-or-later
6*/
7
8#ifndef _KCOLORMIMEDATA_H
9#define _KCOLORMIMEDATA_H
10
11#include <kguiaddons_export.h>
12
13class QColor;
14class QDrag;
15class QMimeData;
16class QObject;
17
18/*!
19 * \namespace KColorMimeData
20 * \inmodule KGuiAddons
21 *
22 * \brief Drag-and-drop and clipboard mimedata manipulation for QColor objects.
23 *
24 * The according MIME type is set to application/x-color.
25 *
26 * See the Qt drag'n'drop documentation.
27 */
28namespace KColorMimeData
29{
30/*!
31 * Sets the color and text representation fields for the specified color in the mimedata object:
32 * application/x-color and text/plain types are set
33 */
34KGUIADDONS_EXPORT void populateMimeData(QMimeData *mimeData, const QColor &color);
35
36/*!
37 * Returns true if the MIME data \a mimeData contains a color object.
38 * First checks for application/x-color and if that fails, for a text/plain entry, which
39 * represents a color in the format \#hexnumbers
40 */
41KGUIADDONS_EXPORT bool canDecode(const QMimeData *mimeData);
42
43/*!
44 * Decodes the MIME data \a mimeData and returns the resulting color.
45 * First tries application/x-color and if that fails, a text/plain entry, which
46 * represents a color in the format \#hexnumbers. If this fails too,
47 * an invalid QColor object is returned, use QColor::isValid() to test it.
48 */
49KGUIADDONS_EXPORT QColor fromMimeData(const QMimeData *mimeData);
50
51/*!
52 * Creates a color drag object. Either you have to start this drag or delete it
53 * The drag object's mime data has the application/x-color and text/plain type set and a pixmap
54 * filled with the specified color, which is going to be displayed next to the mouse cursor
55 */
56KGUIADDONS_EXPORT QDrag *createDrag(const QColor &color, QObject *dragsource);
57}
58
59#endif // _KCOLORMIMEDATA_H
60

source code of kguiaddons/src/colors/kcolormimedata.h