Following is the updated code. Its working fine now.
#include "dialog.h"
#include "ui_dialog.h"
: QDialog(parent
), ui
(new Ui
::Dialog) {
ui->setupUi(this);
QIcon icon
(":/resource/Test.jpg");
m_ptrTrayIcon->setToolTip( tr( "Bubble Message" ) );
m_ptrTrayIcon->show();
m_ptrTrayIcon->setIcon(icon);
// m_ptrTrayIcon->setContextMenu(m_trayIconMenu);
}
Dialog::~Dialog()
{
delete ui;
}
void Dialog::on_pushButton_clicked()
{
ShowMessage();
//m_ptrTrayIcon->show();
}
void Dialog::ShowMessage()
{
m_ptrTrayIcon
->showMessage
("Hello",
"World",
QSystemTrayIcon::Critical,
151000);
}
#include "dialog.h"
#include "ui_dialog.h"
Dialog::Dialog(QWidget *parent)
: QDialog(parent), ui(new Ui::Dialog)
{
ui->setupUi(this);
QIcon icon(":/resource/Test.jpg");
m_ptrTrayIcon = new QSystemTrayIcon(this);
m_ptrTrayIcon->setToolTip( tr( "Bubble Message" ) );
m_ptrTrayIcon->show();
m_ptrTrayIcon->setIcon(icon);
// m_ptrTrayIcon->setContextMenu(m_trayIconMenu);
}
Dialog::~Dialog()
{
delete ui;
}
void Dialog::on_pushButton_clicked()
{
ShowMessage();
//m_ptrTrayIcon->show();
QDialog::accept();
}
void Dialog::ShowMessage()
{
m_ptrTrayIcon->showMessage("Hello", "World", QSystemTrayIcon::Critical, 151000);
}
To copy to clipboard, switch view to plain text mode
Bookmarks