[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    playground/base/plasma/applets/test
From:       Alex Merry <huntedhacker () tiscali ! co ! uk>
Date:       2007-07-26 17:12:08
Message-ID: 1185469928.267861.19419.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 692962 by alexmerry:

Experimenting with limiting height of Plasma::LineEdit.

Result so far: crash.  In Plasma::Svg::paint, of all
places.  Anyone fix it?



 M  +24 -1     testapplet.cpp  
 M  +2 -1      testapplet.h  


--- trunk/playground/base/plasma/applets/test/testapplet.cpp #692961:692962
@@ -25,15 +25,38 @@
 #include <plasma/widgets/vboxlayout.h>
 #include <plasma/widgets/lineedit.h>
 
+class LimitedLineEdit : public Plasma::LineEdit
+{
+public:
+    explicit LimitedLineEdit(QGraphicsItem *parent = 0, QGraphicsScene *scene = 0)
+        : Plasma::LineEdit(parent, scene)
+        , m_height(300)
+    {
+    }
+    QRectF boundingRect()
+    {
+        QRectF rect(Plasma::LineEdit::boundingRect());
+        rect.setHeight(m_height);
+        return rect;
+    }
+    void setHeight(qreal height)
+    {
+        m_height = height;
+    }
+private:
+    qreal m_height;
+};
+
 TestApplet::TestApplet(QObject *parent, const QStringList &args)
     : Plasma::Applet(parent, args)
-    , m_edit( new Plasma::LineEdit(this) )
+    , m_edit( new LimitedLineEdit(this) )
     , m_svg( 0 )
 {
     setDrawStandardBackground(true);
 
     m_edit->setMultiLine(true);
     m_edit->setTextWidth(300);
+    m_edit->setHeight(200);
 
     //m_svg = new Plasma::Svg("widgets/wallpaper", this);
     //m_svg->resize(640,480);
--- trunk/playground/base/plasma/applets/test/testapplet.h #692961:692962
@@ -27,6 +27,7 @@
     class LineEdit;
     class Svg;
 } // namespace Plasma
+class LimitedLineEdit;
 
 class TestApplet : public Plasma::Applet
 {
@@ -42,7 +43,7 @@
         void editUpdate(const QString& text);
 
     private:
-        Plasma::LineEdit* m_edit;
+        LimitedLineEdit* m_edit;
         Plasma::Svg* m_svg;
 };
 
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic