Warning, file /sdk/cervisia/tooltip.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*
0002  * Copyright (c) 2004-2008 André Wöbbeking <Woebbeking@kde.org>
0003  *
0004  * This program is free software; you can redistribute it and/or modify
0005  * it under the terms of the GNU General Public License as published by
0006  * the Free Software Foundation; either version 2 of the License, or
0007  * (at your option) any later version.
0008  *
0009  * This program is distributed in the hope that it will be useful,
0010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0012  * GNU General Public License for more details.
0013  *
0014  * You should have received a copy of the GNU General Public License
0015  * along with this program; if not, write to the Free Software
0016  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
0017  */
0018 
0019 #ifndef CERVISIA_TOOLTIP_H
0020 #define CERVISIA_TOOLTIP_H
0021 
0022 #include <qobject.h>
0023 
0024 class QPoint;
0025 class QRect;
0026 
0027 namespace Cervisia
0028 {
0029 
0030 /**
0031  * This class extends QToolTip:
0032  * - no more need to subclass just connect to the signal queryToolTip()
0033  * - truncate too large tooltip texts.
0034  */
0035 class ToolTip : public QObject
0036 {
0037     Q_OBJECT
0038 
0039 public:
0040     /**
0041      * @param widget The widget you want to add tooltips to. It's also used as
0042      * parent for the QObject. So you don't have to free an instance of this
0043      * class yourself.
0044      */
0045     explicit ToolTip(QWidget *widget);
0046 
0047 signals:
0048 
0049     /**
0050      * This signal is emitted when a tooltip could be displayed. When a client
0051      * wants to display anythink it must set a valid tooltip rectangle and a
0052      * non empty text.
0053      *
0054      * @param pos The position of the tooltip in the parent widget's coordinate system.
0055      *
0056      * @param rect The rectangle in the parent widget's coordinate system where the
0057      * tooltip is valid.
0058      *
0059      * @param text The tooltip text.
0060      */
0061     void queryToolTip(const QPoint &pos, QRect &rect, QString &text);
0062 
0063 protected:
0064     bool eventFilter(QObject *, QEvent *) override;
0065 };
0066 
0067 } // namespace Cervisia
0068 
0069 #endif // CERVISIA_TOOLTIP_H