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

List:       kde-panel-devel
Subject:    Re: setMinimumSize and resize
From:       "Aaron J. Seigo" <aseigo () kde ! org>
Date:       2008-05-31 20:52:36
Message-ID: 200805311452.36953.aseigo () kde ! org
[Download RAW message or body]

[Attachment #2 (multipart/signed)]

[Attachment #4 (multipart/mixed)]


On Friday 30 May 2008, Petri Damstén wrote:
> If I do setMinimumSize and applet is smaller than minimum size set applet

does the attached patch make it better? 

(you'll need to recompile your applet, btw, as the patch is BIC.)

-- 
Aaron J. Seigo
humru othro a kohnu se
GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA  EE75 D6B7 2EB1 A7F1 DB43

KDE core developer sponsored by Trolltech


["applet_geometryChanged.diff" (text/x-patch)]

Index: applet.h
===================================================================
--- applet.h	(revision 814866)
+++ applet.h	(working copy)
@@ -426,13 +426,6 @@
         bool isContainment() const;
 
         /**
-         * Sets the geometry of this Plasma::Applet. Should not be used directly by
-         * applet subclasses.
-         * @param geometry the geometry to apply to this Plasma::Applet.
-         */
-        void setGeometry(const QRectF &geometry);
-
-        /**
          * @return a rect of the applet in screen coordinates.
          */
         QRect screenRect() const;
@@ -681,11 +674,16 @@
         /**
          * Reimplemented from QGraphicsItem
          */
-        void focusInEvent(QFocusEvent * event);
+        void focusInEvent(QFocusEvent *event);
 
         /**
          * Reimplemented from QGraphicsItem
          */
+        void resizeEvent(QGraphicsSceneResizeEvent *event);
+
+        /**
+         * Reimplemented from QGraphicsItem
+         */
         QVariant itemChange(GraphicsItemChange change, const QVariant &value);
 
         /**
Index: applet.cpp
===================================================================
--- applet.cpp	(revision 814866)
+++ applet.cpp	(working copy)
@@ -1059,9 +1059,21 @@
         //which should be harmless
         //focusing an applet may trigger this event again, but we won't be here more than twice
     }
+
     QGraphicsWidget::focusInEvent(event);
 }
 
+void Applet::resizeEvent(QGraphicsSceneResizeEvent *event)
+{
+    QGraphicsWidget::resizeEvent(event);
+
+    if (d->background) {
+        d->background->resizePanel(boundingRect().size());
+    }
+
+    updateConstraints(Plasma::SizeConstraint);
+}
+
 void Applet::showConfigurationInterface()
 {
     if (!hasConfigurationInterface()) {
@@ -1290,6 +1302,9 @@
             d->shadow->setVisible(isVisible());
         }
         break;
+    case ItemPositionHasChanged:
+        emit geometryChanged();
+        break;
     default:
         break;
     };
@@ -1321,24 +1336,6 @@
     }
 }
 
-void Applet::setGeometry(const QRectF& geometry)
-{
-    QRectF beforeGeom = QGraphicsWidget::geometry();
-    QGraphicsWidget::setGeometry(geometry);
-    if (geometry.size() != beforeGeom.size()) {
-        updateConstraints(Plasma::SizeConstraint);
-        if (d->background) {
-            d->background->resizePanel(boundingRect().size());
-        }
-        emit geometryChanged();
-    } else  if (geometry.topLeft() != beforeGeom.topLeft()) {
-        /*if (d->background) {
-            kDebug() << QGraphicsWidget::geometry();
-        }*/
-        emit geometryChanged();
-    }
-}
-
 QRect Applet::screenRect() const
 {
     QPointF bottomRight = pos();

["signature.asc" (application/pgp-signature)]

_______________________________________________
Panel-devel mailing list
Panel-devel@kde.org
https://mail.kde.org/mailman/listinfo/panel-devel


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

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