[Kst] branches/work/kst/portto4/kst/src/libkstapp
Mike Fenton
mike at staikos.net
Fri Jan 2 18:26:05 CET 2009
SVN commit 904638 by fenton:
Add persisting of layout when projectRect changes for SharedAxisBoxItem's.
Update contextMenu to remove layout based items for children of SharedAxisBoxItem's.
M +5 -0 plotitem.cpp
M +22 -8 viewitem.cpp
M +1 -0 viewitem.h
--- branches/work/kst/portto4/kst/src/libkstapp/plotitem.cpp #904637:904638
@@ -472,6 +472,11 @@
void PlotItem::marginsUpdated() {
ViewGridLayout::standardizePlotMargins(this);
+ if (isInSharedAxisBox() && parentItem()) {
+ if (SharedAxisBoxItem *sharedBox = qgraphicsitem_cast<SharedAxisBoxItem*>(parentItem())) {
+ sharedBox->sharePlots();
+ }
+ }
}
--- branches/work/kst/portto4/kst/src/libkstapp/viewitem.cpp #904637:904638
@@ -15,6 +15,7 @@
#include "tabwidget.h"
#include "viewitemdialog.h"
#include "viewgridlayout.h"
+#include "sharedaxisboxitem.h"
#include "layoutboxitem.h"
@@ -52,6 +53,7 @@
_hovering(false),
_acceptsChildItems(true),
_acceptsContextMenuEvents(true),
+ _updatingLayout(false),
_activeGrip(NoGrip),
_allowedGrips(TopLeftGrip | TopRightGrip | BottomRightGrip | BottomLeftGrip |
TopMidGrip | RightMidGrip | BottomMidGrip | LeftMidGrip),
@@ -677,7 +679,11 @@
void ViewItem::sharePlots() {
- ViewGridLayout::sharePlots(this);
+ if (!_updatingLayout) {
+ _updatingLayout = true;
+ ViewGridLayout::sharePlots(this);
+ _updatingLayout = false;
+ }
}
@@ -790,16 +796,24 @@
addTitle(&menu);
menu.addAction(_editAction);
- menu.addAction(_raiseAction);
- menu.addAction(_lowerAction);
- QMenu layoutMenu;
- layoutMenu.setTitle(tr("Cleanup Layout"));
+ bool inSharedBox = false;
+ if (parentItem()) {
+ if (SharedAxisBoxItem *sharedBox = qgraphicsitem_cast<SharedAxisBoxItem*>(parentItem())) {
+ inSharedBox = true;
+ }
+ }
- layoutMenu.addAction(_autoLayoutAction);
- layoutMenu.addAction(_customLayoutAction);
+ if (!inSharedBox) {
+ menu.addAction(_raiseAction);
+ menu.addAction(_lowerAction);
- menu.addMenu(&layoutMenu);
+ QMenu layoutMenu;
+ layoutMenu.setTitle(tr("Cleanup Layout"));
+ layoutMenu.addAction(_autoLayoutAction);
+ layoutMenu.addAction(_customLayoutAction);
+ menu.addMenu(&layoutMenu);
+ }
menu.addAction(_deleteAction);
--- branches/work/kst/portto4/kst/src/libkstapp/viewitem.h #904637:904638
@@ -229,6 +229,7 @@
bool _acceptsChildItems;
bool _acceptsContextMenuEvents;
bool _shareAxis;
+ bool _updatingLayout;
QPointF _originalPosition;
QPointF _parentRelativeCenter;
QRectF _originalRect;
More information about the Kst
mailing list