<br><br><div class="gmail_quote">On Sat, Jan 16, 2010 at 5:08 PM, Giulio Camuffo <span dir="ltr"><<a href="mailto:giuliocamuffo@gmail.com">giuliocamuffo@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div></div><div class="h5">On Saturday 16 January 2010 05:36:41 Shantanu Tushar Jha wrote:<br>
> Hello all,<br>
> I wanted to make a simple PopupApplet which stays as an icon in the<br>
> panel and when clicked shows a popup allowing to enter username and<br>
> password. The techbase extenders tutorial seems a bit overkill for this<br>
> because it provides more functionality than what required in my case. So,<br>
> looking at the PopupApplet API, I wrote the following code -<br>
><br>
> #include "sifyclient.h"<br>
> K_EXPORT_PLASMA_APPLET(sifyclient, SifyClient)<br>
><br>
> SifyClient::SifyClient(QObject *parent, const QVariantList &args)<br>
><br>
> : Plasma::PopupApplet(parent, args)<br>
><br>
> {<br>
> topLevelWidget = new QGraphicsWidget;<br>
> usernameLabel = new Plasma::Label(topLevelWidget);<br>
> usernameEdit = new Plasma::LineEdit(topLevelWidget);<br>
><br>
> usernameLabel->setText("Username");<br>
><br>
> QGraphicsLinearLayout *usernameLayout = new<br>
> QGraphicsLinearLayout(Qt::Horizontal, topLevelWidget);<br>
> dataTransferLayout->addItem(usernameLabel);<br>
> dataTransferLayout->addItem(usernameEdit);<br>
><br>
> topLevelWidget->setLayout(dataTransferLayout);<br>
> }<br>
><br>
> SifyClient::~SifyClient()<br>
> {<br>
> delete topLevelWidget;<br>
> }<br>
><br>
> void SifyClient::init()<br>
> {<br>
> setPopupIcon("device-notifier"); //just for testing, will replace by<br>
> appropriate one later<br>
> }<br>
><br>
> QGraphicsWidget *SifyClient::graphicsWidget()<br>
> {<br>
> return topLevelWidget;<br>
> }<br>
><br>
> #include "sifyclient.moc"<br>
><br>
><br>
> From the API, I expected this to display 'device-notifier' icon when placed<br>
> in panel and show the username label and line edit when clicked. Instead it<br>
> displays the label and line edit directly inside the panel. What am I doing<br>
> wrong? How to get the effect I'm trying to achieve?<br>
><br>
> Thanks<br>
<br>
</div></div>Try setting a a minimum size for the topLevelWidget. It should work that way.<br></blockquote><div><br>Thanks, that worked! I used 'topLevelWidget->setMinimumSize(250, 250);' in the constructor and now it shows the icon in the panel.<br>
But now, If I click the icon, nothing pops up. Only If I move the applet from the panel to the desktop (when it shows the topLevelWidget with a label and lineEdit inside it) and then move it back into the panel, the popup shows on clicking the icon. Every time I do this, the following is output to the terminal -<br>
<br>plasma-desktop(5365)/plasma ItemSpace::resizeItem: Resizing QRectF(787,637 32x32) to QRectF(787,637 278x278)<br><br>Any idea what I'm missing?<br><br>Thanks <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
_______________________________________________<br>
Plasma-devel mailing list<br>
<a href="mailto:Plasma-devel@kde.org">Plasma-devel@kde.org</a><br>
<a href="https://mail.kde.org/mailman/listinfo/plasma-devel" target="_blank">https://mail.kde.org/mailman/listinfo/plasma-devel</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>Shantanu Tushar (UTC +0530)<br><a href="http://www.shantanutushar.com">http://www.shantanutushar.com</a><br>