[Kst] branches/work/kst/1.5/kst/src/widgets

Andrew Walker arwalker at sumusltd.com
Mon Jun 25 22:35:10 CEST 2007


SVN commit 680290 by arwalker:

CCBUG:147217 Add functionality to draggablelistbox to report whether a move was actually made

 M  +21 -4     draggablelistbox.cpp  
 M  +3 -3      draggablelistbox.h  


--- branches/work/kst/1.5/kst/src/widgets/draggablelistbox.cpp #680289:680290
@@ -94,9 +94,12 @@
   }
 }
 
-void DraggableListBox::up() {
+bool DraggableListBox::up() {
+  bool bRetVal = false;
+
   if (count() > 1) {
     QString C;
+
     for (unsigned i=1; i<count(); i++) {
       if (isSelected(i)) {
         C = text(i);
@@ -104,13 +107,21 @@
         --i;
         insertItem(C, i);
         setSelected(i, true);
-        while (isSelected(i) && (i<count())) ++i;
+        while (isSelected(i) && (i < count())) {
+          ++i;
+        }
+
+        bRetVal = true;
       }
     }
   }
+
+  return bRetVal;
 }
 
-void DraggableListBox::down() {
+bool DraggableListBox::down() {
+  bool bRetVal = false;
+
   if (count() > 1) {
     QString C;
     for (int i=int(count())-2; i>=0; i--) {
@@ -120,10 +131,16 @@
         ++i;
         insertItem(C, i);
         setSelected(i, true);
-        while (isSelected(i) && (i>0)) --i;
+        while (isSelected(i) && (i > 0)) {
+          --i;
+        }
+
+        bRetVal = true;
       }
     }
   }
+
+  return bRetVal;
 }
 
 #include "draggablelistbox.moc"
--- branches/work/kst/1.5/kst/src/widgets/draggablelistbox.h #680289:680290
@@ -35,9 +35,9 @@
     virtual void setDragEnabled(bool enabled);
 
   public slots:
-    virtual void up();
-    virtual void down();
-    
+    virtual bool up();
+    virtual bool down();
+
   protected:
     virtual void startDrag();
     virtual void mousePressEvent(QMouseEvent *e);


More information about the Kst mailing list