[Kst] branches/work/kst/portto4/kst/src/libkstapp
Peter Kümmel
syntheticpp at gmx.net
Tue Sep 28 21:57:28 CEST 2010
SVN commit 1180754 by kuemmel:
add option "highlight point"
M +17 -15 mainwindow.cpp
M +4 -4 mainwindow.h
M +5 -3 plotrenderitem.cpp
--- branches/work/kst/portto4/kst/src/libkstapp/mainwindow.cpp #1180753:1180754
@@ -70,7 +70,8 @@
_bugReportWizard(0),
_applicationSettingsDialog(0),
_aboutDialog(0),
- _dataMode(false) {
+ _highlightPoint(false)
+{
_doc = new Document(this);
_tabWidget = new TabWidget(this);
_undoGroup = new QUndoGroup(this);
@@ -128,15 +129,17 @@
if (layoutMode) {
v->setViewMode(View::Layout);
+ _highlightPointAct->setEnabled(false);
+ _tiedZoomAct->setEnabled(false);
} else {
v->setViewMode(View::Data);
+ _highlightPointAct->setEnabled(true);
+ _tiedZoomAct->setEnabled(true);
}
- setDataMode(!layoutMode);
}
-// TODO cleanup _dataMode & Co.: there's also a datamode in View!
-void MainWindow::setDataMode(bool dataMode) {
- _dataMode = dataMode;
+void MainWindow::setHighlightPoint(bool highlight) {
+ _highlightPoint = highlight;
}
void MainWindow::changeZoomOnlyMode(QAction* act) {
@@ -860,15 +863,14 @@
_tiedZoomAct->setShortcut(QString("t"));
connect(_tiedZoomAct, SIGNAL(triggered()), this, SLOT(toggleTiedZoom()));
- /*
- TODO CLEANUP
- _dataModeAct = new QAction(tr("&Data Mode"), this);
- _dataModeAct->setStatusTip(tr("Toggle the current view's data mode"));
- _dataModeAct->setIcon(QPixmap(":kst_datamode.png"));
- _dataModeAct->setCheckable(true);
- connect(_dataModeAct, SIGNAL(toggled(bool)), this, SLOT(setDataMode(bool)));
- */
+ _highlightPointAct = new QAction(tr("&Highlight data point"), this);
+ _highlightPointAct->setStatusTip(tr("Highlight closest data point"));
+ _highlightPointAct->setIcon(QPixmap(":kst_datamode.png"));
+ _highlightPointAct->setCheckable(true);
+ connect(_highlightPointAct, SIGNAL(toggled(bool)), this, SLOT(setHighlightPoint(bool)));
+
+
// Then, exclusive interaction modes
QActionGroup* _interactionModeGroup = new QActionGroup(this);
@@ -1055,7 +1057,7 @@
_modeMenu->addSeparator();
// Options
_modeMenu->addAction(_tiedZoomAct);
- // TODO _modeMenu->addAction(_dataModeAct);
+ _modeMenu->addAction(_highlightPointAct);
_toolsMenu = menuBar()->addMenu(tr("&Tools"));
_toolsMenu->addAction(_dataManagerAct);
@@ -1110,7 +1112,7 @@
_modeToolBar = addToolBar(tr("Mode"));
_modeToolBar->setObjectName("Mode Toolbar");
_modeToolBar->addAction(_tiedZoomAct);
- // TODO _modeToolBar->addAction(_dataModeAct);
+ _modeToolBar->addAction(_highlightPointAct);
_modeToolBar->addSeparator();
_modeToolBar->addAction(_standardZoomAct);
_modeToolBar->addAction(_xOnlyZoomAct);
--- branches/work/kst/portto4/kst/src/libkstapp/mainwindow.h #1180753:1180754
@@ -51,7 +51,7 @@
Document *document() const;
QProgressBar *progressBar() const;
bool initFromCommandLine();
- bool isDataMode() { return _dataMode; }
+ bool isHighlightPoint() { return _highlightPoint; }
void setStatusMessage(QString message);
public Q_SLOTS:
@@ -126,7 +126,7 @@
void setLayoutMode(bool layoutMode);
void toggleTiedZoom();
- void setDataMode(bool dataMode);
+ void setHighlightPoint(bool);
void changeZoomOnlyMode(QAction*);
protected:
@@ -161,7 +161,7 @@
QPointer<QProgressBar> _progressBar;
QLabel *_messageLabel;
- bool _dataMode;
+ bool _highlightPoint;
QMenu *_fileMenu;
QMenu *_editMenu;
@@ -217,7 +217,7 @@
QAction *_layoutModeAct;
QAction *_tiedZoomAct;
- QAction *_dataModeAct;
+ QAction *_highlightPointAct;
QAction *_standardZoomAct;
QAction *_xOnlyZoomAct;
QAction *_yOnlyZoomAct;
--- branches/work/kst/portto4/kst/src/libkstapp/plotrenderitem.cpp #1180753:1180754
@@ -301,7 +301,7 @@
void PlotRenderItem::paintHighlightPoint(QPainter *painter) {
- if (_highlightPointActive && kstApp->mainWindow()->isDataMode() && plotItem()->projectionRect().contains(_highlightPoint)) {
+ if (_highlightPointActive && kstApp->mainWindow()->isHighlightPoint() && plotItem()->projectionRect().contains(_highlightPoint)) {
QPointF point = plotItem()->mapToPlot(_highlightPoint);
painter->save();
painter->setPen(QPen(QColor("gray"), 1));
@@ -545,8 +545,10 @@
processHoverMoveEvent(p);
- if (kstApp->mainWindow()->isDataMode()) update();
+ if (kstApp->mainWindow()->isHighlightPoint()) {
+ update();
}
+}
void PlotRenderItem::processHoverMoveEvent(const QPointF &p) {
@@ -555,7 +557,7 @@
}
const QPointF point = plotItem()->mapToProjection(p);
- if (kstApp->mainWindow()->isDataMode()) {
+ if (kstApp->mainWindow()->isHighlightPoint()) {
highlightNearestDataPoint(point);
} else {
_highlightPointActive = false;
More information about the Kst
mailing list