[Qt-interest] Problem with QSystemTrayIconMessage

Bijay Panda bijaykumar.mail at gmail.com
Mon Feb 8 05:33:18 CET 2010


Hi List,
I am facing proeblem in QSystemTrayIcon's Message.When I minimize the
application, the disappears.

trayIconMenu = new QMenu(this);

toggleVisibilityAction = new QAction("Show/Hide", this);
trayIconMenu->addAction(toggleVisibilityAction);

quitAction = new QAction("&Quit", this);
trayIconMenu->addAction(quitAction);

tray = new QSystemTrayIcon(this);

tray->setIcon (QIcon("someicon.png"));
tray->setContextMenu(trayIconMenu);

tray->show();


//signals

connect(tray, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this,
SLOT(trayActivated(QSystemTrayIcon::ActivationReason)));
connect(toggleVisibilityAction, SIGNAL(triggered()), this,
SLOT(toggleVisibility()));
connect(quitAction, SIGNAL(triggered()), this, SLOT(close()));


void toggleVisibility()
{

    if(isHidden())
    {
        show();
        if(isMinimized())
        {
            if(isMaximized())
                showMaximized();
            else
                showNormal();
        }
        raise();
        activateWindow();
    }
    else
    {
        hide();
    }
} //end toggleVisibility function

void trayActivated(QSystemTrayIcon::ActivationReason reason)
{

    if (reason == QSystemTrayIcon::Trigger)
        toggleVisibility();

} //end trayActivated


//Called in timer function every 1000ms

tray->showMessage ( "Test Program", iconMessage, icon, 1000);


Please help me out.
-- 
Thanks & Regards
Bijay Kumar Panda
Mob-9739591816
bijaykumar.mail at gmail.com
bijaykumar_panda at yahoo.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100208/3ae2a637/attachment.html 


More information about the Qt-interest-old mailing list