03.07.2012 16:44, Dmitry ?????:
Hello, Marco!
I'm implementing system tray in QML. I've found a solution how to
place embedded applet into pop-up window of tray. But there is one
difference between my system tray [in QML] and your current system
tray [in pure C++]. If some embedded applet is placed in pop-up window
of system tray (pop-up part of the tray) and user clicks on it
[embedded applet] then the pop-up dialog of embedded applet will arise
at the cursor coordinates and either it looks like separated window or
it overlaps the panel. It looks weird. If user clicks on an applet
embedded in pop-up window of current C++ system tray then pop-up
window of the embedded applet arises docked to the panel and never
overlap it. Do You know what is a reason of such strange behaviour?
Thank you!
Hello!
It seems that PopupApplet uses global coordinates to place popup dialog.
If applet is located outside of a panel then its popup dialog won't be
docked to the panel (will be shown like a separate window). I think the
current system tray in C++ doesn't have such problem because an order of
actions is next:
1. User clicks on embedded applet
2. Embedded applet changes its status
3. Previous action causes system tray in C++ to move embedded applet
from popup dialog to panel part
4. Embedded applet shows its pop-up window docked to panel because it
is located in panel.
So, I've found next solution to described problem:
* First of all, I handle mouse click event. If user clicks on
embedded applet then I check if this applet is a pop-up applet like
this:
Plasma::PopupApplet *popup = qobject_cast<Plasma::PopupApplet*>(applet)
if (popup) { /* Applet is a pop-up applet */}
* Next I hide applet to disable its redrawing:
popup->hide();
* Reparent popup. It becomes located in panel:
popup->setParentItem(panel); // panel is a panel part of system tray
* Show pop-up of embedded applet:
popup->showPopup();
I think that this way isn't good, but it is only one way I have found to
solve the problem. What do you think about solution? Maybe do you have
another ideas?
Thank you.
_______________________________________________
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel