Qt 4.8
qsystemtrayicon.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 
42 #include "qsystemtrayicon.h"
43 #include "qsystemtrayicon_p.h"
44 
45 #ifndef QT_NO_SYSTEMTRAYICON
46 
47 #include "qmenu.h"
48 #include "qevent.h"
49 #include "qpoint.h"
50 #include "qlabel.h"
51 #include "qpushbutton.h"
52 #include "qpainterpath.h"
53 #include "qpainter.h"
54 #include "qstyle.h"
55 #include "qgridlayout.h"
56 #include "qapplication.h"
57 #include "qdesktopwidget.h"
58 #include "qbitmap.h"
59 #include "private/qlabel_p.h"
60 #include "qapplication.h"
61 
63 
135 : QObject(*new QSystemTrayIconPrivate(), parent)
136 {
137 }
138 
147 : QObject(*new QSystemTrayIconPrivate(), parent)
148 {
149  setIcon(icon);
150 }
151 
156 {
158  d->remove_sys();
159 }
160 
161 #ifndef QT_NO_MENU
162 
177 {
179  d->menu = menu;
180  d->updateMenu_sys();
181 }
182 
187 {
188  Q_D(const QSystemTrayIcon);
189  return d->menu;
190 }
191 
192 #endif // QT_NO_MENU
193 
205 {
207  d->icon = icon;
208  d->updateIcon_sys();
209 }
210 
212 {
213  Q_D(const QSystemTrayIcon);
214  return d->icon;
215 }
216 
228 {
230  d->toolTip = tooltip;
231  d->updateToolTip_sys();
232 }
233 
235 {
236  Q_D(const QSystemTrayIcon);
237  return d->toolTip;
238 }
239 
272 {
273  Q_D(const QSystemTrayIcon);
274  if (!d->visible)
275  return QRect();
276  return d->geometry_sys();
277 }
278 
290 {
292  if (visible == d->visible)
293  return;
294  if (d->icon.isNull() && visible)
295  qWarning("QSystemTrayIcon::setVisible: No Icon set");
296  d->visible = visible;
297  if (d->visible)
298  d->install_sys();
299  else
300  d->remove_sys();
301 }
302 
304 {
305  Q_D(const QSystemTrayIcon);
306  return d->visible;
307 }
308 
313 {
314 #if defined(Q_WS_X11)
315  if (e->type() == QEvent::ToolTip) {
317  return d->sys->deliverToolTipEvent(e);
318  }
319 #endif
320  return QObject::event(e);
321 }
322 
381 {
383 }
384 
391 {
393 }
394 
421 void QSystemTrayIcon::showMessage(const QString& title, const QString& msg,
423 {
425  if (d->visible)
426  d->showMessage_sys(title, msg, icon, msecs);
427 }
428 
431 
433  const QString& message, QSystemTrayIcon *trayIcon,
434  const QPoint& pos, int timeout, bool showArrow)
435 {
436  hideBalloon();
437  if (message.isEmpty() && title.isEmpty())
438  return;
439 
440  theSolitaryBalloonTip = new QBalloonTip(icon, title, message, trayIcon);
441  if (timeout < 0)
442  timeout = 10000; //10 s default
443  theSolitaryBalloonTip->balloon(pos, timeout, showArrow);
444 }
445 
447 {
448  if (!theSolitaryBalloonTip)
449  return;
450  theSolitaryBalloonTip->hide();
451  delete theSolitaryBalloonTip;
452  theSolitaryBalloonTip = 0;
453 }
454 
456 {
457  return theSolitaryBalloonTip;
458 }
459 
461  const QString& message, QSystemTrayIcon *ti)
462  : QWidget(0, Qt::ToolTip), trayIcon(ti), timerId(-1)
463 {
465  QObject::connect(ti, SIGNAL(destroyed()), this, SLOT(close()));
466 
467  QLabel *titleLabel = new QLabel;
468  titleLabel->installEventFilter(this);
469  titleLabel->setText(title);
470  QFont f = titleLabel->font();
471  f.setBold(true);
472 #ifdef Q_WS_WINCE
473  f.setPointSize(f.pointSize() - 2);
474 #endif
475  titleLabel->setFont(f);
476  titleLabel->setTextFormat(Qt::PlainText); // to maintain compat with windows
477 
478 #ifdef Q_WS_WINCE
479  const int iconSize = style()->pixelMetric(QStyle::PM_SmallIconSize);
481 #else
482  const int iconSize = 18;
483  const int closeButtonSize = 15;
484 #endif
485 
486  QPushButton *closeButton = new QPushButton;
487  closeButton->setIcon(style()->standardIcon(QStyle::SP_TitleBarCloseButton));
488  closeButton->setIconSize(QSize(closeButtonSize, closeButtonSize));
490  closeButton->setFixedSize(closeButtonSize, closeButtonSize);
491  QObject::connect(closeButton, SIGNAL(clicked()), this, SLOT(close()));
492 
493  QLabel *msgLabel = new QLabel;
494 #ifdef Q_WS_WINCE
495  f.setBold(false);
496  msgLabel->setFont(f);
497 #endif
498  msgLabel->installEventFilter(this);
499  msgLabel->setText(message);
500  msgLabel->setTextFormat(Qt::PlainText);
502 
503  // smart size for the message label
504 #ifdef Q_WS_WINCE
505  int limit = QApplication::desktop()->availableGeometry(msgLabel).size().width() / 2;
506 #else
507  int limit = QApplication::desktop()->availableGeometry(msgLabel).size().width() / 3;
508 #endif
509  if (msgLabel->sizeHint().width() > limit) {
510  msgLabel->setWordWrap(true);
511  if (msgLabel->sizeHint().width() > limit) {
512  msgLabel->d_func()->ensureTextControl();
513  if (QTextControl *control = msgLabel->d_func()->control) {
514  QTextOption opt = control->document()->defaultTextOption();
516  control->document()->setDefaultTextOption(opt);
517  }
518  }
519 #ifdef Q_WS_WINCE
520  // Make sure that the text isn't wrapped "somewhere" in the balloon widget
521  // in the case that we have a long title label.
522  setMaximumWidth(limit);
523 #else
524  // Here we allow the text being much smaller than the balloon widget
525  // to emulate the weird standard windows behavior.
526  msgLabel->setFixedSize(limit, msgLabel->heightForWidth(limit));
527 #endif
528  }
529 
530  QIcon si;
531  switch (icon) {
534  break;
537  break;
540  break;
542  default:
543  break;
544  }
545 
547  if (!si.isNull()) {
548  QLabel *iconLabel = new QLabel;
549  iconLabel->setPixmap(si.pixmap(iconSize, iconSize));
551  iconLabel->setMargin(2);
552  layout->addWidget(iconLabel, 0, 0);
553  layout->addWidget(titleLabel, 0, 1);
554  } else {
555  layout->addWidget(titleLabel, 0, 0, 1, 2);
556  }
557 
558  layout->addWidget(closeButton, 0, 2);
559  layout->addWidget(msgLabel, 1, 0, 1, 3);
561  layout->setMargin(3);
562  setLayout(layout);
563 
564  QPalette pal = palette();
565  pal.setColor(QPalette::Window, QColor(0xff, 0xff, 0xe1));
567  setPalette(pal);
568 }
569 
571 {
572  theSolitaryBalloonTip = 0;
573 }
574 
576 {
577  QPainter painter(this);
578  painter.drawPixmap(rect(), pixmap);
579 }
580 
582 {
584 }
585 
586 void QBalloonTip::balloon(const QPoint& pos, int msecs, bool showArrow)
587 {
589  QSize sh = sizeHint();
590  const int border = 1;
591  const int ah = 18, ao = 18, aw = 18, rc = 7;
592  bool arrowAtTop = (pos.y() + sh.height() + ah < scr.height());
593  bool arrowAtLeft = (pos.x() + sh.width() - ao < scr.width());
594  setContentsMargins(border + 3, border + (arrowAtTop ? ah : 0) + 2, border + 3, border + (arrowAtTop ? 0 : ah) + 2);
595  updateGeometry();
596  sh = sizeHint();
597 
598  int ml, mr, mt, mb;
599  QSize sz = sizeHint();
600  if (!arrowAtTop) {
601  ml = mt = 0;
602  mr = sz.width() - 1;
603  mb = sz.height() - ah - 1;
604  } else {
605  ml = 0;
606  mt = ah;
607  mr = sz.width() - 1;
608  mb = sz.height() - 1;
609  }
610 
611  QPainterPath path;
612 #if defined(QT_NO_XSHAPE) && defined(Q_WS_X11)
613  // XShape is required for setting the mask, so we just
614  // draw an ugly square when its not available
615  path.moveTo(0, 0);
616  path.lineTo(sz.width() - 1, 0);
617  path.lineTo(sz.width() - 1, sz.height() - 1);
618  path.lineTo(0, sz.height() - 1);
619  path.lineTo(0, 0);
620  move(qMax(pos.x() - sz.width(), scr.left()), pos.y());
621 #else
622  path.moveTo(ml + rc, mt);
623  if (arrowAtTop && arrowAtLeft) {
624  if (showArrow) {
625  path.lineTo(ml + ao, mt);
626  path.lineTo(ml + ao, mt - ah);
627  path.lineTo(ml + ao + aw, mt);
628  }
629  move(qMax(pos.x() - ao, scr.left() + 2), pos.y());
630  } else if (arrowAtTop && !arrowAtLeft) {
631  if (showArrow) {
632  path.lineTo(mr - ao - aw, mt);
633  path.lineTo(mr - ao, mt - ah);
634  path.lineTo(mr - ao, mt);
635  }
636  move(qMin(pos.x() - sh.width() + ao, scr.right() - sh.width() - 2), pos.y());
637  }
638  path.lineTo(mr - rc, mt);
639  path.arcTo(QRect(mr - rc*2, mt, rc*2, rc*2), 90, -90);
640  path.lineTo(mr, mb - rc);
641  path.arcTo(QRect(mr - rc*2, mb - rc*2, rc*2, rc*2), 0, -90);
642  if (!arrowAtTop && !arrowAtLeft) {
643  if (showArrow) {
644  path.lineTo(mr - ao, mb);
645  path.lineTo(mr - ao, mb + ah);
646  path.lineTo(mr - ao - aw, mb);
647  }
648  move(qMin(pos.x() - sh.width() + ao, scr.right() - sh.width() - 2),
649  pos.y() - sh.height());
650  } else if (!arrowAtTop && arrowAtLeft) {
651  if (showArrow) {
652  path.lineTo(ao + aw, mb);
653  path.lineTo(ao, mb + ah);
654  path.lineTo(ao, mb);
655  }
656  move(qMax(pos.x() - ao, scr.x() + 2), pos.y() - sh.height());
657  }
658  path.lineTo(ml + rc, mb);
659  path.arcTo(QRect(ml, mb - rc*2, rc*2, rc*2), -90, -90);
660  path.lineTo(ml, mt + rc);
661  path.arcTo(QRect(ml, mt, rc*2, rc*2), 180, -90);
662 
663  // Set the mask
664  QBitmap bitmap = QBitmap(sizeHint());
665  bitmap.fill(Qt::color0);
666  QPainter painter1(&bitmap);
667  painter1.setPen(QPen(Qt::color1, border));
668  painter1.setBrush(QBrush(Qt::color1));
669  painter1.drawPath(path);
670  setMask(bitmap);
671 #endif
672 
673  // Draw the border
674  pixmap = QPixmap(sz);
675  QPainter painter2(&pixmap);
676  painter2.setPen(QPen(palette().color(QPalette::Window).darker(160), border));
677  painter2.setBrush(palette().color(QPalette::Window));
678  painter2.drawPath(path);
679 
680  if (msecs > 0)
681  timerId = startTimer(msecs);
682  show();
683 }
684 
686 {
687  close();
688  if(e->button() == Qt::LeftButton)
690 }
691 
693 {
694  if (e->timerId() == timerId) {
696  if (!underMouse())
697  close();
698  return;
699  }
701 }
702 
704 {
706 }
707 
709 
710 #endif // QT_NO_SYSTEMTRAYICON
QPoint pos() const
int startTimer(int interval)
Starts a timer and returns a timer identifier, or returns zero if it could not start a timer...
Definition: qobject.cpp:1623
The QPainter class performs low-level painting on widgets and other paint devices.
Definition: qpainter.h:86
void setIcon(const QIcon &icon)
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition: qcolor.h:67
double d
Definition: qnumeric_p.h:62
void setPointSize(int)
Sets the point size to pointSize.
Definition: qfont.cpp:1099
bool visible
whether the system tray entry is visible
void setFont(const QFont &)
Use the single-argument overload instead.
Definition: qwidget.cpp:4996
void drawPath(const QPainterPath &path)
Draws the given painter path using the current pen for outline and the current brush for filling...
Definition: qpainter.cpp:3502
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
Definition: qglobal.h:1215
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
void setTextFormat(Qt::TextFormat)
Definition: qlabel.cpp:1497
void setWordWrap(bool on)
Definition: qlabel.cpp:579
static int closeButtonSize
void setVisible(bool visible)
void setText(const QString &)
Definition: qlabel.cpp:366
The QPainterPath class provides a container for painting operations, enabling graphical shapes to be ...
Definition: qpainterpath.h:67
QRect geometry() const
Returns the geometry of the system tray icon in screen coordinates.
void setLayout(QLayout *)
Sets the layout manager for this widget to layout.
Definition: qwidget.cpp:10104
void showMessage(const QString &title, const QString &msg, MessageIcon icon=Information, int msecs=10000)
Shows a balloon message for the entry with the given title, message and icon for the time specified i...
virtual int pixelMetric(PixelMetric metric, const QStyleOption *option=0, const QWidget *widget=0) const =0
Returns the value of the given pixel metric.
static QBalloonTip * theSolitaryBalloonTip
#define SLOT(a)
Definition: qobjectdefs.h:226
virtual void timerEvent(QTimerEvent *)
This event handler can be reimplemented in a subclass to receive timer events for the object...
Definition: qobject.cpp:1294
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
int left() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:240
int width() const
Returns the width of the rectangle.
Definition: qrect.h:303
The QPushButton widget provides a command button.
Definition: qpushbutton.h:57
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
~QSystemTrayIcon()
Removes the icon from the system tray and frees all allocated resources.
QSize sizeHint() const
em>Reimplemented Function
Definition: qlabel.cpp:947
static void hideBalloon()
bool underMouse() const
Returns true if the widget is under the mouse cursor; otherwise returns false.
Definition: qwidget.h:996
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
The QObject class is the base class of all Qt objects.
Definition: qobject.h:111
virtual bool event(QEvent *)
This virtual function receives events to an object and should return true if the event e was recogniz...
Definition: qobject.cpp:1200
#define Q_D(Class)
Definition: qglobal.h:2482
void mousePressEvent(QMouseEvent *e)
This event handler, for event event, can be reimplemented in a subclass to receive mouse press events...
The QPen class defines how a QPainter should draw lines and outlines of shapes.
Definition: qpen.h:64
void moveTo(const QPointF &p)
Moves the current point to the given point, implicitly starting a new subpath and closing the previou...
void activated(QSystemTrayIcon::ActivationReason reason)
This signal is emitted when the user activates the system tray icon.
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
virtual QSize sizeHint() const
void setPixmap(const QPixmap &)
Definition: qlabel.cpp:439
static void showBalloon(QSystemTrayIcon::MessageIcon icon, const QString &title, const QString &msg, QSystemTrayIcon *trayIcon, const QPoint &pos, int timeout, bool showArrow=true)
QStyle * style() const
Definition: qwidget.cpp:2742
void lineTo(const QPointF &p)
Adds a straight line from the current position to the given endPoint.
#define SIGNAL(a)
Definition: qobjectdefs.h:227
The QBitmap class provides monochrome (1-bit depth) pixmaps.
Definition: qbitmap.h:55
int width() const
Returns the width.
Definition: qsize.h:126
void balloon(const QPoint &, int, bool)
QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *option=0, const QWidget *widget=0) const
Returns an icon for the given standardIcon.
Definition: qstyle.cpp:2327
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
void setBold(bool)
If enable is true sets the font&#39;s weight to QFont::Bold ; otherwise sets the weight to QFont::Normal...
Definition: qfont.h:352
void destroyed(QObject *=0)
This signal is emitted immediately before the object obj is destroyed, and can not be blocked...
QBalloonTip(QSystemTrayIcon::MessageIcon icon, const QString &title, const QString &msg, QSystemTrayIcon *trayIcon)
QIcon icon() const
void setMaximumWidth(int maxw)
Definition: qwidget.cpp:4343
bool isVisible() const
void timerEvent(QTimerEvent *e)
This event handler can be reimplemented in a subclass to receive timer events for the object...
friend class QPixmap
Definition: qwidget.h:748
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 isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
void resizeEvent(QResizeEvent *)
This event handler can be reimplemented in a subclass to receive widget resize events which are passe...
void setContentsMargins(int left, int top, int right, int bottom)
Sets the margins around the contents of the widget to have the sizes left, top, right, and bottom.
Definition: qwidget.cpp:7449
static bool isSystemTrayAvailable_sys()
QSize size() const
Returns the size of the rectangle.
Definition: qrect.h:309
#define emit
Definition: qobjectdefs.h:76
bool isNull() const
Returns true if the icon is empty; otherwise returns false.
Definition: qicon.cpp:769
const QPalette & palette() const
The QResizeEvent class contains event parameters for resize events.
Definition: qevent.h:349
Q_CORE_EXPORT void qWarning(const char *,...)
int timerId() const
Returns the unique timer identifier, which is the same identifier as returned from QObject::startTime...
Definition: qcoreevent.h:346
friend class QBalloonTip
QMenu * contextMenu() const
Returns the current context menu for the system tray entry.
static bool isSystemTrayAvailable()
Returns true if the system tray is available; otherwise returns false.
void show()
Shows the widget and its child widgets.
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
Qt::MouseButton button() const
Returns the button that caused the event.
Definition: qevent.h:101
QSystemTrayIcon * trayIcon
QRect rect() const
int heightForWidth(int) const
Reimplemented Function
Definition: qlabel.cpp:765
void hide()
Hides the widget.
Definition: qwidget.h:501
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).
void paintEvent(QPaintEvent *)
This event handler can be reimplemented in a subclass to receive paint events passed in event...
void fill(const QColor &fillColor=Qt::white)
Fills the pixmap with the given color.
Definition: qpixmap.cpp:1080
The QBrush class defines the fill pattern of shapes drawn by QPainter.
Definition: qbrush.h:76
bool event(QEvent *event)
Reimplemented Function
const QRect screenGeometry(int screen=-1) const
int right() const
Returns the x-coordinate of the rectangle&#39;s right edge.
Definition: qrect.h:246
The QMenu class provides a menu widget for use in menu bars, context menus, and other popup menus...
Definition: qmenu.h:72
The QTimerEvent class contains parameters that describe a timer event.
Definition: qcoreevent.h:341
void setFixedSize(const QSize &)
Sets both the minimum and maximum sizes of the widget to s, thereby preventing it from ever growing o...
Definition: qwidget.cpp:4284
void setMargin(int)
Definition: qlabel.cpp:654
The QFont class specifies a font used for drawing text.
Definition: qfont.h:64
void setContextMenu(QMenu *menu)
Sets the specified menu to be the context menu for the system tray icon.
void setIconSize(const QSize &size)
void arcTo(const QRectF &rect, qreal startAngle, qreal arcLength)
Creates an arc that occupies the given rectangle, beginning at the specified startAngle and extending...
int x() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:252
QObject * parent() const
Returns a pointer to the parent object.
Definition: qobject.h:273
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
void setColor(ColorGroup cg, ColorRole cr, const QColor &color)
Sets the color in the specified color group, used for the given color role, to the specified solid co...
Definition: qpalette.h:201
The QGridLayout class lays out widgets in a grid.
Definition: qgridlayout.h:60
void installEventFilter(QObject *)
Installs an event filter filterObj on this object.
Definition: qobject.cpp:2070
void setBrush(const QBrush &brush)
Sets the painter&#39;s brush to the given brush.
Definition: qpainter.cpp:4171
void setPen(const QColor &color)
Sets the painter&#39;s pen to have style Qt::SolidLine, width 0 and the specified color.
Definition: qpainter.cpp:4047
void setToolTip(const QString &tip)
int height() const
Returns the height.
Definition: qsize.h:129
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
Definition: qnamespace.h:54
ActivationReason
This enum describes the reason the system tray was activated.
The QLabel widget provides a text or image display.
Definition: qlabel.h:55
The QTextOption class provides a description of general rich text properties.
Definition: qtextoption.h:59
int y() const
Returns the y coordinate of this point.
Definition: qpoint.h:131
void setAttribute(Qt::WidgetAttribute, bool on=true)
Sets the attribute attribute on this widget if on is true; otherwise clears the attribute.
Definition: qwidget.cpp:11087
QPixmap pixmap(const QSize &size, Mode mode=Normal, State state=Off) const
Returns a pixmap with the requested size, mode, and state, generating one if necessary.
Definition: qicon.cpp:693
void drawPixmap(const QRectF &targetRect, const QPixmap &pixmap, const QRectF &sourceRect)
Draws the rectangular portion source of the given pixmap into the given target in the paint device...
Definition: qpainter.cpp:5619
void setWrapMode(WrapMode wrap)
Sets the option&#39;s text wrap mode to the given mode.
Definition: qtextoption.h:109
QLayout * layout() const
Returns the layout manager that is installed on this widget, or 0 if no layout manager is installed...
Definition: qwidget.cpp:10073
int pointSize() const
Returns the point size of the font.
Definition: qfont.cpp:981
const QFont & font() const
void setSizeConstraint(SizeConstraint)
Definition: qlayout.cpp:1435
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
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
void updateGeometry()
Notifies the layout system that this widget has changed and may need to change geometry.
Definition: qwidget.cpp:10372
void addWidget(QWidget *w)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: qgridlayout.h:116
MessageIcon
This enum describes the icon that is shown when a balloon message is displayed.
The QPaintEvent class contains event parameters for paint events.
Definition: qevent.h:298
static bool supportsMessages()
Returns true if the system tray supports balloon messages; otherwise returns false.
QString toolTip() const
void setSizePolicy(QSizePolicy)
Definition: qwidget.cpp:10198
void qtsystray_sendActivated(QSystemTrayIcon *i, int r)
void setMargin(int)
Definition: qlayout.cpp:464
void setIcon(const QIcon &icon)
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
QSystemTrayIcon(QObject *parent=0)
Constructs a QSystemTrayIcon object with the given parent.
void setAlignment(Qt::Alignment)
Without this function, a call to e.
Definition: qlabel.cpp:532
void setPalette(const QPalette &)
Use the single-argument overload instead.
Definition: qwidget.cpp:4858
static bool isBalloonVisible()
void move(int x, int y)
This corresponds to move(QPoint(x, y)).
Definition: qwidget.h:1011
The QSystemTrayIcon class provides an icon for an application in the system tray. ...
void messageClicked()
This signal is emitted when the message displayed using showMessage() was clicked by the user...
void killTimer(int id)
Kills the timer with timer identifier, id.
Definition: qobject.cpp:1650
The QPalette class contains color groups for each widget state.
Definition: qpalette.h:61
The QIcon class provides scalable icons in different modes and states.
Definition: qicon.h:60