[Kst] branches/work/kst/portto4/kst/src/libkstapp
Mike Fenton
mike at staikos.net
Tue Dec 30 16:55:50 CET 2008
SVN commit 903467 by fenton:
Add specialized context menu for layout/data mode for SharedAxisBoxItem.
M +11 -0 plotitem.cpp
M +15 -0 plotrenderitem.cpp
M +2 -0 plotrenderitem.h
M +5 -0 sharedaxisboxitem.cpp
M +1 -0 sharedaxisboxitem.h
--- branches/work/kst/portto4/kst/src/libkstapp/plotitem.cpp #903466:903467
@@ -29,6 +29,7 @@
#include "plotitemdialog.h"
#include "dialoglauncher.h"
+#include "sharedaxisboxitem.h"
#include "applicationsettings.h"
@@ -382,6 +383,16 @@
void PlotItem::addToMenuForContextEvent(QMenu &menu) {
+ if (parentItem()) {
+ if (SharedAxisBoxItem *sharedBox = qgraphicsitem_cast<SharedAxisBoxItem*>(parentItem())) {
+ if (parentView()->viewMode() == View::Data) {
+ QAction *breakSharedBox = new QAction(tr("Break Shared Axis Box"), this);
+ breakSharedBox->setShortcut(Qt::Key_B);
+ connect(breakSharedBox, SIGNAL(triggered()), sharedBox, SLOT(breakShare()));
+ menu.addAction(breakSharedBox);
+ }
+ }
+ }
_zoomLogX->setChecked(xAxis()->axisLog());
_zoomLogY->setChecked(yAxis()->axisLog());
menu.addMenu(_zoomMenu);
--- branches/work/kst/portto4/kst/src/libkstapp/plotrenderitem.cpp #903466:903467
@@ -17,6 +17,7 @@
#include "application.h"
#include "objectstore.h"
#include "updatemanager.h"
+#include "sharedaxisboxitem.h"
#include <QTime>
#include <QMenu>
@@ -780,6 +781,20 @@
return plotItem()->tryShortcut(keySequence);
}
+
+void PlotRenderItem::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) {
+ if (plotItem() && plotItem()->parentItem()) {
+ if (SharedAxisBoxItem *sharedBox = qgraphicsitem_cast<SharedAxisBoxItem*>(plotItem()->parentItem())) {
+ if (plotItem()->parentView()->viewMode() == View::Layout) {
+ sharedBox->triggerContextEvent(event);
+ return;
+ }
+ }
+ }
+ ViewItem::contextMenuEvent(event);
}
+
+}
+
// vim: ts=2 sw=2 et
--- branches/work/kst/portto4/kst/src/libkstapp/plotrenderitem.h #903466:903467
@@ -80,6 +80,8 @@
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
+ virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent *event);
+
virtual void keyPressEvent(QKeyEvent *event);
virtual void keyReleaseEvent(QKeyEvent *event);
--- branches/work/kst/portto4/kst/src/libkstapp/sharedaxisboxitem.cpp #903466:903467
@@ -174,6 +174,11 @@
}
+void SharedAxisBoxItem::triggerContextEvent(QGraphicsSceneContextMenuEvent *event) {
+ contextMenuEvent(event);
+}
+
+
void CreateSharedAxisBoxCommand::createItem() {
_item = new SharedAxisBoxItem(_view);
_view->setCursor(Qt::CrossCursor);
--- branches/work/kst/portto4/kst/src/libkstapp/sharedaxisboxitem.h #903466:903467
@@ -28,6 +28,7 @@
virtual void paint(QPainter *painter);
virtual void addToMenuForContextEvent(QMenu &menu);
+ void triggerContextEvent(QGraphicsSceneContextMenuEvent *event);
Q_SIGNALS:
void breakShareSignal();
More information about the Kst
mailing list