コード例 #1
0
/**
 * @brief Send a popup through Growl.
 * @param icon The icon inside the notification. Currently ignored.
 * @param timeout The time in ms to show the notification.
 * @param title The title displayed inside the notification.
 * @param message The message displayed inside the notification.
 */
void NotifyByPopupGrowl::popup( const QPixmap *icon, int timeout,
                                const QString &title, const QString &message )
{
  Q_UNUSED( icon );

  QSystemTrayIcon i;
  i.show();
  i.showMessage( title, message,
                 QSystemTrayIcon::Information, timeout );
  i.hide();
}
コード例 #2
0
ファイル: tst_qsystemtrayicon.cpp プロジェクト: husninazer/qt
// Testing get/set functions
void tst_QSystemTrayIcon::showMessage()
{
    QSystemTrayIcon icon;
    icon.setIcon(QIcon("icons/icon.png"));

    icon.showMessage("Title", "Messagecontents");
    icon.showMessage("Title", "Messagecontents", QSystemTrayIcon::NoIcon);
    icon.showMessage("Title", "Messagecontents", QSystemTrayIcon::Warning);
    icon.showMessage("Title", "Messagecontents", QSystemTrayIcon::Critical);

    icon.show();
    icon.showMessage("Title", "Messagecontents");
    icon.showMessage("Title", "Messagecontents", QSystemTrayIcon::NoIcon);
    icon.showMessage("Title", "Messagecontents", QSystemTrayIcon::Warning);
    icon.showMessage("Title", "Messagecontents", QSystemTrayIcon::Critical);
}
コード例 #3
0
	void CNotificationManager::showMessage(QString title, QString message, QObject * reciever, const char * slot, CUIDevice * uiDevice) {
		if (!m_NotificationsEnabled)
			return;
		
		QString titleResult = tr("QNUT");
		QSystemTrayIcon * trayIcon;
		if (uiDevice && m_UIDeviceIcons.contains(uiDevice) && m_UIDeviceIcons[uiDevice]->isVisible()) {
			trayIcon = m_UIDeviceIcons[uiDevice];
			titleResult += " (" + uiDevice->device()->getName() + ')';
		}
		else
			trayIcon = m_MainIcon;
		
		if (!title.isEmpty())
			titleResult += " - " + title;
		
		disconnect(trayIcon, SIGNAL(messageClicked()), NULL, NULL);
		if (reciever)
			connect(trayIcon, SIGNAL(messageClicked()), reciever, slot);
		trayIcon->showMessage(titleResult, message, QSystemTrayIcon::Information, 4000);
	}