[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [labplot/gsoc2015_VTK_integration] src/backend/worksheet/plots/3d: Fixing the Plot3D widget to make
From: Minh Ngo <nlminhtl () gmail ! com>
Date: 2015-06-02 19:03:51
Message-ID: E1YzrTb-0002xx-8R () scm ! kde ! org
[Download RAW message or body]
Git commit e2ed5c27227bf6c402be506d0b74e23556d93977 by Minh Ngo.
Committed on 02/06/2015 at 19:03.
Pushed by minhngo into branch 'gsoc2015_VTK_integration'.
Fixing the Plot3D widget to make it appear after creation.
M +13 -2 src/backend/worksheet/plots/3d/Plot3D.cpp
M +2 -1 src/backend/worksheet/plots/3d/Plot3DPrivate.h
http://commits.kde.org/labplot/e2ed5c27227bf6c402be506d0b74e23556d93977
diff --git a/src/backend/worksheet/plots/3d/Plot3D.cpp \
b/src/backend/worksheet/plots/3d/Plot3D.cpp index a9bba3d..8351f56 100644
--- a/src/backend/worksheet/plots/3d/Plot3D.cpp
+++ b/src/backend/worksheet/plots/3d/Plot3D.cpp
@@ -65,7 +65,9 @@ QIcon Plot3D::icon() const{
}
void Plot3D::setRect(const QRectF &rect){
- m_plotArea->setRect(rect);
+ Q_D(Plot3D);
+ d->rect = rect;
+ d->retransform();
}
/////////////////////////////////////////////////////////////////////////////
@@ -74,7 +76,16 @@ Plot3DPrivate::Plot3DPrivate(Plot3D* owner)
: AbstractPlotPrivate(owner), q(owner){
}
+void Plot3DPrivate::retransform(){
+ prepareGeometryChange();
+ setPos( rect.x()+rect.width()/2, rect.y()+rect.height()/2);
+
+ //plotArea position is always (0, 0) in parent's coordinates, don't need to update \
here + q->plotArea()->setRect(rect);
+
+ WorksheetElementContainerPrivate::recalcShapeAndBoundingRect();
+}
+
void Plot3DPrivate::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, \
QWidget * widget){
- painter->fillRect(q->plotArea()->rect(), QBrush(Qt::red));
WorksheetElementContainerPrivate::paint(painter, option, widget);
}
\ No newline at end of file
diff --git a/src/backend/worksheet/plots/3d/Plot3DPrivate.h \
b/src/backend/worksheet/plots/3d/Plot3DPrivate.h index 7fb8fb3..bdfd4e3 100644
--- a/src/backend/worksheet/plots/3d/Plot3DPrivate.h
+++ b/src/backend/worksheet/plots/3d/Plot3DPrivate.h
@@ -36,7 +36,8 @@ class Plot3DPrivate:public AbstractPlotPrivate{
public:
explicit Plot3DPrivate(Plot3D* owner);
- void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget* widget = 0);
+ virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget* widget = \
0); + virtual void retransform();
Plot3D* const q;
};
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic