Qt 4.8
qsystemtrayicon_mac.mm
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 /****************************************************************************
43 **
44 ** Copyright (c) 2007-2008, Apple, Inc.
45 **
46 ** All rights reserved.
47 **
48 ** Redistribution and use in source and binary forms, with or without
49 ** modification, are permitted provided that the following conditions are met:
50 **
51 ** * Redistributions of source code must retain the above copyright notice,
52 ** this list of conditions and the following disclaimer.
53 **
54 ** * Redistributions in binary form must reproduce the above copyright notice,
55 ** this list of conditions and the following disclaimer in the documentation
56 ** and/or other materials provided with the distribution.
57 **
58 ** * Neither the name of Apple, Inc. nor the names of its contributors
59 ** may be used to endorse or promote products derived from this software
60 ** without specific prior written permission.
61 **
62 ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
63 ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
64 ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
65 ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
66 ** CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
67 ** EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
68 ** PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
69 ** PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
70 ** LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
71 ** NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
72 ** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
73 **
74 ****************************************************************************/
75 
76 #define QT_MAC_SYSTEMTRAY_USE_GROWL
77 
78 #include <private/qt_cocoa_helpers_mac_p.h>
79 #include <private/qsystemtrayicon_p.h>
80 #include <qtemporaryfile.h>
81 #include <qimagewriter.h>
82 #include <qapplication.h>
83 #include <qdebug.h>
84 #include <qstyle.h>
85 
86 #include <private/qt_mac_p.h>
87 #import <AppKit/AppKit.h>
88 
90 extern bool qt_mac_execute_apple_script(const QString &script, AEDesc *ret); //qapplication_mac.cpp
91 extern void qtsystray_sendActivated(QSystemTrayIcon *i, int r); //qsystemtrayicon.cpp
92 extern NSString *keySequenceToKeyEqivalent(const QKeySequence &accel); // qmenu_mac.mm
93 extern NSUInteger keySequenceModifierMask(const QKeySequence &accel); // qmenu_mac.mm
94 extern Qt::MouseButton cocoaButton2QtButton(NSInteger buttonNum);
96 
98 
101 
102 @interface QT_MANGLE_NAMESPACE(QNSStatusItem) : NSObject {
103  NSStatusItem *item;
107 }
108 -(id)initWithIcon:(QSystemTrayIcon*)icon iconPrivate:(QSystemTrayIconPrivate *)iprivate;
109 -(void)dealloc;
110 -(QSystemTrayIcon*)icon;
111 -(NSStatusItem*)item;
112 -(QRectF)geometry;
113 - (void)triggerSelector:(id)sender button:(Qt::MouseButton)mouseButton;
114 - (void)doubleClickSelector:(id)sender;
115 @end
116 
117 @interface QT_MANGLE_NAMESPACE(QNSImageView) : NSImageView {
118  BOOL down;
120 }
121 -(id)initWithParent:(QT_MANGLE_NAMESPACE(QNSStatusItem)*)myParent;
122 -(QSystemTrayIcon*)icon;
123 -(void)menuTrackingDone:(NSNotification*)notification;
124 -(void)mousePressed:(NSEvent *)mouseEvent button:(Qt::MouseButton)mouseButton;
125 @end
126 
127 
128 #if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_5
129 
130 @protocol NSMenuDelegate <NSObject>
131 -(void)menuNeedsUpdate:(NSMenu*)menu;
132 @end
133 #endif
134 
135 
136 @interface QT_MANGLE_NAMESPACE(QNSMenu) : NSMenu <NSMenuDelegate> {
138 }
139 -(QMenu*)menu;
140 -(id)initWithQMenu:(QMenu*)qmenu;
141 -(void)selectedAction:(id)item;
142 @end
143 
146 {
147 public:
150  item = [[QT_MANGLE_NAMESPACE(QNSStatusItem) alloc] initWithIcon:icon iconPrivate:d];
151  }
154  [[[item item] view] setHidden: YES];
155  [item release];
156  }
158 };
159 
161 {
163  if (!sys) {
164  sys = new QSystemTrayIconSys(q, this);
165  updateIcon_sys();
166  updateMenu_sys();
167  updateToolTip_sys();
168  }
169 }
170 
172 {
173  if(sys) {
174  const QRectF geom = [sys->item geometry];
175  if(!geom.isNull())
176  return geom.toRect();
177  }
178  return QRect();
179 }
180 
182 {
183  delete sys;
184  sys = 0;
185 }
186 
188 {
189  if(sys && !icon.isNull()) {
191 #ifndef QT_MAC_USE_COCOA
192  const short scale = GetMBarHeight()-4;
193 #else
194  CGFloat hgt = [[[NSApplication sharedApplication] mainMenu] menuBarHeight];
195  const short scale = hgt - 4;
196 #endif
197  NSImage *nsimage = static_cast<NSImage *>(qt_mac_create_nsimage(icon.pixmap(QSize(scale, scale))));
198  [(NSImageView*)[[sys->item item] view] setImage: nsimage];
199  [nsimage release];
200  }
201 }
202 
204 {
205  if(sys) {
207  if(menu && !menu->isEmpty()) {
208  [[sys->item item] setHighlightMode:YES];
209  } else {
210  [[sys->item item] setHighlightMode:NO];
211  }
212  }
213 }
214 
216 {
217  if(sys) {
219  QCFString string(toolTip);
220  [[[sys->item item] view] setToolTip:(NSString*)static_cast<CFStringRef>(string)];
221  }
222 }
223 
225 {
226  return true;
227 }
228 
230 {
231  return true;
232 }
233 
235 {
236 
237  if(sys) {
238 #ifdef QT_MAC_SYSTEMTRAY_USE_GROWL
239  // Make sure that we have Growl installed on the machine we are running on.
240  QCFType<CFURLRef> cfurl;
241  OSStatus status = LSGetApplicationForInfo(kLSUnknownType, kLSUnknownCreator,
242  CFSTR("growlTicket"), kLSRolesAll, 0, &cfurl);
243  if (status == kLSApplicationNotFoundErr)
244  return;
245  QCFType<CFBundleRef> bundle = CFBundleCreate(0, cfurl);
246 
247  if (CFStringCompare(CFBundleGetIdentifier(bundle), CFSTR("com.Growl.GrowlHelperApp"),
248  kCFCompareCaseInsensitive | kCFCompareBackwards) != kCFCompareEqualTo)
249  return;
250  QPixmap notificationIconPixmap;
251  if(icon == QSystemTrayIcon::Information)
253  else if(icon == QSystemTrayIcon::Warning)
255  else if(icon == QSystemTrayIcon::Critical)
257  QTemporaryFile notificationIconFile;
258  QString notificationType(QLatin1String("Notification")), notificationIcon, notificationApp(QApplication::applicationName());
259  if(notificationApp.isEmpty())
260  notificationApp = QLatin1String("Application");
261  if(!notificationIconPixmap.isNull() && notificationIconFile.open()) {
262  QImageWriter writer(&notificationIconFile, "PNG");
263  if(writer.write(notificationIconPixmap.toImage()))
264  notificationIcon = QLatin1String("image from location \"file://") + notificationIconFile.fileName() + QLatin1String("\"");
265  }
267  "tell application \"GrowlHelperApp\"\n"
268  "-- Make a list of all the notification types (all)\n"
269  "set the allNotificationsList to {\"") + notificationType + QLatin1String("\"}\n"
270 
271  "-- Make a list of the notifications (enabled)\n"
272  "set the enabledNotificationsList to {\"") + notificationType + QLatin1String("\"}\n"
273 
274  "-- Register our script with growl.\n"
275  "register as application \"") + notificationApp + QLatin1String("\" all notifications allNotificationsList default notifications enabledNotificationsList\n"
276 
277  "-- Send a Notification...\n") +
278  QLatin1String("notify with name \"") + notificationType +
279  QLatin1String("\" title \"") + title +
280  QLatin1String("\" description \"") + message +
281  QLatin1String("\" application name \"") + notificationApp +
282  QLatin1String("\" ") + notificationIcon +
283  QLatin1String("\nend tell"));
284  qt_mac_execute_apple_script(script, 0);
285 #elif 0
287  NSView *v = [[sys->item item] view];
288  NSWindow *w = [v window];
289  w = [[sys->item item] window];
290  qDebug() << w << v;
291  QPoint p(qRound([w frame].origin.x), qRound([w frame].origin.y));
292  qDebug() << p;
293  QBalloonTip::showBalloon(icon, message, title, q, QPoint(0, 0), msecs);
294 #else
295  Q_UNUSED(icon);
296  Q_UNUSED(title);
297  Q_UNUSED(message);
298 #endif
299  }
300 }
302 
303 @implementation NSStatusItem (Qt)
304 @end
305 
306 @implementation QT_MANGLE_NAMESPACE(QNSImageView)
307 -(id)initWithParent:(QT_MANGLE_NAMESPACE(QNSStatusItem)*)myParent {
308  self = [super init];
309  parent = myParent;
310  down = NO;
311  return self;
312 }
313 
315  return [parent icon];
316 }
317 
318 -(void)menuTrackingDone:(NSNotification*)notification
319 {
320  Q_UNUSED(notification);
321  down = NO;
322 
323  if( ![self icon]->icon().isNull() ) {
324 #ifndef QT_MAC_USE_COCOA
325  const short scale = GetMBarHeight()-4;
326 #else
327  CGFloat hgt = [[[NSApplication sharedApplication] mainMenu] menuBarHeight];
328  const short scale = hgt - 4;
329 #endif
330  NSImage *nsimage = static_cast<NSImage *>(qt_mac_create_nsimage([self icon]->icon().pixmap(QSize(scale, scale))));
331  [self setImage: nsimage];
332  [nsimage release];
333  }
334 
335  if([self icon]->contextMenu())
336  [self icon]->contextMenu()->hide();
337 
338  [self setNeedsDisplay:YES];
339 }
340 
341 -(void)mousePressed:(NSEvent *)mouseEvent button:(Qt::MouseButton)mouseButton
342 {
343  down = YES;
344  int clickCount = [mouseEvent clickCount];
345  [self setNeedsDisplay:YES];
346 
347 #ifndef QT_MAC_USE_COCOA
348  const short scale = GetMBarHeight()-4;
349 #else
350  CGFloat hgt = [[[NSApplication sharedApplication] mainMenu] menuBarHeight];
351  const short scale = hgt - 4;
352 #endif
353 
354  if (![self icon]->icon().isNull() ) {
355  NSImage *nsaltimage = static_cast<NSImage *>(qt_mac_create_nsimage([self icon]->icon().pixmap(QSize(scale, scale), QIcon::Selected)));
356  [self setImage: nsaltimage];
357  [nsaltimage release];
358  }
359 
360  if ((clickCount == 2)) {
361  [self menuTrackingDone:nil];
363  } else {
364  [parent triggerSelector:self button:mouseButton];
365  }
366 }
367 
368 -(void)mouseDown:(NSEvent *)mouseEvent
369 {
370  [self mousePressed:mouseEvent button:Qt::LeftButton];
371 }
372 
373 -(void)mouseUp:(NSEvent *)mouseEvent
374 {
376  [self menuTrackingDone:nil];
377 }
378 
379 - (void)rightMouseDown:(NSEvent *)mouseEvent
380 {
381  [self mousePressed:mouseEvent button:Qt::RightButton];
382 }
383 
384 -(void)rightMouseUp:(NSEvent *)mouseEvent
385 {
387  [self menuTrackingDone:nil];
388 }
389 
390 - (void)otherMouseDown:(NSEvent *)mouseEvent
391 {
392  [self mousePressed:mouseEvent button:cocoaButton2QtButton([mouseEvent buttonNumber])];
393 }
394 
395 -(void)otherMouseUp:(NSEvent *)mouseEvent
396 {
398  [self menuTrackingDone:nil];
399 }
400 
401 -(void)drawRect:(NSRect)rect {
402  [[parent item] drawStatusBarBackgroundInRect:rect withHighlight:down];
403  [super drawRect:rect];
404 }
405 @end
406 
407 @implementation QT_MANGLE_NAMESPACE(QNSStatusItem)
408 
409 -(id)initWithIcon:(QSystemTrayIcon*)i iconPrivate:(QSystemTrayIconPrivate *)iPrivate
410 {
411  self = [super init];
412  if(self) {
413  icon = i;
414  iconPrivate = iPrivate;
415  item = [[[NSStatusBar systemStatusBar] statusItemWithLength:NSSquareStatusItemLength] retain];
416  imageCell = [[QT_MANGLE_NAMESPACE(QNSImageView) alloc] initWithParent:self];
417  [item setView: imageCell];
418  }
419  return self;
420 }
421 -(void)dealloc {
422  [[NSStatusBar systemStatusBar] removeStatusItem:item];
423  [imageCell release];
424  [item release];
425  [super dealloc];
426 
427 }
428 
429 -(QSystemTrayIcon*)icon {
430  return icon;
431 }
432 
433 -(NSStatusItem*)item {
434  return item;
435 }
436 -(QRectF)geometry {
437  if(NSWindow *window = [[item view] window]) {
438  NSRect screenRect = [[window screen] frame];
439  NSRect windowRect = [window frame];
440  return QRectF(windowRect.origin.x, screenRect.size.height-windowRect.origin.y-windowRect.size.height, windowRect.size.width, windowRect.size.height);
441  }
442  return QRectF();
443 }
444 
445 - (void)triggerSelector:(id)sender button:(Qt::MouseButton)mouseButton {
446  Q_UNUSED(sender);
447  if (!icon)
448  return;
449 
450  if (mouseButton == Qt::MidButton)
452  else
454 
455  if (icon->contextMenu()) {
456 #ifndef QT_MAC_USE_COCOA
457  [[[self item] view] removeAllToolTips];
458  iconPrivate->updateToolTip_sys();
459 #endif
460  NSMenu *m = [[QT_MANGLE_NAMESPACE(QNSMenu) alloc] initWithQMenu:icon->contextMenu()];
461  [m setAutoenablesItems: NO];
462  [[NSNotificationCenter defaultCenter] addObserver:imageCell
463  selector:@selector(menuTrackingDone:)
464  name:NSMenuDidEndTrackingNotification
465  object:m];
466  [item popUpStatusItemMenu: m];
467  [m release];
468  }
469 }
470 
471 - (void)doubleClickSelector:(id)sender {
472  Q_UNUSED(sender);
473  if(!icon)
474  return;
476 }
477 
478 @end
479 
481 {
482 public:
483  void doAboutToShow() { emit aboutToShow(); }
484 private:
486 };
487 
488 @implementation QT_MANGLE_NAMESPACE(QNSMenu)
489 -(id)initWithQMenu:(QMenu*)qm {
490  self = [super init];
491  if(self) {
492  self->qmenu = qm;
493  [self setDelegate:self];
494  }
495  return self;
496 }
497 -(QMenu*)menu {
498  return qmenu;
499 }
500 -(void)menuNeedsUpdate:(NSMenu*)nsmenu {
501  QT_MANGLE_NAMESPACE(QNSMenu) *menu = static_cast<QT_MANGLE_NAMESPACE(QNSMenu) *>(nsmenu);
502  emit static_cast<QSystemTrayIconQMenu*>(menu->qmenu)->doAboutToShow();
503  for(int i = [menu numberOfItems]-1; i >= 0; --i)
504  [menu removeItemAtIndex:i];
505  QList<QAction*> actions = menu->qmenu->actions();;
506  for(int i = 0; i < actions.size(); ++i) {
507  const QAction *action = actions[i];
508  if(!action->isVisible())
509  continue;
510 
511  NSMenuItem *item = 0;
512  bool needRelease = false;
513  if(action->isSeparator()) {
514  item = [NSMenuItem separatorItem];
515  } else {
516  item = [[NSMenuItem alloc] init];
517  needRelease = true;
518  QString text = action->text();
519  QKeySequence accel = action->shortcut();
520  {
521  int st = text.lastIndexOf(QLatin1Char('\t'));
522  if(st != -1) {
523  accel = QKeySequence(text.right(text.length()-(st+1)));
524  text.remove(st, text.length()-st);
525  }
526  }
527  if(accel.count() > 1)
528  text += QLatin1String(" (****)"); //just to denote a multi stroke shortcut
529 
530  [item setTitle:(NSString*)QCFString::toCFStringRef(qt_mac_removeMnemonics(text))];
531  [item setEnabled:menu->qmenu->isEnabled() && action->isEnabled()];
532  [item setState:action->isChecked() ? NSOnState : NSOffState];
533  [item setToolTip:(NSString*)QCFString::toCFStringRef(action->toolTip())];
534  const QIcon icon = action->icon();
535  if(!icon.isNull()) {
536 #ifndef QT_MAC_USE_COCOA
537  const short scale = GetMBarHeight();
538 #else
539  const short scale = [[NSApp mainMenu] menuBarHeight];
540 #endif
541  NSImage *nsimage = static_cast<NSImage *>(qt_mac_create_nsimage(icon.pixmap(QSize(scale, scale))));
542  [item setImage: nsimage];
543  [nsimage release];
544  }
545  if(action->menu()) {
546  QT_MANGLE_NAMESPACE(QNSMenu) *sub = [[QT_MANGLE_NAMESPACE(QNSMenu) alloc] initWithQMenu:action->menu()];
547  [item setSubmenu:sub];
548  } else {
549  [item setAction:@selector(selectedAction:)];
550  [item setTarget:self];
551  }
552  if(!accel.isEmpty()) {
553  [item setKeyEquivalent:keySequenceToKeyEqivalent(accel)];
554  [item setKeyEquivalentModifierMask:keySequenceModifierMask(accel)];
555  }
556  }
557  if(item)
558  [menu addItem:item];
559  if (needRelease)
560  [item release];
561  }
562 }
563 -(void)selectedAction:(id)a {
564  const int activated = [self indexOfItem:a];
565  QAction *action = 0;
566  QList<QAction*> actions = qmenu->actions();
567  for(int i = 0, cnt = 0; i < actions.size(); ++i) {
568  if(actions.at(i)->isVisible() && (cnt++) == activated) {
569  action = actions.at(i);
570  break;
571  }
572  }
573  if(action) {
574  action->activate(QAction::Trigger);
575  }
576 }
577 @end
578 
bool isSeparator() const
Returns true if this action is a separator action; otherwise it returns false.
Definition: qaction.cpp:839
double d
Definition: qnumeric_p.h:62
QImage toImage() const
Converts the pixmap to a QImage.
Definition: qpixmap.cpp:542
void showMessage_sys(const QString &msg, const QString &title, QSystemTrayIcon::MessageIcon icon, int secs)
bool qt_mac_execute_apple_script(const QString &script, AEDesc *ret)
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
QKeySequence shortcut
the action&#39;s primary shortcut key
Definition: qaction.h:83
void activate(ActionEvent event)
Sends the relevant signals for ActionEvent event.
Definition: qaction.cpp:1326
Qt::MouseButton cocoaButton2QtButton(NSInteger buttonNum)
int length() const
Returns the number of characters in this string.
Definition: qstring.h:696
The QTemporaryFile class is an I/O device that operates on temporary files.
QString text
the action&#39;s descriptive text
Definition: qaction.h:76
void qtsystray_sendActivated(QSystemTrayIcon *i, int r)
QNSStatusItem * parent
static LibLoadStatus status
Definition: qlocale_icu.cpp:69
bool open()
A QTemporaryFile will always be opened in QIODevice::ReadWrite mode, this allows easy access to the d...
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
void * qt_mac_create_nsimage(const QPixmap &pm)
static QStyle * style()
Returns the application&#39;s style object.
QSystemTrayIcon * q
void menuTrackingDone:(NSNotification *notification)
The QString class provides a Unicode character string.
Definition: qstring.h:83
void mousePressed:button:(NSEvent *mouseEvent, [button] Qt::MouseButton mouseButton)
static void showBalloon(QSystemTrayIcon::MessageIcon icon, const QString &title, const QString &msg, QSystemTrayIcon *trayIcon, const QPoint &pos, int timeout, bool showArrow=true)
#define Q_Q(Class)
Definition: qglobal.h:2483
void NSMenuItem
Definition: qmenu_p.h:80
bool isVisible() const
Definition: qaction.cpp:1246
Q_CORE_EXPORT void qDebug(const char *,...)
NSWindow * window
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
The QRectF class defines a rectangle in the plane using floating point precision. ...
Definition: qrect.h:511
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
The QImageWriter class provides a format independent interface for writing images to files or other d...
Definition: qimagewriter.h:59
static bool isSystemTrayAvailable_sys()
void doubleClickSelector:(id sender)
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
#define emit
Definition: qobjectdefs.h:76
bool isNull() const
Returns true if the icon is empty; otherwise returns false.
Definition: qicon.cpp:769
NSStatusItem * item
QSystemTrayIconPrivate * iconPrivate
QIcon icon
the action&#39;s icon
Definition: qaction.h:75
QMenu * contextMenu() const
Returns the current context menu for the system tray entry.
QString right(int n) const Q_REQUIRED_RESULT
Returns a substring that contains the n rightmost characters of the string.
Definition: qstring.cpp:3682
NSUInteger keySequenceModifierMask(const QKeySequence &accel)
Definition: qmenu_mac.mm:1265
QSystemTrayIconSys * sys
signed long OSStatus
bool isEmpty() const
Returns true if the key sequence is empty; otherwise returns false.
QRect toRect() const
Returns a QRect based on the values of this rectangle.
Definition: qrect.h:845
Q_CORE_EXPORT int QT_FASTCALL script(uint ucs4)
QMenu * menu() const
Returns the menu contained by this action.
Definition: qaction.cpp:793
QString toolTip() const
The QKeySequence class encapsulates a key sequence as used by shortcuts.
Definition: qkeysequence.h:72
The QMenu class provides a menu widget for use in menu bars, context menus, and other popup menus...
Definition: qmenu.h:72
#define QT_MANGLE_NAMESPACE(name)
Definition: qglobal.h:106
int lastIndexOf(QChar c, int from=-1, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Definition: qstring.cpp:3000
#define st(var, type, card)
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
QString fileName() const
Returns the complete unique filename backing the QTemporaryFile object.
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
QList< QAction * > actions() const
Returns the (possibly empty) list of this widget&#39;s actions.
Definition: qwidget.cpp:3407
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
Definition: qnamespace.h:54
void triggerSelector:button:(id sender, [button] Qt::MouseButton mouseButton)
uint count() const
Returns the number of keys in the key sequence.
NSString * keySequenceToKeyEqivalent(const QKeySequence &accel)
Definition: qmenu_mac.mm:1254
static void mouseEvent(MouseAction action, QWidget *widget, Qt::MouseButton button, Qt::KeyboardModifiers stateKey, QPoint pos, int delay=-1)
Definition: qtestmouse.h:71
#define QT_USE_NAMESPACE
This macro expands to using QT_NAMESPACE if QT_NAMESPACE is defined and nothing otherwise.
Definition: qglobal.h:88
The QPixmap class is an off-screen image representation that can be used as a paint device...
Definition: qpixmap.h:71
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
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
static QString applicationName()
QString & remove(int i, int len)
Removes n characters from the string, starting at the given position index, and returns a reference t...
Definition: qstring.cpp:1867
bool isNull() const
Returns true if this is a null pixmap; otherwise returns false.
Definition: qpixmap.cpp:615
MessageIcon
This enum describes the icon that is shown when a balloon message is displayed.
const QRect & geometry() const
bool write(const QImage &image)
Writes the image image to the assigned device or file name.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729
QSystemTrayIconSys(QSystemTrayIcon *icon, QSystemTrayIconPrivate *d)
bool isNull() const
Returns true if the rectangle is a null rectangle, otherwise returns false.
Definition: qrect.h:655
virtual QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt=0, const QWidget *widget=0) const =0
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:55
Q_DECL_CONSTEXPR int qRound(qreal d)
Definition: qglobal.h:1203
The QAction class provides an abstract user interface action that can be inserted into widgets...
Definition: qaction.h:64
static bool isNull(const QVariant::Private *d)
Definition: qvariant.cpp:300
#define text
Definition: qobjectdefs.h:80
The QSystemTrayIcon class provides an icon for an application in the system tray. ...
The QList class is a template class that provides lists.
Definition: qdatastream.h:62
QNSImageView * imageCell
float CGFloat
MouseButton
Definition: qnamespace.h:150
QSystemTrayIcon * icon
The QIcon class provides scalable icons in different modes and states.
Definition: qicon.h:60