[Kst] branches/work/kst/portto4/kst/src
Barth Netterfield
netterfield at astro.utoronto.ca
Fri Jun 15 23:43:03 UTC 2012
SVN commit 1300975 by netterfield:
Optimizations for data wizard for cases with thousands/tens of thousands
of fields.
M +1 -1 libkst/updatemanager.cpp
M +16 -1 libkstapp/datawizard.cpp
U widgets/datasourceselectordialog.cpp
--- branches/work/kst/portto4/kst/src/libkst/updatemanager.cpp #1300974:1300975
@@ -121,7 +121,7 @@
else if (retval == Object::NoChange) n_unchanged++;
}
maxloop = qMin(maxloop,n_deferred);
- //qDebug() << "loop: " << i_loop << " obj up: " << n_updated << " obj def: " << n_deferred << " obj_no: " << n_unchanged;
+ //qDebug() << "loop: " << i_loop << " obj up: " << n_updated << " obj def: " << n_deferred << " obj_no: " << n_unchanged << "dt:" << double(_time.elapsed())/1000.0;
i_loop++;
} while ((n_deferred + n_updated > 0) && (i_loop<=maxloop));
--- branches/work/kst/portto4/kst/src/libkstapp/datawizard.cpp #1300974:1300975
@@ -247,6 +247,7 @@
void DataWizardPageVectors::add() {
+
for (int i = 0; i < _vectors->count(); i++) {
if (_vectors->item(i) && _vectors->item(i)->isSelected()) {
_vectorsToPlot->addItem(_vectors->takeItem(i));
@@ -297,6 +298,7 @@
QRegExp re(filter, Qt::CaseSensitive, QRegExp::Wildcard);
QStringList selected;
+
for (int i = 0; i < _vectors->count(); i++) {
QListWidgetItem *item = _vectors->item(i);
if (re.exactMatch(item->text())) {
@@ -305,10 +307,24 @@
i--;
}
}
+
_vectors->insertItems(0, selected);
+
+ // special case optimization:
+ // selecting and unselecting individual items is expensive,
+ // but selecting all of them is fast,
+ // so either select or select all, then unselect, which ever is fewer.
+ if (selected.count() > _vectors->count()/2) {
+ _vectors->selectAll();
+ for (int i=selected.count(); i<_vectors->count(); i++) {
+ _vectors->item(i)->setSelected(false);
+ }
+ } else {
for (int i=0; i<selected.count(); i++) {
_vectors->item(i)->setSelected(true);
}
+ }
+
if (selected.count()>0) {
_vectors->scrollToTop();
}
@@ -870,7 +886,6 @@
xv = kst_cast<Vector>(_pageDataPresentation->selectedVector());
}
- // only create create the y-vectors
{
DataVectorPtr vector;
for (int i = 0; i < _pageVectors->plotVectors()->count(); i++) {
More information about the Kst
mailing list