Qt 4.8
qtooltip.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtGui module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 #ifdef Q_WS_MAC
42 # include <private/qcore_mac_p.h>
43 #endif
44 
45 #include <qapplication.h>
46 #include <qdesktopwidget.h>
47 #include <qevent.h>
48 #include <qhash.h>
49 #include <qlabel.h>
50 #include <qpointer.h>
51 #include <qstyle.h>
52 #include <qstyleoption.h>
53 #include <qstylepainter.h>
54 #include <qtimer.h>
55 #include <qtooltip.h>
56 #include <private/qeffects_p.h>
57 #include <qtextdocument.h>
58 #include <qdebug.h>
59 #include <private/qstylesheetstyle_p.h>
60 #ifndef QT_NO_TOOLTIP
61 
62 #ifdef Q_WS_MAC
63 # include <private/qcore_mac_p.h>
64 #include <private/qt_cocoa_helpers_mac_p.h>
65 #endif
66 
68 
121 class QTipLabel : public QLabel
122 {
123  Q_OBJECT
124 public:
125  QTipLabel(const QString &text, QWidget *w);
126  ~QTipLabel();
128 
129  bool eventFilter(QObject *, QEvent *);
130 
132 
133  bool fadingOut;
134 
135  void reuseTip(const QString &text);
136  void hideTip();
137  void hideTipImmediately();
138  void setTipRect(QWidget *w, const QRect &r);
139  void restartExpireTimer();
140  bool tipChanged(const QPoint &pos, const QString &text, QObject *o);
141  void placeTip(const QPoint &pos, QWidget *w);
142 
143  static int getTipScreen(const QPoint &pos, QWidget *w);
144 protected:
145  void timerEvent(QTimerEvent *e);
146  void paintEvent(QPaintEvent *e);
147  void mouseMoveEvent(QMouseEvent *e);
148  void resizeEvent(QResizeEvent *e);
149 
150 #ifndef QT_NO_STYLE_STYLESHEET
151 public slots:
156  setProperty("_q_stylesheet_parent", QVariant());
157  styleSheetParent = 0;
158  }
159 
160 private:
162 #endif
163 
164 private:
167 };
168 
170 
172 #ifndef QT_NO_STYLE_STYLESHEET
174 #else
176 #endif
177 {
178  delete instance;
179  instance = this;
183  ensurePolished();
184  setMargin(1 + style()->pixelMetric(QStyle::PM_ToolTipLabelFrameWidth, 0, this));
187  setIndent(1);
188  qApp->installEventFilter(this);
190  setMouseTracking(true);
191  fadingOut = false;
192  reuseTip(text);
193 }
194 
196 {
197  int time = 10000 + 40 * qMax(0, text().length()-100);
198  expireTimer.start(time, this);
199  hideTimer.stop();
200 }
201 
202 void QTipLabel::reuseTip(const QString &text)
203 {
204 #ifndef QT_NO_STYLE_STYLESHEET
205  if (styleSheetParent){
207  QTipLabel::instance, SLOT(styleSheetParentDestroyed()));
208  styleSheetParent = 0;
209  }
210 #endif
211 
213  setText(text);
214  QFontMetrics fm(font());
215  QSize extra(1, 0);
216  // Make it look good with the default ToolTip font on Mac, which has a small descent.
217  if (fm.descent() == 2 && fm.ascent() >= 11)
218  ++extra.rheight();
219  resize(sizeHint() + extra);
221 }
222 
224 {
225  QStylePainter p(this);
226  QStyleOptionFrame opt;
227  opt.init(this);
229  p.end();
230 
231  QLabel::paintEvent(ev);
232 }
233 
235 {
236  QStyleHintReturnMask frameMask;
237  QStyleOption option;
238  option.init(this);
239  if (style()->styleHint(QStyle::SH_ToolTip_Mask, &option, this, &frameMask))
240  setMask(frameMask.region);
241 
243 }
244 
246 {
247  if (rect.isNull())
248  return;
249  QPoint pos = e->globalPos();
250  if (widget)
251  pos = widget->mapFromGlobal(pos);
252  if (!rect.contains(pos))
253  hideTip();
255 }
256 
258 {
259  instance = 0;
260 }
261 
263 {
264  if (!hideTimer.isActive())
265  hideTimer.start(300, this);
266 }
267 
269 {
270  close(); // to trigger QEvent::Close which stops the animation
271  deleteLater();
272 }
273 
275 {
276  if (!rect.isNull() && !w)
277  qWarning("QToolTip::setTipRect: Cannot pass null widget if rect is set");
278  else{
279  widget = w;
280  rect = r;
281  }
282 }
283 
285 {
286  if (e->timerId() == hideTimer.timerId()
287  || e->timerId() == expireTimer.timerId()){
288  hideTimer.stop();
289  expireTimer.stop();
290 #if defined(Q_WS_MAC) && !defined(QT_NO_EFFECTS)
292  // Fade out tip on mac (makes it invisible).
293  // The tip will not be deleted until a new tip is shown.
294 
295  // DRSWAT - Cocoa
297  QTipLabel::instance->fadingOut = true; // will never be false again.
298  }
299  else
301 #else
303 #endif
304  }
305 }
306 
308 {
309  switch (e->type()) {
310 #ifdef Q_WS_MAC
311  case QEvent::KeyPress:
312  case QEvent::KeyRelease: {
313  int key = static_cast<QKeyEvent *>(e)->key();
314  Qt::KeyboardModifiers mody = static_cast<QKeyEvent *>(e)->modifiers();
315  if (!(mody & Qt::KeyboardModifierMask)
316  && key != Qt::Key_Shift && key != Qt::Key_Control
317  && key != Qt::Key_Alt && key != Qt::Key_Meta)
318  hideTip();
319  break;
320  }
321 #endif
322  case QEvent::Leave:
323  hideTip();
324  break;
330  case QEvent::FocusIn:
331  case QEvent::FocusOut:
332  case QEvent::Wheel:
334  break;
335 
336  case QEvent::MouseMove:
337  if (o == widget && !rect.isNull() && !rect.contains(static_cast<QMouseEvent*>(e)->pos()))
338  hideTip();
339  default:
340  break;
341  }
342  return false;
343 }
344 
346 {
347  if (QApplication::desktop()->isVirtualDesktop())
348  return QApplication::desktop()->screenNumber(pos);
349  else
350  return QApplication::desktop()->screenNumber(w);
351 }
352 
354 {
355 #ifndef QT_NO_STYLE_STYLESHEET
356  if (testAttribute(Qt::WA_StyleSheet) || (w && qobject_cast<QStyleSheetStyle *>(w->style()))) {
357  //the stylesheet need to know the real parent
358  QTipLabel::instance->setProperty("_q_stylesheet_parent", QVariant::fromValue(w));
359  //we force the style to be the QStyleSheetStyle, and force to clear the cache as well.
360  QTipLabel::instance->setStyleSheet(QLatin1String("/* */"));
361 
362  // Set up for cleaning up this later...
363  QTipLabel::instance->styleSheetParent = w;
364  if (w) {
365  connect(w, SIGNAL(destroyed()),
366  QTipLabel::instance, SLOT(styleSheetParentDestroyed()));
367  }
368  }
369 #endif //QT_NO_STYLE_STYLESHEET
370 
371 
372 #ifdef Q_WS_MAC
373  // When in full screen mode, there is no Dock nor Menu so we can use
374  // the whole screen for displaying the tooltip. However when not in
375  // full screen mode we need to save space for the dock, so we use
376  // availableGeometry instead.
377  extern bool qt_mac_app_fullscreen; //qapplication_mac.mm
378  QRect screen;
379  if(qt_mac_app_fullscreen)
381  else
383 #else
385 #endif
386 
387  QPoint p = pos;
388  p += QPoint(2,
389 #ifdef Q_WS_WIN
390  21
391 #else
392  16
393 #endif
394  );
395  if (p.x() + this->width() > screen.x() + screen.width())
396  p.rx() -= 4 + this->width();
397  if (p.y() + this->height() > screen.y() + screen.height())
398  p.ry() -= 24 + this->height();
399  if (p.y() < screen.y())
400  p.setY(screen.y());
401  if (p.x() + this->width() > screen.x() + screen.width())
402  p.setX(screen.x() + screen.width() - this->width());
403  if (p.x() < screen.x())
404  p.setX(screen.x());
405  if (p.y() + this->height() > screen.y() + screen.height())
406  p.setY(screen.y() + screen.height() - this->height());
407  this->move(p);
408 }
409 
410 bool QTipLabel::tipChanged(const QPoint &pos, const QString &text, QObject *o)
411 {
412  if (QTipLabel::instance->text() != text)
413  return true;
414 
415  if (o != widget)
416  return true;
417 
418  if (!rect.isNull())
419  return !rect.contains(pos);
420  else
421  return false;
422 }
423 
443 void QToolTip::showText(const QPoint &pos, const QString &text, QWidget *w, const QRect &rect)
444 {
445  if (QTipLabel::instance && QTipLabel::instance->isVisible()){ // a tip does already exist
446  if (text.isEmpty()){ // empty text means hide current tip
447  QTipLabel::instance->hideTip();
448  return;
449  }
450  else if (!QTipLabel::instance->fadingOut){
451  // If the tip has changed, reuse the one
452  // that is showing (removes flickering)
453  QPoint localPos = pos;
454  if (w)
455  localPos = w->mapFromGlobal(pos);
456  if (QTipLabel::instance->tipChanged(localPos, text, w)){
457  QTipLabel::instance->reuseTip(text);
458  QTipLabel::instance->setTipRect(w, rect);
459  QTipLabel::instance->placeTip(pos, w);
460  }
461  return;
462  }
463  }
464 
465  if (!text.isEmpty()){ // no tip can be reused, create new tip:
466 #ifndef Q_WS_WIN
467  new QTipLabel(text, w); // sets QTipLabel::instance to itself
468 #else
469  // On windows, we can't use the widget as parent otherwise the window will be
470  // raised when the tooltip will be shown
471  new QTipLabel(text, QApplication::desktop()->screen(QTipLabel::getTipScreen(pos, w)));
472 #endif
473  QTipLabel::instance->setTipRect(w, rect);
474  QTipLabel::instance->placeTip(pos, w);
475  QTipLabel::instance->setObjectName(QLatin1String("qtooltip_label"));
476 
477 
478 #if !defined(QT_NO_EFFECTS) && !defined(Q_WS_MAC)
480  qFadeEffect(QTipLabel::instance);
482  qScrollEffect(QTipLabel::instance);
483  else
484  QTipLabel::instance->show();
485 #else
486  QTipLabel::instance->show();
487 #endif
488  }
489 }
490 
497 void QToolTip::showText(const QPoint &pos, const QString &text, QWidget *w)
498 {
499  QToolTip::showText(pos, text, w, QRect());
500 }
501 
502 
528 {
529  return (QTipLabel::instance != 0 && QTipLabel::instance->isVisible());
530 }
531 
542 {
543  if (QTipLabel::instance)
544  return QTipLabel::instance->text();
545  return QString();
546 }
547 
548 
549 Q_GLOBAL_STATIC(QPalette, tooltip_palette)
550 
551 
558 {
559  return *tooltip_palette();
560 }
561 
571 {
572  return QApplication::font("QTipLabel");
573 }
574 
587 {
588  *tooltip_palette() = palette;
589  if (QTipLabel::instance)
590  QTipLabel::instance->setPalette(palette);
591 }
592 
602 {
603  QApplication::setFont(font, "QTipLabel");
604 }
605 
606 
641 
642 #include "qtooltip.moc"
643 #endif // QT_NO_TOOLTIP
The QVariant class acts like a union for the most common Qt data types.
Definition: qvariant.h:92
QPoint pos() const
QLabel(QWidget *parent=0, Qt::WindowFlags f=0)
Constructs an empty label.
Definition: qlabel.cpp:179
void paintEvent(QPaintEvent *e)
This event handler can be reimplemented in a subclass to receive paint events passed in event...
Definition: qtooltip.cpp:223
void styleSheetParentDestroyed()
Definition: qtooltip.cpp:155
The QKeyEvent class describes a key event.
Definition: qevent.h:224
bool isNull() const
Returns true if the rectangle is a null rectangle, otherwise returns false.
Definition: qrect.h:231
double qreal
Definition: qglobal.h:1193
The QFontMetrics class provides font metrics information.
Definition: qfontmetrics.h:65
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
void setWordWrap(bool on)
Definition: qlabel.cpp:579
QWidget * styleSheetParent
Definition: qtooltip.cpp:161
void hideTipImmediately()
Definition: qtooltip.cpp:268
void ensurePolished() const
Ensures that the widget has been polished by QStyle (i.e., has a proper font and palette).
Definition: qwidget.cpp:10024
void setTipRect(QWidget *w, const QRect &r)
Definition: qtooltip.cpp:274
int descent() const
Returns the descent of the font.
void setText(const QString &)
Definition: qlabel.cpp:366
bool isVisible() const
Definition: qwidget.h:1005
static QPalette palette()
Returns the palette used to render tooltips.
Definition: qtooltip.cpp:557
static QTipLabel * instance
Definition: qtooltip.cpp:127
void mouseMoveEvent(QMouseEvent *e)
This event handler, for event event, can be reimplemented in a subclass to receive mouse move events ...
Definition: qtooltip.cpp:245
#define Q_WS_WIN
Defined on Windows.
Definition: qglobal.h:921
#define SLOT(a)
Definition: qobjectdefs.h:226
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
bool setProperty(const char *name, const QVariant &value)
Sets the value of the object&#39;s name property to value.
Definition: qobject.cpp:3755
static QFont font()
Returns the font used to render tooltips.
Definition: qtooltip.cpp:570
Q_GUI_EXPORT bool mightBeRichText(const QString &)
Returns true if the string text is likely to be rich text; otherwise returns false.
bool isActive() const
Returns true if the timer is running and has not been stopped; otherwise returns false.
Definition: qbasictimer.h:62
int width() const
Returns the width of the rectangle.
Definition: qrect.h:303
QTipLabel(const QString &text, QWidget *w)
Definition: qtooltip.cpp:171
int & ry()
Returns a reference to the y coordinate of this point.
Definition: qpoint.h:143
virtual void resizeEvent(QResizeEvent *)
This event handler can be reimplemented in a subclass to receive widget resize events which are passe...
Definition: qwidget.cpp:9587
QSize sizeHint() const
em>Reimplemented Function
Definition: qlabel.cpp:947
void init(const QWidget *w)
Use initFrom(widget) instead.
QRect rect
Definition: qtooltip.cpp:166
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
QBasicTimer hideTimer
Definition: qtooltip.cpp:131
friend OSWindowRef qt_mac_window_for(const QWidget *w)
Definition: qwidget_mac.mm:484
int height() const
Returns the height of the rectangle.
Definition: qrect.h:306
The QString class provides a Unicode character string.
Definition: qstring.h:83
void setForegroundRole(QPalette::ColorRole)
Sets the foreground role of the widget to role.
Definition: qwidget.cpp:4773
void mouseMoveEvent(QMouseEvent *ev)
em>Reimplemented Function
Definition: qlabel.cpp:994
The QObject class is the base class of all Qt objects.
Definition: qobject.h:111
int height() const
bool tipChanged(const QPoint &pos, const QString &text, QObject *o)
Definition: qtooltip.cpp:410
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
QStyle * style() const
Definition: qwidget.cpp:2742
void setObjectName(const QString &name)
Definition: qobject.cpp:1112
static QFont font()
Returns the default application font.
int ascent() const
Returns the ascent of the font.
#define SIGNAL(a)
Definition: qobjectdefs.h:227
void restartExpireTimer()
Definition: qtooltip.cpp:195
void setBackgroundRole(QPalette::ColorRole)
Sets the background role of the widget to role.
Definition: qwidget.cpp:4708
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
void destroyed(QObject *=0)
This signal is emitted immediately before the object obj is destroyed, and can not be blocked...
void drawPrimitive(QStyle::PrimitiveElement pe, const QStyleOption &opt)
Use the widget&#39;s style to draw a primitive element pe specified by QStyleOption option.
Definition: qstylepainter.h:82
QBasicTimer expireTimer
Definition: qtooltip.cpp:131
void qScrollEffect(QWidget *w, QEffects::DirFlags orient, int time)
Scroll widget w in time ms.
Definition: qeffects.cpp:562
The QStyleOption class stores the parameters used by QStyle functions.
Definition: qstyleoption.h:67
static bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
Creates a connection of the given type from the signal in the sender object to the method in the rece...
Definition: qobject.cpp:2580
bool testAttribute(Qt::WidgetAttribute) const
Returns true if attribute attribute is set on this widget; otherwise returns false.
Definition: qwidget.h:1041
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
#define qApp
int width() const
QString text() const
#define Q_GLOBAL_STATIC(TYPE, NAME)
Declares a global static variable with the given type and name.
Definition: qglobal.h:1968
const QPalette & palette() const
QWidget * widget
Definition: qtooltip.cpp:165
The QResizeEvent class contains event parameters for resize events.
Definition: qevent.h:349
const char * styleHint(const QFontDef &request)
Q_CORE_EXPORT void qWarning(const char *,...)
int & rx()
Returns a reference to the x coordinate of this point.
Definition: qpoint.h:140
int timerId() const
Returns the unique timer identifier, which is the same identifier as returned from QObject::startTime...
Definition: qcoreevent.h:346
The QStyleOptionFrame class is used to describe the parameters for drawing a frame.
Definition: qstyleoption.h:118
bool eventFilter(QObject *, QEvent *)
Filters events if this object has been installed as an event filter for the watched object...
Definition: qtooltip.cpp:307
bool fadingOut
Definition: qtooltip.cpp:133
The QToolTip class provides tool tips (balloon help) for any widget.
Definition: qtooltip.h:55
void show()
Shows the widget and its child widgets.
static QVariant fromValue(const T &value)
Returns a QVariant containing a copy of value.
Definition: qvariant.h:336
void setMask(const QBitmap &)
Causes only the pixels of the widget for which bitmap has a corresponding 1 bit to be visible...
Definition: qwidget.cpp:13309
QRect rect() const
#define Q_OBJECT
Definition: qobjectdefs.h:157
bool contains(const QPoint &p, bool proper=false) const
Returns true if the given point is inside or on the edge of the rectangle, otherwise returns false...
Definition: qrect.cpp:1101
void stop()
Stops the timer.
void setMouseTracking(bool enable)
Definition: qwidget.h:990
The QMouseEvent class contains parameters that describe a mouse event.
Definition: qevent.h:85
static QDesktopWidget * desktop()
Returns the desktop widget (also called the root window).
static bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *member)
Disconnects signal in object sender from method in object receiver.
Definition: qobject.cpp:2895
The QStyleHintReturnMask class provides style hints that return a QRegion.
Definition: qstyleoption.h:923
void setY(int y)
Sets the y coordinate of this point to the given y coordinate.
Definition: qpoint.h:137
static bool isEffectEnabled(Qt::UIEffect)
Returns true if effect is enabled; otherwise returns false.
const QRect screenGeometry(int screen=-1) const
void resize(int w, int h)
This corresponds to resize(QSize(w, h)).
Definition: qwidget.h:1014
The QTimerEvent class contains parameters that describe a timer event.
Definition: qcoreevent.h:341
The QFont class specifies a font used for drawing text.
Definition: qfont.h:64
void setMargin(int)
Definition: qlabel.cpp:654
int y() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:255
void hideTip()
Definition: qtooltip.cpp:262
void reuseTip(const QString &text)
Definition: qtooltip.cpp:202
int x() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:252
bool qt_mac_app_fullscreen
void timerEvent(QTimerEvent *e)
This event handler can be reimplemented in a subclass to receive timer events for the object...
Definition: qtooltip.cpp:284
int key
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
void setFrameStyle(int)
Sets the frame style to style.
Definition: qframe.cpp:329
int & rheight()
Returns a reference to the height.
Definition: qsize.h:144
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
int timerId() const
Returns the timer&#39;s ID.
Definition: qbasictimer.h:63
void resizeEvent(QResizeEvent *e)
This event handler can be reimplemented in a subclass to receive widget resize events which are passe...
Definition: qtooltip.cpp:234
The QLabel widget provides a text or image display.
Definition: qlabel.h:55
int y() const
Returns the y coordinate of this point.
Definition: qpoint.h:131
QPoint mapFromGlobal(const QPoint &) const
Translates the global screen coordinate pos to widget coordinates.
void paintEvent(QPaintEvent *)
This event handler can be reimplemented in a subclass to receive paint events passed in event...
Definition: qlabel.cpp:1123
The QStylePainter class is a convenience class for drawing QStyle elements inside a widget...
Definition: qstylepainter.h:55
The QBasicTimer class provides timer events for objects.
Definition: qbasictimer.h:55
const QFont & font() const
static bool isVisible()
Returns true if this tooltip is currently shown.
Definition: qtooltip.cpp:527
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
int screenNumber(const QWidget *widget=0) const
bool close()
Closes this widget.
Definition: qwidget.cpp:8305
int x() const
Returns the x coordinate of this point.
Definition: qpoint.h:128
const QRect availableGeometry(int screen=-1) const
QRegion region
the region for style hints that return a QRegion
Definition: qstyleoption.h:930
#define slots
Definition: qobjectdefs.h:68
void setStyleSheet(const QString &styleSheet)
Definition: qwidget.cpp:2709
The QPaintEvent class contains event parameters for paint events.
Definition: qevent.h:298
static void setFont(const QFont &, const char *className=0)
Changes the default application font to font.
void qFadeEffect(QWidget *w, int time)
Fade in widget w in time ms.
Definition: qeffects.cpp:584
The QEvent class is the base class of all event classes.
Definition: qcoreevent.h:56
Type type() const
Returns the event type.
Definition: qcoreevent.h:303
const QPoint & globalPos() const
Returns the global position of the mouse cursor at the time of the event.
Definition: qevent.h:96
void setX(int x)
Sets the x coordinate of this point to the given x coordinate.
Definition: qpoint.h:134
static void setPalette(const QPalette &)
Sets the palette used to render tooltips.
Definition: qtooltip.cpp:586
static QString text()
Returns the tooltip text, if a tooltip is visible, or an empty string if a tooltip is not visible...
Definition: qtooltip.cpp:541
void setWindowOpacity(qreal level)
Definition: qwidget.cpp:11497
static int getTipScreen(const QPoint &pos, QWidget *w)
Definition: qtooltip.cpp:345
void setAlignment(Qt::Alignment)
Without this function, a call to e.
Definition: qlabel.cpp:532
void deleteLater()
Schedules this object for deletion.
Definition: qobject.cpp:2145
void setPalette(const QPalette &)
Use the single-argument overload instead.
Definition: qwidget.cpp:4858
void start(int msec, QObject *obj)
Starts (or restarts) the timer with a msec milliseconds timeout.
bool end()
Ends painting.
Definition: qpainter.cpp:1929
static void setFont(const QFont &)
Sets the font used to render tooltips.
Definition: qtooltip.cpp:601
void move(int x, int y)
This corresponds to move(QPoint(x, y)).
Definition: qwidget.h:1011
void placeTip(const QPoint &pos, QWidget *w)
Definition: qtooltip.cpp:353
void setIndent(int)
Definition: qlabel.cpp:620
void macWindowFade(void *window, float durationSeconds)
static void showText(const QPoint &pos, const QString &text, QWidget *w=0)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: qtooltip.cpp:497
The QPalette class contains color groups for each widget state.
Definition: qpalette.h:61