[Kst] branches/work/kst/portto4/kst/src/libkstapp
George Staikos
staikos at kde.org
Mon May 28 20:09:00 CEST 2007
SVN commit 669180 by staikos:
demonstrate how fast we can load and display a million points
M +1 -0 CMakeLists.txt
M +28 -0 mainwindow.cpp
M +2 -0 mainwindow.h
A vectormodel.cpp [License: GPL (v2+)]
A vectormodel.h [License: GPL (v2+)]
--- branches/work/kst/portto4/kst/src/libkstapp/CMakeLists.txt #669179:669180
@@ -10,6 +10,7 @@
lineitem.cpp
labelitem.cpp
viewcommand.cpp
+ vectormodel.cpp
)
kde4_automoc(${kstapp_LIB_SRCS})
--- branches/work/kst/portto4/kst/src/libkstapp/mainwindow.cpp #669179:669180
@@ -19,6 +19,12 @@
#include <QtGui>
+
+
+// Temporaries
+#include <QTableView>
+#include "vectormodel.h"
+
namespace Kst {
MainWindow::MainWindow() {
@@ -124,6 +130,22 @@
}
+void MainWindow::demoModel() {
+ QTableView *view = new QTableView;
+ KstVectorPtr v = new KstVector;
+ v->resize(999999);
+ double *d = const_cast<double *>(v->value()); // yay :)
+ d[0] = 1;
+ for (int i = 1; i < v->length(); ++i) {
+ d[i] = d[i-1] + 0.002;
+ }
+ VectorModel *m = new VectorModel(v);
+ view->setModel(m);
+ view->resize(300, 500);
+ view->show();
+}
+
+
void MainWindow::createActions() {
_undoAct = _undoGroup->createUndoAction(this);
_undoAct->setShortcut(tr("Ctrl+Z"));
@@ -182,6 +204,12 @@
_helpMenu = menuBar()->addMenu(tr("&Help"));
_helpMenu->addAction(_aboutAct);
_helpMenu->addAction(_aboutQtAct);
+
+ // FIXME: remove this later.
+ QMenu *demoMenu = menuBar()->addMenu("&Demo");
+ QAction *demo = new QAction("Vector model", this);
+ connect(demo, SIGNAL(triggered()), this, SLOT(demoModel()));
+ demoMenu->addAction(demo);
}
--- branches/work/kst/portto4/kst/src/libkstapp/mainwindow.h #669179:669180
@@ -46,6 +46,8 @@
void createEllipse();
void createLine();
+ void demoModel();
+
private:
void createActions();
void createMenus();
More information about the Kst
mailing list