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
***************************************************************************/
21
#include "ktooltipwindow_p.h"
31
static KToolTipManager* instance();
33
void showTip(const QPoint& pos, QWidget* content);
39
KToolTipWindow* m_window;
40
static KToolTipManager *s_instance;
43
KToolTipManager *KToolTipManager::s_instance = 0;
45
KToolTipManager::KToolTipManager() :
50
KToolTipManager::~KToolTipManager()
56
KToolTipManager* KToolTipManager::instance()
58
if (s_instance == 0) {
59
s_instance = new KToolTipManager();
65
void KToolTipManager::showTip(const QPoint& pos, QWidget* content)
68
Q_ASSERT(m_window == 0);
69
m_window = new KToolTipWindow(content);
74
void KToolTipManager::hideTip()
78
m_window->deleteLater();
85
void showText(const QPoint& pos, const QString& text)
87
QLabel* label = new QLabel(text);
88
label->setForegroundRole(QPalette::ToolTipText);
92
void showTip(const QPoint& pos, QWidget* content)
94
KToolTipManager::instance()->showTip(pos, content);
99
KToolTipManager::instance()->hideTip();