Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Issue with system tray icon
mangz007 last edited by
I need your help in solving my issue. First of all I am new to Qt. Learning using the examples. I came across an issue with system tray icon. I was able to add the system tray icon. But when I run the project, it shows only for some 2 in 10 times. In other words I should say it show only some time. Need help. Below is my code
MainWindow::MainWindow(QWidget *parent) :
minimizeAction = new QAction(tr("Mi&nimize to tray"), this);
connect(minimizeAction, SIGNAL(triggered()), this, SLOT(hide()));
restoreAction = new QAction(tr("&Restore"), this); connect(restoreAction, SIGNAL(triggered()), this, SLOT(showNormal())); quitAction = new QAction(tr("&Quit"), this); connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
qDebug() << "I am here";
trayIconMenu = new QMenu(this);
trayIcon = new QSystemTrayIcon(this); trayIcon->setContextMenu(trayIconMenu); QPixmap icon(":time1.png"); QIcon trayIconpng = QIcon(icon); trayIcon->setIcon(trayIconpng); trayIcon->show();
I do have added that icon in resources "qrc" file. my qrc file code is
Please let me know where I am going wrong and what steps I should take to overcome this issue.
I am using Qt 5.3
Also it would be great help if you can provide me some help regarding moving forward with my project. I want to take a screenshot of the application every 10 mins. Please guide me in accomplishing this.