[Kst] branches/work/kst/portto4/kst/src/libkstapp
Barth Netterfield
netterfield at astro.utoronto.ca
Sun Mar 4 00:51:56 UTC 2012
SVN commit 1283427 by netterfield:
Begin to give view object custom dimensions tabs:
First up is circles, which now have center position and radius as their
entry items.
A circledimensionstab.cpp [License: GPL (v2+)]
A circledimensionstab.h [License: GPL (v2+)]
AM circledimensionstab.ui
M +7 -0 circleitem.cpp
M +4 -0 circleitem.h
A circleitemdialog.cpp [License: GPL (v2+)]
A circleitemdialog.h [License: GPL (v2+)]
M +1 -0 dimensionstab.cpp
M +0 -4 labelitem.cpp
M +1 -1 labelitem.h
M +1 -0 viewitem.h
M +8 -0 viewitemdialog.cpp
M +1 -2 viewitemdialog.h
--- branches/work/kst/portto4/kst/src/libkstapp/circleitem.cpp #1283426:1283427
@@ -11,6 +11,7 @@
***************************************************************************/
#include "circleitem.h"
+#include "circleitemdialog.h"
#include <debug.h>
@@ -89,6 +90,12 @@
}
+void CircleItem::edit() {
+ CircleItemDialog *editDialog = new CircleItemDialog(this);
+ editDialog->show();
+}
+
+
void CreateCircleCommand::createItem() {
_item = new CircleItem(_view);
_view->setCursor(Qt::CrossCursor);
--- branches/work/kst/portto4/kst/src/libkstapp/circleitem.h #1283426:1283427
@@ -35,6 +35,10 @@
virtual void save(QXmlStreamWriter &xml);
virtual void paint(QPainter *painter);
virtual void creationPolygonChanged(View::CreationEvent event);
+ virtual bool customDimensionsTab() {return true;}
+ public Q_SLOTS:
+ virtual void edit();
+
};
class CreateCircleCommand : public CreateCommand
--- branches/work/kst/portto4/kst/src/libkstapp/dimensionstab.cpp #1283426:1283427
@@ -81,6 +81,7 @@
void DimensionsTab::clearTabValues() {
_fixAspectRatio->setCheckState(Qt::PartiallyChecked);
+ _lockPosToData->setCheckState(Qt::PartiallyChecked);
_width->clear();
_height->clear();
_rotation->clear();
--- branches/work/kst/portto4/kst/src/libkstapp/labelitem.cpp #1283426:1283427
@@ -370,14 +370,10 @@
if (plot) {
if ((!lockPosToData()) || force || (!_dataRelativeDimValid)) {
_dataRelativeDimValid = ((fabs(rect().width())>1.1) && (fabs(rect().height())>1.1));
- //QPointF P1 = (rect().topLeft() + rect().bottomLeft())/2;
- //QPointF P2 = (rect().topRight() + rect().bottomRight())/2;
QPointF P1 = rect().bottomLeft();
QPointF P2 = rect().bottomRight();
_dataRelativeRect.setTopLeft(plot->plotItem()->mapToProjection(mapToParent(P1)));
_dataRelativeRect.setBottomRight(plot->plotItem()->mapToProjection(mapToParent(P2)));
- //qDebug() << "rel rect tl" << _dataRelativeRect.topLeft() << "rel rect br" << _dataRelativeRect.bottomRight();
- //_dataRelativeRect.moveCenter(plot->plotItem()->mapToProjection(mapToParent(rect().center())));
}
}
}
--- branches/work/kst/portto4/kst/src/libkstapp/labelitem.h #1283426:1283427
@@ -64,7 +64,7 @@
public Q_SLOTS:
virtual void edit();
- void setDirty() { _dirty = true; };
+ void setDirty() { _dirty = true; }
void triggerUpdate();
protected Q_SLOTS:
--- branches/work/kst/portto4/kst/src/libkstapp/viewitem.h #1283426:1283427
@@ -272,6 +272,7 @@
void setLeft(qreal x);
void setRight(qreal x);
void setLockPosToData(bool lockPosToData);
+ virtual bool customDimensionsTab() {return false;}
protected:
virtual QPainterPath topLeftGrip() const;
--- branches/work/kst/portto4/kst/src/libkstapp/viewitemdialog.cpp #1283426:1283427
@@ -103,12 +103,16 @@
page->addDialogTab(_layoutTab);
addDialogPage(page);
+ if (!_item->customDimensionsTab()) {
_dimensionsTab = new DimensionsTab(_item, this);
DialogPage *dimensionsPage = new DialogPage(this);
dimensionsPage->setPageTitle(tr("Size/Position"));
dimensionsPage->addDialogTab(_dimensionsTab);
addDialogPage(dimensionsPage);
connect(_dimensionsTab, SIGNAL(apply()), this, SLOT(dimensionsChanged()));
+ } else {
+ _dimensionsTab = 0;
+ }
QList<DialogPage*> dialogPages = _item->dialogPages();
foreach (DialogPage *dialogPage, dialogPages)
@@ -121,7 +125,9 @@
selectDialogPage(page);
+ if (!_item->customDimensionsTab()) {
connect(_dimensionsTab, SIGNAL(tabModified()), this, SLOT(modified()));
+ }
connect(this, SIGNAL(editMultipleMode()), this, SLOT(setMultipleEdit()));
connect(this, SIGNAL(editSingleMode()), this, SLOT(setSingleEdit()));
@@ -219,9 +225,11 @@
void ViewItemDialog::setupDimensions() {
+ if (_dimensionsTab) {
_dimensionsTab->enableSingleEditOptions(true);
_dimensionsTab->setupDimensions();
}
+}
void ViewItemDialog::fillChanged() {
--- branches/work/kst/portto4/kst/src/libkstapp/viewitemdialog.h #1283426:1283427
@@ -50,7 +50,6 @@
EditMode editMode() const { return _mode; }
- DialogPage *dimensionsPage;
DimensionsTab *_dimensionsTab;
public Q_SLOTS:
void setSingleEdit();
@@ -77,7 +76,7 @@
void saveFill(ViewItem *item);
void saveStroke(ViewItem *item);
void saveLayout(ViewItem *item);
- void saveDimensions(ViewItem *item);
+ virtual void saveDimensions(ViewItem *item);
private:
QPointer<ViewItem> _item;
More information about the Kst
mailing list