[Qt-interest] Problem with QSystemTrayIcon on left click

Scott Aron Bloom Scott.Bloom at onshorecs.com
Tue Nov 30 01:21:07 CET 2010


Hard to tell without a more complete code sample...

Sounds like you might have a positional issue.

Scott

-----Original Message-----
From: qt-interest-bounces at trolltech.com
[mailto:qt-interest-bounces at trolltech.com] On Behalf Of Aaron Lewis
Sent: Monday, November 29, 2010 4:18 PM
To: qt-interest at trolltech.com
Subject: Re: [Qt-interest] Problem with QSystemTrayIcon on left click

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 11/30/2010 02:25 AM, Scott Aron Bloom wrote:
> What happens if you simply set the menu using setContextMenu
> 
> Part of the problem in using you method, is your menu will have a
> completely separate focus environment..

Hmm .. it's really wired , code is just like what you described.

i have a private function called setupSysTray()

// trayMenu is a private instance of QMenu

trayIMenu.addAction ( ui->actionQuit_Q ) // Would that be a problem ?
trayMenu.addSeparator ();
...

trayIcon.setContextMenu(&this->trayMenu);
trayIcon.setIcon ( ... );
trayIcon.show();

And besides , even if i call trayMenu.show() ,
trayIcon.contextMenu->showNormal() or trayMenu.showNormal() , non among
them works.

They will firstly appear on my left corner , and after a right click ,
it appears at right place.

( Should be problem with Qt ? Likely position was set to (0,0) by
default , and further calculation on it changes its position )

Is referencing a QAction from ui directly a problem here ?

> 
> And sicne you can probably click on the icon twice raising the menu
> twice etc etc.
> 
> Scott
> -----Original Message-----
> From: qt-interest-bounces at trolltech.com
> [mailto:qt-interest-bounces at trolltech.com] On Behalf Of Aaron Lewis
> Sent: Sunday, November 28, 2010 8:30 PM
> To: qt-interest at trolltech.com
> Subject: Re: [Qt-interest] Problem with QSystemTrayIcon on left click
> 
> On 11/29/2010 02:58 AM, Scott Aron Bloom wrote:
>> I have used QSTI many times, and never saw this type of behavior.
> 
> Gentoo Linux , Qt 4.7.1
> 
> Codes:
> 
> A slot dedicated for handling those events:
> 
> private slots:
> void showOrHide(QSystemTrayIcon::ActivationReason reason) {
>     trayIcon.contextMenu()->showNormal();
>     return;
> }
> 
> And in construct function:
> 
> /// TrayIcon is an instance of QSystemTrayIcon
>  
>
connect(&trayIcon,SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
>             this,SLOT(showOrHide(QSystemTrayIcon::ActivationReason)));
> 
> This bug also exists in KTTSD , but i'm no longer using that.
> 
> 
>> What platform?
>> Can you post code that reproduces it.
> 
>> Scott
> 
>> -----Original Message-----
>> From: qt-interest-bounces at trolltech.com
>> [mailto:qt-interest-bounces at trolltech.com] On Behalf Of Aaron Lewis
>> Sent: Sunday, November 28, 2010 3:47 AM
>> To: QT Interest List
>> Subject: [Qt-interest] Problem with QSystemTrayIcon on left click
> 
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
> 
>> Hi,
>> 	If did a left click on QSystemTrayIcon , context menu will just
>> popup
>> at a wrong position ( normally left-top corner ) , but after a right
>> click , further left click on it won't cause troubles , it just show
> up
>> the right position.
> 
>> 	How could i get this problem solved , anyone got some ideas ?
> 
>> 	Many thanks !
> 
>> - -- 
>> Best Regards,
>> Aaron Lewis - PGP: 0xDFE6C29E ( http://keyserver.veridis.com )
>> Finger Print: 9482 448F C7C3 896C 1DFE 7DD3 2492 A7D0 DFE6 C29E
> 
>> _______________________________________________
>> Qt-interest mailing list
>> Qt-interest at trolltech.com
>> http://lists.trolltech.com/mailman/listinfo/qt-interest
> 
> 
_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest

_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest


- -- 
Best Regards,
Aaron Lewis - PGP: 0xDFE6C29E ( http://keyserver.veridis.com )
Finger Print: 9482 448F C7C3 896C 1DFE 7DD3 2492 A7D0 DFE6 C29E
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.16 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJM9EKyAAoJECSSp9Df5sKeAAUP/2tr/sohRedIvMjmR+P5dq/z
XW1uuIcan/0CcI4sC/VJ1tb2cuh7hoUSRBxlUVCvgMwuH8IZ20PRpS+p2xT7t+mD
aNERz29wyRIEui2jvDZCeWd16O4eT57KuE6tFVAqzSkwReL6EeEfNxSvY98+Oo8b
MGEVqKWvhemdBfGDa5vlSn8XSKOiHozNaCdANuRLLvLh3ROjWON0DosTdRbQEVyX
85PbP+4KFPMjKYkFGU7PvCdLPNSMcOzawfGmJT5qZJYJw9XPd+rJMm5TxsLbEFD4
kF30bKptv0+DckQVwlRzHLDW4RB4LKIjRWKC0PHZxBhExn64/ivwPnPVTb8NFjM1
ZxV4LGkDANrvSlSdbMhqAdX+E1Q6nryrtyhDYd6ICBib7zRJFaMWbd7IdLrrNUGN
RkPnPbNcjO0XDthqgQhQbnaVbBPDu8/3tLrczrSbZNHKuW3j62/x3bGhZsYKeG7V
thA99xYx2R8dIzWLLIsObOUQ4j4nTLYkK70TqEFCrYm6R7biBLSSnZHg6714I5CU
Z4EGCGs8DES4+S6YqdTnKWDoTGygtNPViQQ7z0J6JT6A3apIXm52pLqG+vBLilt+
1b1j5BQplN8GgKntEg+e/1JxSoAza+pHpumrsQ8EhGIjT9fdpLHwsD6/Q85AtCin
/r7onTDXJA+MwzcfH9sW
=yqL3
-----END PGP SIGNATURE-----
_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest




More information about the Qt-interest-old mailing list