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

List:       kde-commits
Subject:    extragear/multimedia/amarok/src/context/applets/photos
From:       Simon Esneault <simon.esneault () gmail ! com>
Date:       2009-07-14 17:08:16
Message-ID: 1247591296.313273.7964.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 996679 by sesneault:

Reimplement resize method in order to positionned correctly the photos when the whole \
applet size has changed.


 M  +22 -0     PhotosScrollWidget.cpp  
 M  +9 -1      PhotosScrollWidget.h  


--- trunk/extragear/multimedia/amarok/src/context/applets/photos/PhotosScrollWidget.cpp \
#996678:996679 @@ -255,6 +255,28 @@
     }
 }
 
+void PhotosScrollWidget::resize(qreal wid, qreal hei)
+{
+
+    switch( m_mode )
+    {
+        case PHOTOS_MODE_FADING:
+        {
+            foreach (DragPixmapItem *item, m_pixmaplist)
+            {
+                if ( size().height() != hei )
+                    item->setPixmap( item->pixmap().scaledToHeight( (int) hei - 4 * \
m_margin,  Qt::SmoothTransformation ) ); +                if ( size().width() != wid \
) +                    item->setPos( ( wid - item->boundingRect().width() ) / 2, 0 );
+            }
+            break;
+        }
+    }
+
+    QGraphicsWidget::resize( wid, hei );
+}
+
+
 void
 PhotosScrollWidget::automaticAnimBegin()
 {
--- trunk/extragear/multimedia/amarok/src/context/applets/photos/PhotosScrollWidget.h \
#996678:996679 @@ -37,7 +37,7 @@
 /**
 * \brief A widget to present the photos
 * 3 possible animation :
-*  - Interactive : the scorll is done on mouse hover
+*  - Interactive : the sliding is done on mouse hover
 *  - Automatic : the photos are presented in an infinite loop, always scrolling
 *  - Fading, the photos are presented one by one, fading ...
 * \sa QGraphicsWidget
@@ -63,6 +63,11 @@
         void animate( qreal anim );
         void automaticAnimBegin();
         void automaticAnimEnd( int );
+
+       /**
+        * Reimplement resize in order to correctly repositionned the stack of pixmap
+        */
+        virtual void resize( qreal, qreal );
         
     protected:
 
@@ -72,6 +77,9 @@
         virtual void hoverMoveEvent(QGraphicsSceneHoverEvent* event);
         virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent* event);
         virtual void hoverEnterEvent(QGraphicsSceneHoverEvent* event);
+        
+
+        
  //       virtual void keyPressEvent(QKeyEvent* event);
  //       virtual void wheelEvent(QGraphicsSceneWheelEvent* event);
         


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

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