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

List:       kde-commits
Subject:    playground/base/plasma/applets/weather
From:       Marco Martin <notmart () gmail ! com>
Date:       2008-08-20 18:14:52
Message-ID: 1219256092.963833.4692.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 850052 by mart:

use the Plasma::TreeView


 M  +1 -1      weatherapplet.cpp  
 M  +5 -44     weatherview.cpp  
 M  +6 -44     weatherview.h  


--- trunk/playground/base/plasma/applets/weather/weatherapplet.cpp #850051:850052
@@ -729,7 +729,7 @@
 
         // If we have a 5 day forecast, display it
         if (data["Short Forecast Day 0"].toString().length() > 0) {
-            WeatherView *fiveDaysView = new WeatherView(this);
+            Plasma::WeatherView *fiveDaysView = new Plasma::WeatherView(this);
             fiveDaysView->setMinimumSize(200,150);
 
             m_fiveDaysModel = new QStandardItemModel(this);
--- trunk/playground/base/plasma/applets/weather/weatherview.cpp #850051:850052
@@ -27,29 +27,14 @@
 
 #include "weatherdelegate.h"
 
-
-
-class WeatherViewPrivate
+namespace Plasma
 {
-public:
-    WeatherViewPrivate()
-    {
-    }
 
-    ~WeatherViewPrivate()
-    {
-    }
-};
-
 WeatherView::WeatherView(QGraphicsWidget *parent)
-    : QGraphicsProxyWidget(parent),
-      d(new WeatherViewPrivate)
+    : TreeView(parent)
 {
-    QTreeView* native = new QTreeView;
-    setWidget(native);
-    native->setAttribute(Qt::WA_NoSystemBackground);
+    QTreeView *native = nativeWidget();
     native->viewport()->setAutoFillBackground(false);
-    native->setFrameStyle(QFrame::NoFrame);
     native->header()->hide();
     native->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
     native->setIconSize(QSize(KIconLoader::SizeSmallMedium, KIconLoader::SizeSmallMedium));
@@ -61,34 +46,8 @@
 
 WeatherView::~WeatherView()
 {
-    delete d;
 }
 
-void WeatherView::setModel(QAbstractItemModel *model)
-{
-    nativeWidget()->setModel(model);
-}
-
-QAbstractItemModel *WeatherView::model()
-{
-    return nativeWidget()->model();
-}
-
-void WeatherView::setStyleSheet(const QString &stylesheet)
-{
-    widget()->setStyleSheet(stylesheet);
-}
-
-QString WeatherView::styleSheet()
-{
-    return widget()->styleSheet();
-}
-
-QTreeView* WeatherView::nativeWidget() const
-{
-    return static_cast<QTreeView*>(widget());
-}
-
 void WeatherView::resizeEvent(QGraphicsSceneResizeEvent *event)
 {
     QGraphicsProxyWidget::resizeEvent(event);
@@ -100,5 +59,7 @@
     }
 }
 
+};
+
 #include <weatherview.moc>
 
--- trunk/playground/base/plasma/applets/weather/weatherview.h #850051:850052
@@ -21,63 +21,25 @@
 #ifndef PLASMA_WEATHERVIEW_H
 #define PLASMA_WEATHERVIEW_H
 
-#include <QtGui/QGraphicsProxyWidget>
+#include <plasma/widgets/treeview.h>
 
-class QTreeView;
-class QAbstractItemModel;
+namespace Plasma
+{
 
-
-class WeatherViewPrivate;
-
-class WeatherView : public QGraphicsProxyWidget
+class WeatherView : public TreeView
 {
     Q_OBJECT
 
-    Q_PROPERTY(QAbstractItemModel* model READ model WRITE setModel)
-    Q_PROPERTY(QGraphicsWidget* parentWidget READ parentWidget)
-    Q_PROPERTY(QString styleSheet READ styleSheet WRITE setStyleSheet)
-    Q_PROPERTY(QTreeView* nativeWidget READ nativeWidget)
-
 public:
     explicit WeatherView(QGraphicsWidget *parent = 0);
     ~WeatherView();
 
-    /**
-     * Sets a model for this weather view
-     *
-     * @arg model the model to display
-     */
-    void setModel(QAbstractItemModel *model);
 
-    /**
-     * @return the model shown by this view
-     */
-    QAbstractItemModel *model();
-
-    /**
-     * Sets the stylesheet used to control the visual display of this WeatherView
-     *
-     * @arg stylesheet a CSS string
-     */
-    void setStyleSheet(const QString &stylesheet);
-
-    /**
-     * @return the stylesheet currently used with this widget
-     */
-    QString styleSheet();
-
-    /**
-     * @return the native widget wrapped by this WeatherView
-     */
-    QTreeView* nativeWidget() const;
-
-Q_SIGNALS:
-
 protected:
     void resizeEvent(QGraphicsSceneResizeEvent *event);
 
-private:
-    WeatherViewPrivate * const d;
 };
 
+};
+
 #endif // multiple inclusion guard
[prev in list] [next in list] [prev in thread] [next in thread] 

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