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

List:       kde-commits
Subject:    playground/base/plasma/applets/groupphoto
From:       Stephan Binner <binner () kde ! org>
Date:       2007-07-04 13:36:12
Message-ID: 1183556172.183169.21680.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 683253 by binner:

add showing names on hover


 M  +1 -1      CMakeLists.txt  
 M  +27 -1     groupphoto.cpp  
 M  +3 -0      groupphoto.h  


--- trunk/playground/base/plasma/applets/groupphoto/CMakeLists.txt #683252:683253
@@ -8,7 +8,7 @@
 kde4_add_ui_files(groupphoto_SRCS config.ui )
 
 kde4_add_plugin(plasma_applet_groupphoto ${groupphoto_SRCS})
-target_link_libraries(plasma_applet_groupphoto ${PLASMA_LIBRARIES} ${KDE4_KIO_LIBS} \
${KDE4_KDEUI_LIBS}) +target_link_libraries(plasma_applet_groupphoto \
${PLASMA_LIBRARIES} ${KDE4_KIO_LIBS})  set_target_properties(plasma_applet_groupphoto \
PROPERTIES VERSION 1.0.0 SOVERSION 1)  
 install(TARGETS plasma_applet_groupphoto DESTINATION ${PLUGIN_INSTALL_DIR})
--- trunk/playground/base/plasma/applets/groupphoto/groupphoto.cpp #683252:683253
@@ -61,7 +61,6 @@
 
     m_label = new Plasma::LineEdit(this);
     m_label->setDefaultText(name);
-    Phase::self()->animateItem(m_label, Phase::Appear);
     m_label->setTextInteractionFlags(Qt::NoTextInteraction);
     m_label->setPos(0, m_width);
     m_label->setTextWidth(100);
@@ -110,6 +109,7 @@
     composePicture();
 
     readNames();
+    setAcceptsHoverEvents(true);
 
     m_searchEdit = new Plasma::LineEdit(this);
     m_searchEdit->setTextInteractionFlags(Qt::TextEditorInteraction);
@@ -166,6 +166,32 @@
 
 }
 
+void Groupphoto::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
+{ 
+    if (m_oldPos==event->pos()) 
+       return;
+
+    m_oldPos = event->pos();
+
+    foreach (HitBox* hitbox, m_hitboxList)
+       delete hitbox;
+    m_hitboxList.clear();
+
+    const int frameThickness = 16;
+    foreach (_person* person, m_personList) {
+       QRect rect((boundingRect().width()-(frameThickness*2))/myPicture.width()*person->x, \
(boundingRect().height()-(frameThickness*2))/myPicture.height()*person->y, \
person->width, person->width); +       if (rect.contains(event->pos().toPoint()) ) {
+         HitBox* hitbox = new HitBox(this, person->name, person->width);
+         const int frameThickness = 16;
+         hitbox->setPos((boundingRect().width()-(frameThickness*2))/myPicture.width()*person->x,
 +                      \
(boundingRect().height()-(frameThickness*2))/myPicture.height()*person->y); +         \
hitbox->setZValue(1); +         m_hitboxList.append(hitbox);
+         break;
+       }
+    }
+}
+
 void Groupphoto::resizeEvent(QResizeEvent *)
 {
     prepareGeometryChange();
--- trunk/playground/base/plasma/applets/groupphoto/groupphoto.h #683252:683253
@@ -83,6 +83,7 @@
 	void choosePicture();
  
         void search();
+        void hoverMoveEvent(QGraphicsSceneHoverEvent *event);
 
     private:
 	void composePicture();
@@ -124,6 +125,8 @@
         QList<_person*> m_personList;
         QList<HitBox*> m_hitboxList;
 	Plasma::LineEdit *m_searchEdit;
+   
+        QPointF m_oldPos;
 };
 
 K_EXPORT_PLASMA_APPLET(groupphoto, Groupphoto)


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

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