Showing with 9 additions and 45 deletions.
  1. +0 −11 src/libkst/vector.cpp
  2. +0 −4 src/libkst/vector.h
  3. +9 −15 src/libkstapp/vectormodel.cpp
  4. +0 −2 src/libkstapp/vectormodel.h
  5. +0 −12 src/libkstapp/viewvectordialog.cpp
  6. +0 −1 src/libkstapp/viewvectordialog.h
11 changes: 0 additions & 11 deletions src/libkst/vector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -376,12 +376,6 @@ void Vector::blank() {
updateScalars();
}

void Vector::setValue(int index, double value)
{
_v[index] = value;
internalUpdate();
}


bool Vector::resize(int sz, bool init) {
if (sz > 0) {
Expand Down Expand Up @@ -601,11 +595,6 @@ bool Vector::saveable() const {
return _saveable;
}

void Vector::setSaveable(bool saveable)
{
_saveable = saveable;
}


bool Vector::editable() const {
return _editable;
Expand Down
4 changes: 0 additions & 4 deletions src/libkst/vector.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,6 @@ class KSTCORE_EXPORT Vector : public Primitive
/** Make the vector truly empty. All values set to NOPOINT (NaN). */
void blank();

/** Set the value at a give index. */
void setValue(int index, double value);

/* Generally you don't need to call this */
void updateScalars();

Expand All @@ -149,7 +146,6 @@ class KSTCORE_EXPORT Vector : public Primitive
bool isScalarList() const { return _isScalarList; }

bool saveable() const;
void setSaveable(bool saveable);

bool editable() const;
void setEditable(bool editable);
Expand Down
24 changes: 9 additions & 15 deletions src/libkstapp/vectormodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,13 @@ QVariant VectorModel::headerData(int section, Qt::Orientation orientation, int r

Qt::ItemFlags VectorModel::flags(const QModelIndex& index) const {
Qt::ItemFlags f = QAbstractItemModel::flags(index);
if (_vectorList.isEmpty() || !index.isValid()) {
if (!_vectorList.isEmpty() || !index.isValid()) {
return f;
}

if (_vectorList.at(index.column())->editable() && index.row() >= 0 && index.row() < _vectorList.at(index.column())->length()) {
f |= Qt::ItemIsEditable;
}
// if (_vector->editable() && index.row() >= 0 && index.row() < _vector->length()) {
// f |= Qt::ItemIsEditable;
// }

return f;
}
Expand All @@ -143,7 +143,7 @@ bool VectorModel::setData(const QModelIndex& index, const QVariant& value, int r
return QAbstractItemModel::setData(index, value, role);
}

if (_vectorList.isEmpty() || !index.isValid() || !_vectorList.at(index.column())->editable() || index.row() < 0 || index.row() >= rowCount()) {
if (!_vectorList.isEmpty() || !index.isValid() || !_vectorList.at(index.column())->editable() || index.row() < 0 || index.row() >= rowCount()) {
return false;
}

Expand All @@ -153,10 +153,9 @@ bool VectorModel::setData(const QModelIndex& index, const QVariant& value, int r
return false;
}

// qDebug() << "UGLY!! Add setData API to KstVector!";
// double *d = const_cast<double*>(_vectorList.at(index.column())->value());
// d[index.row()] = v;
vectorAtIndex(index.column())->setValue(index.row(), v);
qDebug() << "UGLY!! Add setData API to KstVector!";
double *d = const_cast<double*>(_vectorList.at(index.column())->value());
d[index.row()] = v;
return true;
}

Expand All @@ -168,12 +167,7 @@ void VectorModel::resetIfChanged() {
}

void VectorModel::setDigitNumber(int column, int nbDigits) {
_digitNbList[column] = nbDigits;
}

VectorPtr VectorModel::vectorAtIndex(int index)
{
return _vectorList.at(index);
_digitNbList[column] = nbDigits;
}

}
Expand Down
2 changes: 0 additions & 2 deletions src/libkstapp/vectormodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ class VectorModel : public QAbstractTableModel
bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole);
void resetIfChanged();
void setDigitNumber(int column, int nbDigits);
VectorPtr vectorAtIndex(int index);

private:
VectorList _vectorList;
QList<int> _digitNbList;
Expand Down
12 changes: 0 additions & 12 deletions src/libkstapp/viewvectordialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ void ViewVectorDialog::contextMenu(const QPoint& position) {
QMenu menu;
QPoint cursor = QCursor::pos();
QAction* removeAction = menu.addAction(tr("Remove"));
QAction* makeEditableAction = menu.addAction(tr("Make editable"));
// Add submenu to select nb of digits
QMenu* submenu = new QMenu(tr("Significant digits"));
QAction* digitNb0Action = submenu->addAction(tr("Show as int"));
Expand All @@ -121,9 +120,6 @@ void ViewVectorDialog::contextMenu(const QPoint& position) {
if (selectedItem == removeAction) {
removeSelected();
return;
} else if (selectedItem == makeEditableAction) {
makeEditable();
return;
} else if (selectedItem == digitNb0Action) {
digits = 0;
} else if (selectedItem == digitNb3Action) {
Expand Down Expand Up @@ -215,14 +211,6 @@ QList<int> ViewVectorDialog::selectedColumns() {
return columns;
}

void ViewVectorDialog::makeEditable() {
int column;
foreach (column, selectedColumns()) {
// VectorPtr vector = kst_cast<Vector>(_doc->objectStore()->retrieveObject(objectName));
_model->vectorAtIndex(column)->setEditable(true);
_model->vectorAtIndex(column)->setSaveData(true);
}
}

}

Expand Down
1 change: 0 additions & 1 deletion src/libkstapp/viewvectordialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ private Q_SLOTS:
void reset();
void showVectorList();
void hideVectorList();
void makeEditable();

private:
QList<int> selectedColumns();
Expand Down