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

Adam Treat treat at kde.org
Fri Mar 2 17:55:49 CET 2007


SVN commit 638604 by treat:

* No more QPixmap::resize()
* QStringList::findIndex - QStringList::indexOf
* No more CoordinateMode
* QClipboard->set*Mime*Data


 M  +11 -12    kst2dplot.cpp  


--- branches/work/kst/portto4/kst/src/libkstapp/kst2dplot.cpp #638603:638604
@@ -2312,7 +2312,7 @@
   // FIXME
   // Horribly inefficient, but we need to update contentsRect() somehow
   // before the base class resize happens.
-  _buffer.buffer().resize(size);
+  _buffer.buffer() = QPixmap(size);
   assert(!_buffer.buffer().isNull()); // Want to find these crashes
   if (!_buffer.buffer().isNull()) {    // Because this is garbage
     _buffer.buffer().fill(backgroundColor());
@@ -2437,7 +2437,7 @@
   }
 
   // Precondition: w and h are both > 0
-  _buffer.buffer().resize(size());
+  _buffer.buffer() = QPixmap(size());
   assert(!_buffer.buffer().isNull()); // Want to find these crashes
   if (_buffer.buffer().isNull()) {    // Because this is garbage
     return;
@@ -2496,7 +2496,6 @@
 
   setBorders(xleft_bdr_px, xright_bdr_px, ytop_bdr_px, ybot_bdr_px,
              tpx, tpy, p, offsetX, offsetY, xtick_len_px, ytick_len_px);
-  p.flush();
 
   // use a common plot region for plots that are aligned and of the same
   //  dimension, in either the horizontal or vertical sense...
@@ -2562,7 +2561,6 @@
     bt[i_bt++] = benchTime.elapsed();
 #endif
     plotLabels(p, x_px, y_px, xleft_bdr_px, xright_bdr_px, ytop_bdr_px);
-    p.flush();
 #ifdef BENCHMARK
     bt_label[i_bt] = "Plot Labels";
     bt[i_bt++] = benchTime.elapsed();
@@ -2606,7 +2604,7 @@
       p.scale(1, -1);
       p.translate(0, d2i(-1.0 * Hy - Ly));
     }
-    p.setClipRect(int(Lx), int(Ly), int(Hx - Lx), int(Hy - Ly), QPainter::CoordPainter);
+    p.setClipRect(int(Lx), int(Ly), int(Hx - Lx), int(Hy - Ly));
     for (KstBaseCurveList::Iterator i = Curves.begin(); i != Curves.end(); ++i) {
       (*i)->paint(context);
     }
@@ -2648,8 +2646,6 @@
     bt[i_bt++] = benchTime.elapsed();
 #endif
 
-    p.flush();
-
 #ifdef BENCHMARK
     bt_label[i_bt] = "Flush Painter";
     bt[i_bt++] = benchTime.elapsed();
@@ -2989,13 +2985,13 @@
   // accumulate list of curve labels
   for (KstBaseCurveList::ConstIterator i = Curves.begin(); i != Curves.end(); ++i) {
     (*i)->readLock();
-    if (xlabels.findIndex((*i)->xLabel()) == -1) {
+    if (xlabels.indexOf((*i)->xLabel()) == -1) {
       xlabels.append((*i)->xLabel());
     }
-    if (ylabels.findIndex((*i)->yLabel()) == -1) {
+    if (ylabels.indexOf((*i)->yLabel()) == -1) {
       ylabels.append((*i)->yLabel());
     }
-    if (toplabels.findIndex((*i)->topLabel()) == -1) {
+    if (toplabels.indexOf((*i)->topLabel()) == -1) {
       toplabels.append((*i)->topLabel());
     }
     (*i)->unlock();
@@ -3397,9 +3393,12 @@
 
         plotList.append(tagName());
 
-        PlotMimeSource *newplots = new PlotMimeSource(vw->caption(), plotList);
+        PlotMimeSource *newplots = new PlotMimeSource(vw->windowTitle(), plotList);
 
-        QApplication::clipboard()->setData(newplots, QClipboard::Clipboard);
+        QMimeData mimeData;
+        mimeData.setData(newplots->format(0), newplots->encodedData(newplots->format(0)));
+
+        QApplication::clipboard()->setMimeData(&mimeData, QClipboard::Clipboard);
       }
     }
   }


More information about the Kst mailing list