[Kst] branches/work/kst/portto4/kst/src
Mike Fenton
mike at staikos.net
Wed Oct 24 17:00:56 CEST 2007
SVN commit 728880 by fenton:
Add implementation of matrix selector. Also made signal updates to
MatrixSelector.
M +4 -1 libkstapp/libkstapp.pro
M +15 -0 libkstapp/mainwindow.cpp
M +4 -0 libkstapp/mainwindow.h
A libkstapp/matrixeditordialog.cpp [License: GPL (v2+)]
A libkstapp/matrixeditordialog.h [License: GPL (v2+)]
A libkstapp/matrixeditordialog.ui
M +18 -2 widgets/matrixselector.cpp
M +4 -0 widgets/matrixselector.h
--- branches/work/kst/portto4/kst/src/libkstapp/libkstapp.pro #728879:728880
@@ -64,8 +64,9 @@
layouttab.cpp \
lineitem.cpp \
mainwindow.cpp \
+ matrixdialog.cpp \
+ matrixeditordialog.cpp \
matrixmodel.cpp \
- matrixdialog.cpp \
memorywidget.cpp \
pictureitem.cpp \
plotaxisitem.cpp \
@@ -142,6 +143,7 @@
lineitem.h \
mainwindow.h \
matrixdialog.h \
+ matrixeditordialog.h \
matrixmodel.h \
memorywidget.h \
pictureitem.h \
@@ -191,6 +193,7 @@
histogramtab.ui \
imagetab.ui \
layouttab.ui \
+ matrixeditordialog.ui \
matrixtab.ui \
powerspectrumtab.ui \
scalareditordialog.ui \
--- branches/work/kst/portto4/kst/src/libkstapp/mainwindow.cpp #728879:728880
@@ -30,6 +30,7 @@
#include "ui_aboutdialog.h"
#include "vectoreditordialog.h"
#include "scalareditordialog.h"
+#include "matrixeditordialog.h"
#include "view.h"
#include "viewmanager.h"
@@ -512,6 +513,10 @@
_scalarEditorAct->setStatusTip(tr("Show all scalars in a spreadsheet"));
connect(_scalarEditorAct, SIGNAL(triggered()), this, SLOT(showScalarEditor()));
+ _matrixEditorAct = new QAction(tr("Edit &Matrix..."), this);
+ _matrixEditorAct->setStatusTip(tr("Show all matrix in a spreadsheet"));
+ connect(_matrixEditorAct, SIGNAL(triggered()), this, SLOT(showMatrixEditor()));
+
_exportGraphicsAct = new QAction(tr("&Export..."), this);
_exportGraphicsAct->setStatusTip(tr("Export graphics to disk"));
connect(_exportGraphicsAct, SIGNAL(triggered()), this, SLOT(showExportGraphicsDialog()));
@@ -552,6 +557,7 @@
_dataMenu->addSeparator();
_dataMenu->addAction(_vectorEditorAct);
_dataMenu->addAction(_scalarEditorAct);
+ _dataMenu->addAction(_matrixEditorAct);
_viewMenu = menuBar()->addMenu(tr("&View"));
_viewMenu->addAction(_viewManagerAct);
@@ -597,6 +603,7 @@
_dataToolBar->addAction(_dataManagerAct);
// _dataToolBar->addAction(_vectorEditorAct); //no icon
// _dataToolBar->addAction(_scalarEditorAct); //no icon
+// _dataToolBar->addAction(_matrixEditorAct); //no icon
_viewToolBar = addToolBar(tr("View"));
_viewToolBar->addAction(_viewManagerAct);
@@ -674,6 +681,14 @@
}
+void MainWindow::showMatrixEditor() {
+ if (!_matrixEditor) {
+ _matrixEditor = new MatrixEditorDialog(this, _doc);
+ }
+ _matrixEditor->show();
+}
+
+
void MainWindow::showDebugDialog() {
if (!_debugDialog) {
_debugDialog = new DebugDialog(this);
--- branches/work/kst/portto4/kst/src/libkstapp/mainwindow.h #728879:728880
@@ -26,6 +26,7 @@
class DebugDialog;
class Document;
class ExportGraphicsDialog;
+class MatrixEditorDialog;
class ScalarEditorDialog;
class TabWidget;
class VectorEditorDialog;
@@ -50,6 +51,7 @@
void showExportGraphicsDialog();
void showVectorEditor();
void showScalarEditor();
+ void showMatrixEditor();
void showViewManager();
void showSettingsDialog();
@@ -105,6 +107,7 @@
ExportGraphicsDialog *_exportGraphics;
VectorEditorDialog *_vectorEditor;
ScalarEditorDialog *_scalarEditor;
+ MatrixEditorDialog *_matrixEditor;
ViewManager *_viewManager;
QPointer<QProgressBar> _progressBar;
@@ -149,6 +152,7 @@
QAction *_saveAsAct;
QAction *_scalarEditorAct;
QAction *_vectorEditorAct;
+ QAction *_matrixEditorAct;
QAction *_viewManagerAct;
QAction *_layoutModeAct;
--- branches/work/kst/portto4/kst/src/widgets/matrixselector.cpp #728879:728880
@@ -33,6 +33,8 @@
connect(_newMatrix, SIGNAL(pressed()), this, SLOT(newMatrix()));
connect(_editMatrix, SIGNAL(pressed()), this, SLOT(editMatrix()));
+
+ connect(_matrix, SIGNAL(currentIndexChanged(int)), this, SLOT(matrixSelected(int)));
}
@@ -45,10 +47,18 @@
}
+void MatrixSelector::matrixSelected(int index) {
+ Q_UNUSED(index)
+ if (index != -1)
+ emit selectionChanged();
+}
+
+
void MatrixSelector::setSelectedMatrix(MatrixPtr selectedMatrix) {
int i = _matrix->findData(qVariantFromValue(selectedMatrix.data()));
- Q_ASSERT(i != -1);
- _matrix->setCurrentIndex(i);
+ if (i != -1) {
+ _matrix->setCurrentIndex(i);
+ }
}
@@ -62,6 +72,12 @@
DialogLauncher::self()->showMatrixDialog(ObjectPtr(selectedMatrix()));
}
+
+void MatrixSelector::updateMatrices() {
+ fillMatrices();;
+}
+
+
void MatrixSelector::fillMatrices() {
QHash<QString, MatrixPtr> matrices;
--- branches/work/kst/portto4/kst/src/widgets/matrixselector.h #728879:728880
@@ -33,6 +33,10 @@
Q_SIGNALS:
void selectionChanged();
+ public Q_SLOTS:
+ void updateMatrices();
+ void matrixSelected(int index);
+
private Q_SLOTS:
void newMatrix();
void editMatrix();
More information about the Kst
mailing list