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

Adam Treat treat at kde.org
Wed Feb 28 01:50:10 CET 2007


SVN commit 637867 by treat:

* All of widgets now builds and links.  Still some
work converting from Q3Support though


 M  +5 -5      CMakeLists.txt  
 M  +4 -5      draggablelistbox.cpp  
 M  +4 -5      draggablelistview.cpp  
 M  +2 -0      draggablelistview.h  
 M  +7 -7      plotlistbox.cpp  
 M  +7 -8      vectorlistview.cpp  


--- branches/work/kst/portto4/kst/src/widgets/CMakeLists.txt #637866:637867
@@ -21,11 +21,11 @@
    stringselector.cpp
    vectorselector.cpp
 
-#    kstbackbuffer.cpp
-#    draggablelistbox.cpp
-#    draggablelistview.cpp
-#    plotlistbox.cpp
-#    vectorlistview.cpp
+   kstbackbuffer.cpp
+   draggablelistbox.cpp
+   draggablelistview.cpp
+   plotlistbox.cpp
+   vectorlistview.cpp
    kstcombobox.cpp
    )
 
--- branches/work/kst/portto4/kst/src/widgets/draggablelistbox.cpp #637866:637867
@@ -15,10 +15,11 @@
  *                                                                         *
  ***************************************************************************/
 
+#include "draggablelistbox.h"
+
 #include <qapplication.h>
 //Added by qt3to4:
 #include <QMouseEvent>
-#include "draggablelistbox.h"
 
 DraggableListBox::DraggableListBox(QWidget *parent, const char *name)
 : Q3ListBox(parent, name), _pressPos(-1, -1), _dragEnabled(false) {
@@ -53,9 +54,7 @@
       if ((item = itemAt(e->pos()))) {
         setCurrentItem(item);
         if (!item->isSelected()) {
-          if (!(e->state() & Qt::ControlModifier)) {
-            clearSelection();
-          }
+          clearSelection();
           setSelected(item, true);
         }
         _pressPos = e->pos();
@@ -76,7 +75,7 @@
 
 
 void DraggableListBox::mouseMoveEvent(QMouseEvent *e) {
-  if (_dragEnabled && e->state() & Qt::LeftButton && _pressPos != QPoint(-1, -1)) {
+  if (_dragEnabled && e->buttons() & Qt::LeftButton && _pressPos != QPoint(-1, -1)) {
     QPoint delta = e->pos() - _pressPos;
     if (delta.manhattanLength() > QApplication::startDragDistance()) {
       _pressPos = QPoint(-1, -1);
--- branches/work/kst/portto4/kst/src/widgets/draggablelistview.cpp #637866:637867
@@ -15,10 +15,11 @@
  *                                                                         *
  ***************************************************************************/
 
+#include "draggablelistview.h"
+
 #include <qapplication.h>
 //Added by qt3to4:
 #include <QMouseEvent>
-#include "draggablelistview.h"
 
 DraggableListView::DraggableListView(QWidget *parent, const char *name)
 : Q3ListView(parent, name), _pressPos(-1, -1), _dragEnabled(false) {
@@ -53,9 +54,7 @@
       if ((item = itemAt(e->pos()))) {
         setCurrentItem(item);
         if (!item->isSelected()) {
-          if (!(e->state() & Qt::ControlModifier)) {
-            clearSelection();
-          }
+          clearSelection();
           setSelected(item, true);
         }
         _pressPos = e->pos();
@@ -76,7 +75,7 @@
 
 
 void DraggableListView::mouseMoveEvent(QMouseEvent *e) {
-  if (_dragEnabled && e->state() & Qt::LeftButton && _pressPos != QPoint(-1, -1)) {
+  if (_dragEnabled && e->buttons() & Qt::LeftButton && _pressPos != QPoint(-1, -1)) {
     QPoint delta = e->pos() - _pressPos;
     if (delta.manhattanLength() > QApplication::startDragDistance()) {
       _pressPos = QPoint(-1, -1);
--- branches/work/kst/portto4/kst/src/widgets/draggablelistview.h #637866:637867
@@ -18,6 +18,8 @@
 #ifndef DRAGGABLELISTVIEW_H
 #define DRAGGABLELISTVIEW_H
 
+class QColorGroup;
+
 #include <q3listview.h>
 #include <q3dragobject.h>
 //Added by qt3to4:
--- branches/work/kst/portto4/kst/src/widgets/plotlistbox.cpp #637866:637867
@@ -43,7 +43,7 @@
   }
 
   QByteArray data;
-  QDataStream ds(data, QIODevice::WriteOnly);
+  QDataStream ds(&data, QIODevice::WriteOnly);
   ds << entries;
   drag->setEncodedData(data);
 
@@ -52,18 +52,18 @@
 
 
 void PlotListBox::dragMoveEvent(QDragMoveEvent *e) {
-  e->accept(e->provides("application/x-kst-plot-list") && e->source() != this);
+  if (e->mimeData()->hasFormat("application/x-kst-plot-list") && e->source() != this)
+    e->acceptProposedAction();
 }
 
 
 void PlotListBox::dropEvent(QDropEvent *e) {
-  if (!e->provides("application/x-kst-plot-list") || e->source() == this) {
-    e->accept(false);
+  if (!e->mimeData()->hasFormat("application/x-kst-plot-list") || e->source() == this) {
     return;
   }
 
   QByteArray data = e->encodedData("application/x-kst-plot-list");
-  QDataStream ds(data, QIODevice::ReadOnly);
+  QDataStream ds(&data, QIODevice::ReadOnly);
   QStringList entries;
   ds >> entries;
   for (QStringList::ConstIterator i = entries.begin(); i != entries.end(); ++i) {
@@ -73,7 +73,7 @@
     emit changed();
   }
   clearSelection();
-  e->accept(true);
+  e->acceptProposedAction();
 }
 
 
@@ -81,7 +81,7 @@
   Q3DragObject *o = dragObject();
   if (o && o->dragMove()) {
     QByteArray data = o->encodedData("application/x-kst-plot-list");
-    QDataStream ds(data, QIODevice::ReadOnly);
+    QDataStream ds(&data, QIODevice::ReadOnly);
     QStringList entries;
     ds >> entries;
     for (QStringList::ConstIterator i = entries.begin(); i != entries.end(); ++i) {
--- branches/work/kst/portto4/kst/src/widgets/vectorlistview.cpp #637866:637867
@@ -15,7 +15,6 @@
  *                                                                         *
  ***************************************************************************/
 
-#include <ksdebug.h>
 #include "vectorlistview.h"
 //Added by qt3to4:
 #include <QDragMoveEvent>
@@ -43,7 +42,7 @@
   }
 
   QByteArray data;
-  QDataStream ds(data, QIODevice::WriteOnly);
+  QDataStream ds(&data, QIODevice::WriteOnly);
   ds << entries;
   drag->setEncodedData(data);
 
@@ -52,18 +51,18 @@
 
 
 void VectorListView::dragMoveEvent(QDragMoveEvent *e) {
-  e->accept(e->provides("application/x-kst-vector-list") && e->source() != this);
+  if (e->mimeData()->hasFormat("application/x-kst-vector-list") && e->source() != this)
+    e->acceptProposedAction();
 }
 
 
 void VectorListView::dropEvent(QDropEvent *e) {
-  if (!e->provides("application/x-kst-vector-list") || e->source() == this) {
-    e->accept(false);
+  if (!e->mimeData()->hasFormat("application/x-kst-vector-list") || e->source() == this) {
     return;
   }
 
   QByteArray data = e->encodedData("application/x-kst-vector-list");
-  QDataStream ds(data, QIODevice::ReadOnly);
+  QDataStream ds(&data, QIODevice::ReadOnly);
   QStringList entries;
   ds >> entries;
   Q3ListViewItem *last = lastItem();
@@ -75,7 +74,7 @@
   }
 
   clearSelection();
-  e->accept(true);
+  e->acceptProposedAction();
   emit dropped(e);
 }
 
@@ -84,7 +83,7 @@
   Q3DragObject *o = dragObject();
   if (o && o->dragMove()) {
     QByteArray data = o->encodedData("application/x-kst-vector-list");
-    QDataStream ds(data, QIODevice::ReadOnly);
+    QDataStream ds(&data, QIODevice::ReadOnly);
     QStringList entries;
     ds >> entries;
     for (QStringList::ConstIterator i = entries.begin(); i != entries.end(); ++i) {


More information about the Kst mailing list