]>
cloud.milkyroute.net Git - dolphin.git/blob - src/tooltips/ktooltipitem.h
1 /***************************************************************************
2 * Copyright (C) 2008 by Fredrik Höglund <fredrik@kde.org> *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
18 ***************************************************************************/
20 #ifndef KTOOLTIPITEM_H
21 #define KTOOLTIPITEM_H
28 class KToolTipItemPrivate
;
31 * KToolTipItem contains the data to be displayed in a tooltip.
33 * Custom data can be stored as QVariants in the object by calling
34 * setData() with a custom item role, and retrieved and displayed
35 * by a tooltip delegate by calling data().
37 * The default tooltip delegate uses Qt::DecorationRole and
40 * To display the tooltip, call KToolTip::showTip() with a pointer
41 * to the KToolTipItem.
43 * You can reimplement the setData() and/or data() methods in this
44 * class to implement on-demand loading of data.
49 enum ItemType
{ DefaultType
, UserType
= 1000 };
52 * Creates a KToolTipItem with @p text and no icon.
54 explicit KToolTipItem(const QString
&text
, int type
= DefaultType
);
57 * Creates a KToolTipItem with an @p icon and @p text.
59 KToolTipItem(const QIcon
&icon
, const QString
&text
, int type
= DefaultType
);
62 * Destroys the KToolTipItem.
64 virtual ~KToolTipItem();
67 * Returns the item type.
74 virtual QVariant
data(int role
) const;
75 virtual void setData(int role
, const QVariant
&data
);
78 KToolTipItemPrivate
* const d
;