[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [koffice] plugins/dockers/shapeselector: Avoid calling a c-tor
From: "Dr. Robert Marmorstein" <robert () narnia ! homeunix ! com>
Date: 2011-08-02 9:16:39
Message-ID: 20110802091639.8F9FDA60D8 () git ! kde ! org
[Download RAW message or body]
Git commit 5f95a37ebc2d30b4468f8cb2d4975fee1bc8a720 by Dr. Robert Marmorstein.
Committed on 01/08/2011 at 19:19.
Pushed by robertm into branch 'master'.
Avoid calling a c-tor directly.
M +6 -1 plugins/dockers/shapeselector/SelectStrategy.cpp
M +1 -1 plugins/dockers/shapeselector/RightClickStrategy.cpp
M +2 -0 plugins/dockers/shapeselector/SelectStrategy.h
http://commits.kde.org/koffice/5f95a37ebc2d30b4468f8cb2d4975fee1bc8a720
diff --git a/plugins/dockers/shapeselector/RightClickStrategy.cpp b/plugins/dockers/shapeselector/RightClickStrategy.cpp
index b85c44e..2a196eb 100644
--- a/plugins/dockers/shapeselector/RightClickStrategy.cpp
+++ b/plugins/dockers/shapeselector/RightClickStrategy.cpp
@@ -41,7 +41,7 @@ RightClickStrategy::RightClickStrategy(Canvas *canvas, KShape *clickedShape, KPo
m_clickedShape(clickedShape)
{
m_lastPosition = event.point;
- SelectStrategy(canvas, clickedShape, event); // properly updates the selection
+ SelectStrategy::updateSelection(canvas, clickedShape, event); //Properly update the selection
}
void RightClickStrategy::handleMouseMove(const QPointF &mouseLocation, Qt::KeyboardModifiers modifiers)
diff --git a/plugins/dockers/shapeselector/SelectStrategy.cpp b/plugins/dockers/shapeselector/SelectStrategy.cpp
index b0f6df9..bc07713 100644
--- a/plugins/dockers/shapeselector/SelectStrategy.cpp
+++ b/plugins/dockers/shapeselector/SelectStrategy.cpp
@@ -36,6 +36,12 @@
SelectStrategy::SelectStrategy(Canvas *canvas, KShape *clickedShape, KPointerEvent &event)
: m_canvas(canvas), m_clickedShape(clickedShape)
{
+ updateSelection(canvas, clickedShape, event);
+ m_emitItemSelected = clickedShape;
+}
+
+void SelectStrategy::updateSelection(Canvas *canvas, KShape *clickedShape, KPointerEvent &event)
+{
const bool deselectAll = event.button() == Qt::LeftButton
|| (event.button() == Qt::RightButton && clickedShape);
if (deselectAll) {
@@ -47,7 +53,6 @@ SelectStrategy::SelectStrategy(Canvas *canvas, KShape *clickedShape, KPointerEve
canvas->shapeManager()->selection()->select(clickedShape);
clickedShape->update();
}
- m_emitItemSelected = clickedShape;
}
void SelectStrategy::handleMouseMove(const QPointF &mouseLocation, Qt::KeyboardModifiers modifiers)
diff --git a/plugins/dockers/shapeselector/SelectStrategy.h b/plugins/dockers/shapeselector/SelectStrategy.h
index cc029d8..b6fe2f8 100644
--- a/plugins/dockers/shapeselector/SelectStrategy.h
+++ b/plugins/dockers/shapeselector/SelectStrategy.h
@@ -45,6 +45,8 @@ public:
virtual void handleMouseMove(const QPointF &mouseLocation, Qt::KeyboardModifiers modifiers);
virtual void finishInteraction(Qt::KeyboardModifiers modifiers);
+
+ static void updateSelection(Canvas *canvas, KShape *clickedShape, KPointerEvent &event);
signals:
void itemSelected();
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic