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
31
class KToolTipItemPrivate;
34
* KToolTipItem contains the data to be displayed in a tooltip.
36
* Custom data can be stored as QVariants in the object by calling
37
* setData() with a custom item role, and retrieved and displayed
38
* by a tooltip delegate by calling data().
40
* The default tooltip delegate uses Qt::DecorationRole and
43
* To display the tooltip, call KToolTip::showTip() with a pointer
44
* to the KToolTipItem.
46
* You can reimplement the setData() and/or data() methods in this
47
* class to implement on-demand loading of data.
52
enum ItemType { DefaultType, UserType = 1000 };
55
* Creates a KToolTipItem with @p text and no icon.
57
explicit KToolTipItem(const QString &text, int type = DefaultType);
60
* Creates a KToolTipItem with an @p icon and @p text.
62
KToolTipItem(const QIcon &icon, const QString &text, int type = DefaultType);
65
* Destroys the KToolTipItem.
67
virtual ~KToolTipItem();
70
* Returns the item type.
77
virtual QVariant data(int role) const;
78
virtual void setData(int role, const QVariant &data);
81
KToolTipItemPrivate * const d;