QTrayIcon shown on the left. Why? how can i fix this?
This is on the constructor:
Code:
trayIcon
->setIcon
(QIcon(":/icons/omg4.png"));
trayIcon->setToolTip("Wallpaper Changer \nDouble click to show the window.\nMiddle click to exit the application.\nRight click for some options.");
connect(this,SIGNAL(minimized()),this,SLOT(hide()),Qt::QueuedConnection);
//clock_menu->addAction("&Play",this,SLOT(playClicked()));
//clock_menu->addAction("P&ause",this,SLOT(pauseClicked()));
//clock_menu->addAction("St&op",this,SLOT(stopClicked()));
clock_menu->addAction("&Show",this,SLOT(showClicked()));
clock_menu->addAction("Se&ttings",this,SLOT(showSettings()));
clock_menu
->addAction
(QIcon(":/new/clock/clock.png"),
"&About",
this,
SLOT(showAbout
()));
clock_menu->addSeparator();
clock_menu->addAction("&Exit",qApp,SLOT(quit()));
trayIcon->setContextMenu(clock_menu);
This on the change event:
Code:
switch (e->type()) {
ui->retranslateUi(this);
break;
//see if the event is changing the window state
case QEvent::WindowStateChange: //if it is, we need to see that this event is minimize
if (isMinimized()) {
//EDWWWWWWWW
trayIcon->show();
// QCoreApplication::sendPostedEvents(QObject *trayIcon);
enum MessageIcon { NoIcon, Information, Warning, Critical };
trayIcon->showMessage("titlos", "mplampla", icon, 10000);
emit minimized();}
default:
break;
And this is the void function while it is minimized:
Code:
void MainWindow
::clickSysTrayIcon(QSystemTrayIcon::ActivationReason reason
) {
//reason is a variable that holds the type of activation or click done on the icon tray
switch (reason) {
//hide the icon
trayIcon->hide();
//show the main window
this->showNormal();
break;
//quit the application
qApp->quit();
break;
break;
break;
break;
default :
;
}
}
I don't know why but the message is shown on the left and not below the application's icon. Why is this happening and how can I fix it? :confused::confused::confused:
Re: QTrayIcon shown on the left. Why? how can i fix this?
I have the same problem... Anybody?
Re: QTrayIcon shown on the left. Why? how can i fix this?
Can anybody answer why is this happening? And how can be fixed?