[Kst] branches/work/kst/portto4/kst/src/libkstapp
Peter Kümmel
syntheticpp at gmx.net
Mon Aug 30 14:41:41 CEST 2010
SVN commit 1169970 by kuemmel:
enable shortcuts on moved plots
BUG: 249253
M +3 -0 plotrenderitem.cpp
M +6 -0 view.cpp
M +13 -3 viewitem.cpp
M +1 -0 viewitem.h
--- branches/work/kst/portto4/kst/src/libkstapp/plotrenderitem.cpp #1169969:1169970
@@ -642,6 +642,9 @@
setFocus(Qt::MouseFocusReason);
+ // Qt bug (Windows only?): http://bugreports.qt.nokia.com/browse/QTBUG-8188
+ //bool foc = hasFocus(); // foc is false in the second tab
+
updateCursor(event->pos());
const QPointF p = plotItem()->mapToProjection(event->pos());
--- branches/work/kst/portto4/kst/src/libkstapp/view.cpp #1169969:1169970
@@ -258,7 +258,13 @@
if (!viewItem)
continue;
+#ifdef Q_OS_WIN
+ // Qt bug (Windows only?): http://bugreports.qt.nokia.com/browse/QTBUG-8188
+ // also see PlotRenderItem::hoverEnterEvent
+ if (viewItem && viewItem->tryShortcut(e->key())) {
+#else
if (viewItem && viewItem->hasFocus() && viewItem->tryShortcut(e->key())) {
+#endif
return true;
}
}
--- branches/work/kst/portto4/kst/src/libkstapp/viewitem.cpp #1169969:1169970
@@ -123,7 +123,8 @@
_customLayoutAction = new QAction(tr("Custom"), this);
connect(_customLayoutAction, SIGNAL(triggered()), this, SLOT(createCustomLayout()));
- setAcceptDrops(true);
+ // only drop plots onto TabBar
+ setAcceptDrops(false);
}
@@ -416,11 +417,11 @@
}
void ViewItem::setParentView(View* parentView) {
-#ifdef KST_DISBALE_QOBJECT_PARENT
_parentView = parentView;
-#else
+#ifndef KST_DISBALE_QOBJECT_PARENT
parentView()->setParent(parent);
#endif
+ reRegisterShortcut();
updateRelativeSize();
}
@@ -1837,6 +1838,15 @@
}
+void ViewItem::reRegisterShortcut() {
+ QHashIterator<QString, QAction*> it(_shortcutMap);
+ while (it.hasNext()) {
+ it.next();
+ _parentView->grabShortcut(it.key());
+ }
+}
+
+
bool ViewItem::tryShortcut(const QString &shortcut) {
if (!_shortcutMap.contains(shortcut))
return false;
--- branches/work/kst/portto4/kst/src/libkstapp/viewitem.h #1169969:1169970
@@ -245,6 +245,7 @@
GripMode nextGripMode(GripMode currentMode) const;
void addTitle(QMenu *menu) const;
void registerShortcut(QAction *action);
+ void reRegisterShortcut();
QString descriptionTip() const;
More information about the Kst
mailing list