[Kst] branches/work/kst/portto4/kst/src/libkstapp

Mike Fenton mike at staikos.net
Thu Jun 12 22:17:32 CEST 2008


SVN commit 819992 by fenton:

Fixes for shortcut Key conflicts with plots and menus.


 M  +5 -0      plotitem.cpp  
 M  +1 -0      plotitem.h  
 M  +5 -0      plotrenderitem.cpp  
 M  +2 -0      plotrenderitem.h  
 M  +2 -1      view.cpp  
 M  +1 -1      viewitem.cpp  
 M  +2 -1      viewitem.h  


--- branches/work/kst/portto4/kst/src/libkstapp/plotitem.cpp #819991:819992
@@ -1613,6 +1613,11 @@
 }
 
 
+bool PlotItem::tryShortcut(const QString &keySequence) {
+  return ViewItem::tryShortcut(keySequence);
+}
+
+
 void PlotItem::setProjectionRect(const QRectF &rect) {
   if (!(_projectionRect == rect || rect.isEmpty() || !rect.isValid())) {
 #if DEBUG_ZOOM
--- branches/work/kst/portto4/kst/src/libkstapp/plotitem.h #819991:819992
@@ -164,6 +164,7 @@
 
     void triggerUpdate() { emit geometryChanged(); update(rect()); }
     virtual void addToMenuForContextEvent(QMenu &menu);
+    virtual bool tryShortcut(const QString &keySequence);
 
   Q_SIGNALS:
     void marginsChanged();
--- branches/work/kst/portto4/kst/src/libkstapp/plotrenderitem.cpp #819991:819992
@@ -738,6 +738,11 @@
   *max = maximum;
 }
 
+
+bool PlotRenderItem::tryShortcut(const QString &keySequence) {
+  return plotItem()->tryShortcut(keySequence);
 }
 
+}
+
 // vim: ts=2 sw=2 et
--- branches/work/kst/portto4/kst/src/libkstapp/plotrenderitem.h #819991:819992
@@ -64,6 +64,8 @@
     void computeBorder(Qt::Orientation orientation, qreal *min, qreal *max) const;
     void resetSelectionRect();
 
+    virtual bool tryShortcut(const QString &keySequence);
+
   public Q_SLOTS:
     virtual void edit();
     virtual void raise();
--- branches/work/kst/portto4/kst/src/libkstapp/view.cpp #819991:819992
@@ -207,8 +207,9 @@
       if (!viewItem)
         continue;
 
-      if (viewItem && viewItem->tryShortcut(e->key()))
+      if (viewItem && viewItem->hasFocus() && viewItem->tryShortcut(e->key())) {
         return true;
+      }
     }
   }
 
--- branches/work/kst/portto4/kst/src/libkstapp/viewitem.cpp #819991:819992
@@ -1730,7 +1730,7 @@
 
 void ViewItem::registerShortcut(QAction *action) {
   Q_ASSERT(action->parent() == this);
-  parentView()->grabShortcut(action->shortcut(), Qt::ApplicationShortcut);
+  parentView()->grabShortcut(action->shortcut());
   _shortcutMap.insert(action->shortcut(), action);
 }
 
--- branches/work/kst/portto4/kst/src/libkstapp/viewitem.h #819991:819992
@@ -134,6 +134,8 @@
     void setAcceptsContextMenuEvents(bool acceptsContextMenuEvents)
     { _acceptsContextMenuEvents = acceptsContextMenuEvents; }
 
+    virtual bool tryShortcut(const QString &keySequence);
+
   Q_SIGNALS:
     void geometryChanged();
     void creationComplete();
@@ -202,7 +204,6 @@
     void updateView();
 
   private:
-    bool tryShortcut(const QString &keySequence);
     virtual void updateChildGeometry(const QRectF &oldParentRect, const QRectF &newParentRect);
 
   private:


More information about the Kst mailing list