From 61fa701fc01343d5ba40dd1ed134fbb0831c8aff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petri=20Damst=C3=A9n?= Date: Fri, 28 Sep 2007 05:45:10 +0000 Subject: [PATCH] - Add setSize (needed by Applet) - Delete white space from line ends svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=718077 --- widgets/widget.cpp | 9 +++++++-- widgets/widget.h | 5 +++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/widgets/widget.cpp b/widgets/widget.cpp index cb61e9349..5c3da797a 100644 --- a/widgets/widget.cpp +++ b/widgets/widget.cpp @@ -66,7 +66,7 @@ class Widget::Private #if QT_VERSION >= 0x040400 #warning Replace Plasma::Widget::CachePaintMode with QGraphicsItem::CacheMode #endif - Widget::CachePaintMode cachePaintMode; + Widget::CachePaintMode cachePaintMode; QSize cacheSize; QString cacheKey; QRectF cacheInvalidated; @@ -222,6 +222,11 @@ void Widget::setGeometry(const QRectF& geometry) update(); } +void Widget::setSize(const QSizeF& size) +{ + d->size = size; +} + void Widget::updateGeometry() { if ( managingLayout() ) { @@ -256,7 +261,7 @@ void Widget::setFont(const QFront& font) QRectF Widget::boundingRect() const { - return QRectF(QPointF(0,0),geometry().size()); + return QRectF(QPointF(0,0),geometry().size()); } void Widget::resize(const QSizeF& size) diff --git a/widgets/widget.h b/widgets/widget.h index a6646314f..3ea95fe2c 100644 --- a/widgets/widget.h +++ b/widgets/widget.h @@ -57,8 +57,8 @@ class PLASMA_EXPORT Widget : public QObject, Q_PROPERTY( QSizeF maximumSize READ maximumSize WRITE setMaximumSize ) Q_PROPERTY( QRectF geometry READ geometry WRITE setGeometry ) Q_PROPERTY( QSizeF sizeHint READ sizeHint ) - Q_PROPERTY( QSizeF size READ size WRITE resize ) - Q_PROPERTY( qreal opacity READ opacity WRITE setOpacity ) + Q_PROPERTY( QSizeF size READ size WRITE resize ) + Q_PROPERTY( qreal opacity READ opacity WRITE setOpacity ) public: enum CachePaintMode { @@ -255,6 +255,7 @@ protected: * @param widget the parent QWidget (most likely the Corona) */ virtual void paintWidget(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); + void setSize(const QSizeF& size); private: void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);