45 #ifndef QT_NO_SYSTEMTRAYICON 59 #include "private/qlabel_p.h" 230 d->toolTip = tooltip;
231 d->updateToolTip_sys();
276 return d->geometry_sys();
292 if (visible ==
d->visible)
295 qWarning(
"QSystemTrayIcon::setVisible: No Icon set");
314 #if defined(Q_WS_X11) 317 return d->sys->deliverToolTipEvent(e);
426 d->showMessage_sys(title, msg, icon, msecs);
434 const QPoint& pos,
int timeout,
bool showArrow)
440 theSolitaryBalloonTip =
new QBalloonTip(icon, title, message, trayIcon);
443 theSolitaryBalloonTip->
balloon(pos, timeout, showArrow);
448 if (!theSolitaryBalloonTip)
450 theSolitaryBalloonTip->
hide();
452 theSolitaryBalloonTip = 0;
482 const int iconSize = 18;
483 const int closeButtonSize = 15;
490 closeButton->
setFixedSize(closeButtonSize, closeButtonSize);
512 msgLabel->d_func()->ensureTextControl();
513 if (
QTextControl *control = msgLabel->d_func()->control) {
514 QTextOption opt = control->document()->defaultTextOption();
516 control->document()->setDefaultTextOption(opt);
555 layout->
addWidget(titleLabel, 0, 0, 1, 2);
572 theSolitaryBalloonTip = 0;
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);
603 mb = sz.
height() - ah - 1;
612 #if defined(QT_NO_XSHAPE) && defined(Q_WS_X11) 623 if (arrowAtTop && arrowAtLeft) {
626 path.
lineTo(ml + ao, mt - ah);
627 path.
lineTo(ml + ao + aw, mt);
630 }
else if (arrowAtTop && !arrowAtLeft) {
632 path.
lineTo(mr - ao - aw, mt);
633 path.
lineTo(mr - ao, mt - ah);
639 path.
arcTo(
QRect(mr - rc*2, mt, rc*2, rc*2), 90, -90);
641 path.
arcTo(
QRect(mr - rc*2, mb - rc*2, rc*2, rc*2), 0, -90);
642 if (!arrowAtTop && !arrowAtLeft) {
645 path.
lineTo(mr - ao, mb + ah);
646 path.
lineTo(mr - ao - aw, mb);
650 }
else if (!arrowAtTop && arrowAtLeft) {
659 path.
arcTo(
QRect(ml, mb - rc*2, rc*2, rc*2), -90, -90);
661 path.
arcTo(
QRect(ml, mt, rc*2, rc*2), 180, -90);
710 #endif // QT_NO_SYSTEMTRAYICON
int startTimer(int interval)
Starts a timer and returns a timer identifier, or returns zero if it could not start a timer...
The QPainter class performs low-level painting on widgets and other paint devices.
void setIcon(const QIcon &icon)
The QColor class provides colors based on RGB, HSV or CMYK values.
void setPointSize(int)
Sets the point size to pointSize.
bool visible
whether the system tray entry is visible
void drawPath(const QPainterPath &path)
Draws the given painter path using the current pen for outline and the current brush for filling...
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
#define QT_END_NAMESPACE
This macro expands to.
void setTextFormat(Qt::TextFormat)
void setWordWrap(bool on)
static int closeButtonSize
void setVisible(bool visible)
void setText(const QString &)
The QPainterPath class provides a container for painting operations, enabling graphical shapes to be ...
QRect geometry() const
Returns the geometry of the system tray icon in screen coordinates.
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
virtual void timerEvent(QTimerEvent *)
This event handler can be reimplemented in a subclass to receive timer events for the object...
int left() const
Returns the x-coordinate of the rectangle's left edge.
int width() const
Returns the width of the rectangle.
~QSystemTrayIcon()
Removes the icon from the system tray and frees all allocated resources.
QSize sizeHint() const
em>Reimplemented Function
static void hideBalloon()
int height() const
Returns the height of the rectangle.
The QString class provides a Unicode character string.
The QObject class is the base class of all Qt objects.
virtual bool event(QEvent *)
This virtual function receives events to an object and should return true if the event e was recogniz...
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.
static bool supportsMessages_sys()
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)
void setPixmap(const QPixmap &)
static void showBalloon(QSystemTrayIcon::MessageIcon icon, const QString &title, const QString &msg, QSystemTrayIcon *trayIcon, const QPoint &pos, int timeout, bool showArrow=true)
void lineTo(const QPointF &p)
Adds a straight line from the current position to the given endPoint.
The QBitmap class provides monochrome (1-bit depth) pixmaps.
int width() const
Returns the width.
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.
#define QT_BEGIN_NAMESPACE
This macro expands to.
void setBold(bool)
If enable is true sets the font's weight to QFont::Bold ; otherwise sets the weight to QFont::Normal...
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)
void timerEvent(QTimerEvent *e)
This event handler can be reimplemented in a subclass to receive timer events for the object...
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...
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
void resizeEvent(QResizeEvent *)
This event handler can be reimplemented in a subclass to receive widget resize events which are passe...
static bool isSystemTrayAvailable_sys()
QSize size() const
Returns the size of the rectangle.
bool isNull() const
Returns true if the icon is empty; otherwise returns false.
The QResizeEvent class contains event parameters for resize events.
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...
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.
Qt::MouseButton button() const
Returns the button that caused the event.
QSystemTrayIcon * trayIcon
int heightForWidth(int) const
Reimplemented Function
The QMouseEvent class contains parameters that describe a mouse event.
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.
The QBrush class defines the fill pattern of shapes drawn by QPainter.
bool event(QEvent *event)
Reimplemented Function
int right() const
Returns the x-coordinate of the rectangle's right edge.
The QTimerEvent class contains parameters that describe a timer event.
The QFont class specifies a font used for drawing text.
void setContextMenu(QMenu *menu)
Sets the specified menu to be the context menu for the system tray icon.
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's left edge.
QObject * parent() const
Returns a pointer to the parent object.
The QPoint class defines a point in the plane using integer precision.
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...
The QGridLayout class lays out widgets in a grid.
void installEventFilter(QObject *)
Installs an event filter filterObj on this object.
void setBrush(const QBrush &brush)
Sets the painter's brush to the given brush.
void setPen(const QColor &color)
Sets the painter's pen to have style Qt::SolidLine, width 0 and the specified color.
void setToolTip(const QString &tip)
int height() const
Returns the height.
The QRect class defines a rectangle in the plane using integer precision.
ActivationReason
This enum describes the reason the system tray was activated.
The QLabel widget provides a text or image display.
The QTextOption class provides a description of general rich text properties.
int y() const
Returns the y coordinate of this point.
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.
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...
void setWrapMode(WrapMode wrap)
Sets the option's text wrap mode to the given mode.
int pointSize() const
Returns the point size of the font.
void setSizeConstraint(SizeConstraint)
The QSize class defines the size of a two-dimensional object using integer point precision.
int x() const
Returns the x coordinate of this point.
void addWidget(QWidget *w)
This is an overloaded member function, provided for convenience. It differs from the above function o...
MessageIcon
This enum describes the icon that is shown when a balloon message is displayed.
The QPaintEvent class contains event parameters for paint events.
static bool supportsMessages()
Returns true if the system tray supports balloon messages; otherwise returns false.
void qtsystray_sendActivated(QSystemTrayIcon *i, int r)
The QEvent class is the base class of all event classes.
Type type() const
Returns the event type.
QSystemTrayIcon(QObject *parent=0)
Constructs a QSystemTrayIcon object with the given parent.
void setAlignment(Qt::Alignment)
Without this function, a call to e.
static bool isBalloonVisible()
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.
The QPalette class contains color groups for each widget state.
The QIcon class provides scalable icons in different modes and states.