<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    03.07.2012 16:44, Dmitry пишет:
    <blockquote cite="mid:4FF2E923.6020807@rosalab.ru" type="cite">Hello,
      Marco!
      <br>
      <br>
      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?
      <br>
      <br>
      Thank you!
      <br>
      <br>
    </blockquote>
    <br>
    Hello!<br>
    <br>
    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:<br>
    <ol>
      <li>User clicks on embedded applet</li>
      <li>Embedded applet changes its status</li>
      <li>Previous action causes system tray in C++ to move embedded
        applet from popup dialog to panel part</li>
      <li>Embedded applet shows its pop-up window docked to panel
        because it is located in panel. <br>
      </li>
    </ol>
    So, I've found next solution to described problem:<br>
    <ul>
      <li>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:<br>
      </li>
    </ul>
    <blockquote><tt>Plasma::PopupApplet *popup =
        qobject_cast<Plasma::PopupApplet*>(applet)<br>
        if (popup) { /* Applet is a pop-up applet */}<br>
      </tt></blockquote>
    <ul>
      <li>Next I hide applet to disable its redrawing:</li>
    </ul>
    <blockquote><tt>popup->hide();</tt><br>
    </blockquote>
    <ul>
      <li>Reparent popup. It becomes located in panel:</li>
    </ul>
    <blockquote><tt>popup->setParentItem(panel); // panel is a panel
        part of system tray</tt><br>
    </blockquote>
    <ul>
      <li>Show pop-up of embedded applet:<br>
      </li>
    </ul>
    <blockquote><tt>popup->showPopup();</tt><br>
    </blockquote>
    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?<br>
    <br>
    Thank you.<br>
    <br>
  </body>
</html>