// // C++ Implementation: ucd_desktop // // Description: // // // Author: <>, (C) 2007 // // Copyright: See COPYING file that comes with this distribution // // #include "ucd_item.h" //#include "plasma/corona.h" #include #include //#include //#include //#include "../ucd_desktop/ucd_desktop.h" UCD_Item::UCD_Item(QObject *parent,const QStringList &args) : Plasma::Applet(parent, args), m_tutorialTheme("widgets/background", this), m_tutorialIcon("document") { // First we create the objects to hold the icon and // background image // TIP: Read the section about setDrawStandardBackground(true) // m_tutorialTheme = new Plasma::Svg("widgets/background",this); // m_tutorialIcon = new KsIcon("document"); // Tell the Plasma/Svg object to use the whole image, instead // of parts of it. m_tutorialTheme.setContentType(Plasma::Svg::SingleImage); // A small demonstration of the setFailedToLaunch function bool Armageddon = false; if (Armageddon) { setFailedToLaunch(true, "No world to say hello"); } } UCD_Item::~UCD_Item() { if (failedToLaunch()) { // Do some cleanup here } else { // Save settings } } QRectF UCD_Item::boundingRect() const { // In this tutorial we use a fixed size return QRectF(0,0,128,128); } void UCD_Item::paintInterface(QPainter *p, const QStyleOptionGraphicsItem *option, QWidget *widget) { // Now we draw the applet, starting with the background m_tutorialTheme.resize(boundingRect().width(), boundingRect().height()); m_tutorialTheme.paint(p, boundingRect().left(), boundingRect().top()); // The we place the icon and text p->drawPixmap(20, 0, m_tutorialIcon.pixmap(boundingRect().width() - 40)); p->save(); p->setPen(Qt::white); p->drawText(boundingRect(), Qt::AlignBottom+Qt::AlignHCenter, "Item.File"); p->restore(); } void UCD_Item::snapTo(UCD_Item *item) { return; } /* void UCD_Item::snapTo(UCD_Pile *pile) { ; } */ void UCD_Item::activate() { return; } void UCD_Item::deactivate() { return; } /* void UCD_Item::mouseMoveEvent( QGraphicsSceneMouseEvent * event ) { return; } void UCD_Item::mouseReleaseEvent( QGraphicsSceneMouseEvent * event ) { return; }*/ #include "ucd_item.moc"