Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpenBoard
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lifo
Nicolas Ollinger
OpenBoard
Commits
625c239e
Commit
625c239e
authored
Jun 04, 2013
by
Ilia Ryabokon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Stable selection frame. Transformation fixes
parent
a672c9bf
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
166 additions
and
65 deletions
+166
-65
UBBoardController.cpp
src/board/UBBoardController.cpp
+3
-0
UBBoardView.cpp
src/board/UBBoardView.cpp
+24
-33
UBBoardView.h
src/board/UBBoardView.h
+3
-0
UBGraphicsDelegateFrame.cpp
src/domain/UBGraphicsDelegateFrame.cpp
+6
-5
UBGraphicsItemDelegate.cpp
src/domain/UBGraphicsItemDelegate.cpp
+11
-7
UBGraphicsItemDelegate.h
src/domain/UBGraphicsItemDelegate.h
+2
-1
UBGraphicsPolygonItem.h
src/domain/UBGraphicsPolygonItem.h
+0
-2
UBGraphicsScene.cpp
src/domain/UBGraphicsScene.cpp
+36
-7
UBGraphicsScene.h
src/domain/UBGraphicsScene.h
+4
-4
UBGraphicsStrokesGroup.cpp
src/domain/UBGraphicsStrokesGroup.cpp
+2
-1
UBSelectionFrame.cpp
src/domain/UBSelectionFrame.cpp
+63
-5
UBSelectionFrame.h
src/domain/UBSelectionFrame.h
+12
-0
No files found.
src/board/UBBoardController.cpp
View file @
625c239e
...
...
@@ -179,6 +179,7 @@ void UBBoardController::setupViews()
mControlLayout
->
setContentsMargins
(
0
,
0
,
0
,
0
);
mControlView
=
new
UBBoardView
(
this
,
mControlContainer
,
true
,
false
);
mControlView
->
setObjectName
(
CONTROLVIEW_OBJ_NAME
);
mControlView
->
setInteractive
(
true
);
mControlView
->
setMouseTracking
(
true
);
...
...
@@ -1514,6 +1515,8 @@ void UBBoardController::setActiveDocumentScene(UBDocumentProxy* pDocumentProxy,
updateSystemScaleFactor
();
mControlView
->
setScene
(
mActiveScene
);
disconnect
(
mControlView
,
SIGNAL
(
mouseReleased
()),
mActiveScene
,
SLOT
(
updateSelectionFrame
()));
connect
(
mControlView
,
SIGNAL
(
mouseReleased
()),
mActiveScene
,
SLOT
(
updateSelectionFrame
()));
mDisplayView
->
setScene
(
mActiveScene
);
mActiveScene
->
setBackgroundZoomFactor
(
mControlView
->
transform
().
m11
());
pDocumentProxy
->
setDefaultDocumentSize
(
mActiveScene
->
nominalSize
());
...
...
src/board/UBBoardView.cpp
View file @
625c239e
...
...
@@ -1023,13 +1023,10 @@ void UBBoardView::mousePressEvent (QMouseEvent *event)
// mUBRubberBand->setGeometry (QRect (mMouseDownPos, QSize ()));
// mUBRubberBand->show();
// scene()->updateMultipleSelectionFrame();
scene
()
->
clearSelectionFrame
();
}
if
(
mUBRubberBand
)
{
mUBRubberBand
->
hide
();
scene
()
->
setMultipleSelectionProcess
(
false
);
}
handleItemMousePress
(
event
);
...
...
@@ -1077,7 +1074,6 @@ void UBBoardView::mousePressEvent (QMouseEvent *event)
mRubberBand
->
setGeometry
(
QRect
(
mMouseDownPos
,
QSize
()));
mRubberBand
->
show
();
mIsCreatingSceneGrabZone
=
true
;
scene
()
->
setMultipleSelectionProcess
(
true
);
event
->
accept
();
break
;
...
...
@@ -1102,12 +1098,12 @@ void UBBoardView::mousePressEvent (QMouseEvent *event)
void
UBBoardView
::
mouseMoveEvent
(
QMouseEvent
*
event
)
{
static
QTime
lastCallTime
;
if
(
!
lastCallTime
.
isNull
())
{
qDebug
()
<<
"time interval is "
<<
lastCallTime
.
msecsTo
(
QTime
::
currentTime
());
}
//
static QTime lastCallTime;
//
if (!lastCallTime.isNull()) {
//
qDebug() << "time interval is " << lastCallTime.msecsTo(QTime::currentTime());
//
}
QTime
mouseMoveTime
=
QTime
::
currentTime
();
//
QTime mouseMoveTime = QTime::currentTime();
if
(
!
mIsDragInProgress
&&
((
mapToScene
(
event
->
pos
())
-
mLastPressedMousePos
).
manhattanLength
()
<
QApplication
::
startDragDistance
()))
{
qDebug
()
<<
"mouse move event canceled"
;
...
...
@@ -1165,23 +1161,21 @@ UBBoardView::mouseMoveEvent (QMouseEvent *event)
// mUBRubberBand->setGeometry (QRect (mMouseDownPos, QSize ()));
mUBRubberBand
->
setGeometry
(
bandRect
);
mUBRubberBand
->
show
();
scene
()
->
setMultipleSelectionProcess
(
true
);
QTime
startTime
=
QTime
::
currentTime
();
QTime
testTime
=
QTime
::
currentTime
();
//
QTime startTime = QTime::currentTime();
//
QTime testTime = QTime::currentTime();
QList
<
QGraphicsItem
*>
rubberItems
=
items
(
bandRect
);
qDebug
()
<<
"=================="
;
qDebug
()
<<
"| ====rubber items"
<<
testTime
.
msecsTo
(
QTime
::
currentTime
());
testTime
=
QTime
::
currentTime
();
//
qDebug() << "==================";
//
qDebug() << "| ====rubber items" << testTime.msecsTo(QTime::currentTime());
//
testTime = QTime::currentTime();
foreach
(
QGraphicsItem
*
item
,
mJustSelectedItems
)
{
if
(
!
rubberItems
.
contains
(
item
))
{
item
->
setSelected
(
false
);
mJustSelectedItems
.
remove
(
item
);
}
}
qDebug
()
<<
"| ===foreach length"
<<
testTime
.
msecsTo
(
QTime
::
currentTime
());
testTime
=
QTime
::
currentTime
();
//
qDebug() << "| ===foreach length" << testTime.msecsTo(QTime::currentTime());
//
testTime = QTime::currentTime();
int
counter
=
0
;
if
(
currentTool
==
UBStylusTool
::
Selector
)
{
...
...
@@ -1201,15 +1195,15 @@ UBBoardView::mouseMoveEvent (QMouseEvent *event)
item
->
setSelected
(
true
);
mJustSelectedItems
.
insert
(
item
);
}
item
->
setSelected
(
true
);
}
}
}
qDebug
()
<<
"| ==selected items count"
<<
counter
<<
endl
<<
"| ==selection time"
<<
testTime
.
msecsTo
(
QTime
::
currentTime
())
<<
endl
<<
"| =elapsed time "
<<
startTime
.
msecsTo
(
QTime
::
currentTime
())
<<
endl
<<
"=================="
;
// qDebug() << "| ==selected items count" << counter << endl
// << "| ==selection time" << testTime.msecsTo(QTime::currentTime()) << endl
// << "| =elapsed time " << startTime.msecsTo(QTime::currentTime()) << endl
// << "==================";
// QCoreApplication::removePostedEvents(scene(), 0);
}
handleItemMouseMove
(
event
);
}
break
;
...
...
@@ -1233,8 +1227,8 @@ UBBoardView::mouseMoveEvent (QMouseEvent *event)
event
->
accept
();
}
qDebug
()
<<
"mouse move time"
<<
mouseMoveTime
.
msecsTo
(
QTime
::
currentTime
());
lastCallTime
=
QTime
::
currentTime
();
//
qDebug() << "mouse move time" << mouseMoveTime.msecsTo(QTime::currentTime());
//
lastCallTime = QTime::currentTime();
}
void
...
...
@@ -1242,10 +1236,10 @@ UBBoardView::mouseReleaseEvent (QMouseEvent *event)
{
UBStylusTool
::
Enum
currentTool
=
(
UBStylusTool
::
Enum
)
UBDrawingController
::
drawingController
()
->
stylusTool
();
setToolCursor
(
currentTool
);
setToolCursor
(
currentTool
);
// first/ propagate device release to the scene
if
(
scene
())
scene
()
->
inputDeviceRelease
();
if
(
scene
())
scene
()
->
inputDeviceRelease
();
if
(
currentTool
==
UBStylusTool
::
Selector
)
{
...
...
@@ -1312,8 +1306,6 @@ UBBoardView::mouseReleaseEvent (QMouseEvent *event)
if
(
mUBRubberBand
&&
mUBRubberBand
->
isVisible
())
{
mUBRubberBand
->
hide
();
scene
()
->
setMultipleSelectionProcess
(
false
);
scene
()
->
updateMultipleSelectionFrame
();
}
if
(
bReleaseIsNeed
)
...
...
@@ -1349,8 +1341,6 @@ UBBoardView::mouseReleaseEvent (QMouseEvent *event)
{
if
(
mRubberBand
)
{
mRubberBand
->
hide
();
scene
()
->
setMultipleSelectionProcess
(
false
);
scene
()
->
updateMultipleSelectionFrame
();
}
...
...
@@ -1377,7 +1367,6 @@ UBBoardView::mouseReleaseEvent (QMouseEvent *event)
{
if
(
mRubberBand
)
{
mRubberBand
->
hide
();
scene
()
->
setMultipleSelectionProcess
(
false
);
}
if
(
scene
()
&&
mRubberBand
&&
mIsCreatingSceneGrabZone
&&
mRubberBand
->
geometry
().
width
()
>
16
)
...
...
@@ -1412,6 +1401,8 @@ UBBoardView::mouseReleaseEvent (QMouseEvent *event)
movingItem
=
NULL
;
mLongPressTimer
.
stop
();
emit
mouseReleased
();
}
void
...
...
src/board/UBBoardView.h
View file @
625c239e
...
...
@@ -23,6 +23,8 @@
#ifndef UBBOARDVIEW_H_
#define UBBOARDVIEW_H_
#define CONTROLVIEW_OBJ_NAME "ControlView"
#include <QtGui>
#include "core/UB.h"
#include "domain/UBGraphicsDelegateFrame.h"
...
...
@@ -64,6 +66,7 @@ class UBBoardView : public QGraphicsView
void
hidden
();
void
shown
();
void
clickOnBoard
();
void
mouseReleased
();
protected
:
...
...
src/domain/UBGraphicsDelegateFrame.cpp
View file @
625c239e
...
...
@@ -238,9 +238,8 @@ void UBGraphicsDelegateFrame::mousePressEvent(QGraphicsSceneMouseEvent *event)
setCursorFromAngle
(
QString
::
number
((
int
)
mAngle
%
360
));
event
->
accept
();
if
(
moving
())
prepareFramesToMove
(
getLinkedFrames
());
// if (moving())
// prepareFramesToMove(getLinkedFrames());
}
void
UBGraphicsDelegateFrame
::
setCursorFromAngle
(
QString
angle
)
...
...
@@ -395,8 +394,10 @@ void UBGraphicsDelegateFrame::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
return
;
QLineF
move
=
QLineF
(
mStartingPoint
,
event
->
scenePos
());
qreal
moveX
=
move
.
length
()
*
cos
((
move
.
angle
()
-
mAngle
)
*
PI
/
180
);
qreal
moveY
=
-
move
.
length
()
*
sin
((
move
.
angle
()
-
mAngle
)
*
PI
/
180
);
// qreal moveX = move.length() * cos((move.angle() - mAngle) * PI / 180);
// qreal moveY = -move.length() * sin((move.angle() - mAngle) * PI / 180);
qreal
moveX
=
(
event
->
pos
()
-
mStartingPoint
).
x
();
qreal
moveY
=
(
event
->
pos
()
-
mStartingPoint
).
y
();
qreal
width
=
delegated
()
->
boundingRect
().
width
()
*
mTotalScaleX
;
qreal
height
=
delegated
()
->
boundingRect
().
height
()
*
mTotalScaleY
;
...
...
src/domain/UBGraphicsItemDelegate.cpp
View file @
625c239e
...
...
@@ -252,6 +252,12 @@ void UBGraphicsItemDelegate::freeControls()
freeButtons
();
}
void
UBGraphicsItemDelegate
::
showControls
()
{
mAntiScaleRatio
=
1
/
(
UBApplication
::
boardController
->
systemScaleFactor
()
*
UBApplication
::
boardController
->
currentZoom
());
positionHandles
();
}
bool
UBGraphicsItemDelegate
::
controlsExist
()
const
{
return
mFrame
...
...
@@ -278,14 +284,9 @@ QVariant UBGraphicsItemDelegate::itemChange(QGraphicsItem::GraphicsItemChange ch
switch
(
static_cast
<
int
>
(
change
))
{
case
QGraphicsItem
:
:
ItemSelectedHasChanged
:
{
if
(
ubScene
&&
!
ubScene
->
multipleSelectionProcess
()
)
{
if
(
ubScene
)
{
if
(
value
.
toBool
())
{
//selected(true)
if
(
!
controlsExist
())
{
createControls
();
mAntiScaleRatio
=
1
/
(
UBApplication
::
boardController
->
systemScaleFactor
()
*
UBApplication
::
boardController
->
currentZoom
());
positionHandles
();
ubScene
->
setSelectedZLevel
(
delegated
());
}
ubScene
->
setSelectedZLevel
(
delegated
());
}
else
{
ubScene
->
setOwnZlevel
(
delegated
());
freeControls
();
...
...
@@ -297,6 +298,9 @@ QVariant UBGraphicsItemDelegate::itemChange(QGraphicsItem::GraphicsItemChange ch
case
QGraphicsItem
:
:
ItemPositionHasChanged
:
case
QGraphicsItem
:
:
ItemTransformHasChanged
:
case
QGraphicsItem
:
:
ItemZValueHasChanged
:
if
(
!
controlsExist
())
{
break
;
}
mAntiScaleRatio
=
1
/
(
UBApplication
::
boardController
->
systemScaleFactor
()
*
UBApplication
::
boardController
->
currentZoom
());
positionHandles
();
if
(
ubScene
)
{
...
...
src/domain/UBGraphicsItemDelegate.h
View file @
625c239e
...
...
@@ -29,7 +29,7 @@
if (Scene) { \
Scene->removeItem(Object); \
} \
delete Object;
\
Object->deleteLater();
\
Object = 0; \
} \
...
...
@@ -231,6 +231,7 @@ class UBGraphicsItemDelegate : public QObject
void
init
();
virtual
void
createControls
();
virtual
void
freeControls
();
virtual
void
showControls
();
virtual
bool
controlsExist
()
const
;
virtual
bool
mousePressEvent
(
QGraphicsSceneMouseEvent
*
event
);
...
...
src/domain/UBGraphicsPolygonItem.h
View file @
625c239e
...
...
@@ -19,8 +19,6 @@
* along with Open-Sankoré. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef UBGRAPHICSPOLYGONITEM_H
#define UBGRAPHICSPOLYGONITEM_H
...
...
src/domain/UBGraphicsScene.cpp
View file @
625c239e
...
...
@@ -288,7 +288,6 @@ UBGraphicsScene::UBGraphicsScene(UBDocumentProxy* parent, bool enableUndoRedoSta
,
mZLayerController
(
new
UBZLayerController
(
this
))
,
mpLastPolygon
(
NULL
)
,
mCurrentPolygon
(
0
)
,
mMultipleSelectionProcess
(
false
)
,
mSelectionFrame
(
0
)
{
UBCoreGraphicsScene
::
setObjectName
(
"BoardScene"
);
...
...
@@ -1041,20 +1040,50 @@ void UBGraphicsScene::clearSelectionFrame()
}
}
void
UBGraphicsScene
::
updateMultipleSelectionFrame
()
UBBoardView
*
UBGraphicsScene
::
controlView
()
{
UBBoardView
*
result
=
0
;
foreach
(
QGraphicsView
*
view
,
views
())
{
if
(
view
->
objectName
()
==
CONTROLVIEW_OBJ_NAME
)
{
result
=
static_cast
<
UBBoardView
*>
(
view
);
}
}
return
result
;
}
void
UBGraphicsScene
::
updateSelectionFrame
()
{
qDebug
()
<<
"selected item count"
<<
selectedItems
().
count
();
QList
<
QGraphicsItem
*>
selItems
=
selectedItems
();
// if (!mMultipleSelectionProcess) {
// return;
// }
if
(
!
mSelectionFrame
)
{
mSelectionFrame
=
new
UBSelectionFrame
();
addItem
(
mSelectionFrame
);
}
mSelectionFrame
->
setEnclosedItems
(
selItems
);
if
(
!
mSelectionFrame
->
isEmpty
())
{
mSelectionFrame
->
setVisible
(
true
);
}
else
{
QList
<
QGraphicsItem
*>
selItems
=
selectedItems
();
switch
(
selItems
.
count
())
{
case
0
:
{
mSelectionFrame
->
setVisible
(
false
);
mSelectionFrame
->
setEnclosedItems
(
selItems
);
}
break
;
case
1
:
{
mSelectionFrame
->
setVisible
(
false
);
mSelectionFrame
->
setEnclosedItems
(
QList
<
QGraphicsItem
*>
());
UBGraphicsItemDelegate
*
itemDelegate
=
UBGraphicsItem
::
Delegate
(
selItems
.
first
());
itemDelegate
->
createControls
();
selItems
.
first
()
->
setVisible
(
true
);
itemDelegate
->
showControls
();
}
break
;
default
:
{
mSelectionFrame
->
setVisible
(
true
);
mSelectionFrame
->
setEnclosedItems
(
selItems
);
}
break
;
}
}
...
...
src/domain/UBGraphicsScene.h
View file @
625c239e
...
...
@@ -55,6 +55,7 @@ class UBMagnifier;
class
UBGraphicsCache
;
class
UBGraphicsGroupContainerItem
;
class
UBSelectionFrame
;
class
UBBoardView
;
const
double
PI
=
4
.
0
*
atan
(
1
.
0
);
...
...
@@ -309,12 +310,12 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem
static
QUuid
getPersonalUuid
(
QGraphicsItem
*
item
);
UBGraphicsPolygonItem
*
polygonToPolygonItem
(
const
QPolygonF
pPolygon
);
void
setMultipleSelectionProcess
(
bool
pEnabled
)
{
mMultipleSelectionProcess
=
pEnabled
;}
bool
multipleSelectionProcess
()
const
{
return
mMultipleSelectionProcess
;}
void
clearSelectionFrame
();
void
updateMultipleSelectionFrame
();
UBBoardView
*
controlView
();
public
slots
:
void
updateSelectionFrame
();
void
initStroke
();
void
hideEraser
();
...
...
@@ -430,7 +431,6 @@ public slots:
bool
mDrawWithCompass
;
UBGraphicsPolygonItem
*
mCurrentPolygon
;
bool
mMultipleSelectionProcess
;
UBSelectionFrame
*
mSelectionFrame
;
};
...
...
src/domain/UBGraphicsStrokesGroup.cpp
View file @
625c239e
...
...
@@ -187,8 +187,9 @@ void UBGraphicsStrokesGroup::paint(QPainter *painter, const QStyleOptionGraphics
}
styleOption
.
state
&=
~
QStyle
::
State_Selected
;
QGraphicsItemGroup
::
paint
(
painter
,
&
styleOption
,
widget
);
if
(
selectedState
)
{
if
(
selectedState
&&
!
Delegate
()
->
controlsExist
()
)
{
painter
->
save
();
painter
->
setPen
(
Qt
::
NoPen
);
painter
->
setBrush
(
QColor
(
0x88
,
0x88
,
0x88
,
0x77
));
painter
->
drawRect
(
boundingRect
());
painter
->
restore
();
...
...
src/domain/UBSelectionFrame.cpp
View file @
625c239e
...
...
@@ -15,7 +15,7 @@ UBSelectionFrame::UBSelectionFrame()
setLocalBrush
(
QBrush
(
UBSettings
::
paletteColor
));
setPen
(
Qt
::
NoPen
);
setData
(
UBGraphicsItemData
::
ItemLayerType
,
QVariant
(
UBItemLayerType
::
Control
));
setFlags
(
QGraphicsItem
::
ItemIsMovable
);
setFlags
(
QGraphicsItem
::
Item
SendsGeometryChanges
/*| QGraphicsItem::ItemIsSelectable*/
|
Item
IsMovable
);
connect
(
UBApplication
::
boardController
,
SIGNAL
(
zoomChanged
(
qreal
)),
this
,
SLOT
(
onZoomChanged
(
qreal
)));
}
...
...
@@ -61,16 +61,17 @@ QPainterPath UBSelectionFrame::shape() const
void
UBSelectionFrame
::
setEnclosedItems
(
const
QList
<
QGraphicsItem
*>
pGraphicsItems
)
{
QRe
ctF
resultRect
;
QRe
gion
resultRegion
;
mEnclosedtems
.
clear
();
foreach
(
QGraphicsItem
*
nextItem
,
pGraphicsItems
)
{
UBGraphicsItemDelegate
*
nextDelegate
=
UBGraphicsItem
::
Delegate
(
nextItem
);
if
(
nextDelegate
)
{
mEnclosedtems
.
append
(
nextDelegate
);
resultRe
ct
|=
nextItem
->
boundingRect
(
);
resultRe
gion
|=
nextItem
->
boundingRegion
(
nextItem
->
sceneTransform
()
);
}
}
QRectF
resultRect
=
resultRegion
.
boundingRect
();
setRect
(
resultRect
);
if
(
resultRect
.
isEmpty
())
{
...
...
@@ -80,11 +81,12 @@ void UBSelectionFrame::setEnclosedItems(const QList<QGraphicsItem*> pGraphicsIte
void
UBSelectionFrame
::
updateRect
()
{
QRe
ctF
result
;
QRe
gion
resultRegion
;
foreach
(
UBGraphicsItemDelegate
*
curDelegateItem
,
mEnclosedtems
)
{
result
|=
curDelegateItem
->
delegated
()
->
boundingRect
(
);
result
Region
|=
curDelegateItem
->
delegated
()
->
boundingRegion
(
curDelegateItem
->
delegated
()
->
sceneTransform
()
);
}
QRectF
result
=
resultRegion
.
boundingRect
();
setRect
(
result
);
if
(
result
.
isEmpty
())
{
...
...
@@ -97,9 +99,65 @@ void UBSelectionFrame::updateScale()
setScale
(
-
UBApplication
::
boardController
->
currentZoom
());
}
void
UBSelectionFrame
::
mousePressEvent
(
QGraphicsSceneMouseEvent
*
event
)
{
mPressedPos
=
mLastMovedPos
=
event
->
pos
();
mLastTranslateOffset
=
QPointF
();
// foreach (UBGraphicsItemDelegate *curDelegate, mEnclosedtems) {
// qDebug() << "TransformBefore" << curDelegate->delegated()->transform();
// }
// QGraphicsRectItem::mousePressEvent(event);
}
void
UBSelectionFrame
::
mouseMoveEvent
(
QGraphicsSceneMouseEvent
*
event
)
{
QPointF
dp
=
event
->
pos
()
-
mPressedPos
;
foreach
(
UBGraphicsItemDelegate
*
curDelegate
,
mEnclosedtems
)
{
QGraphicsItem
*
item
=
curDelegate
->
delegated
();
QTransform
ownTransform
=
item
->
transform
();
QTransform
dTransform
(
ownTransform
.
m11
()
,
ownTransform
.
m12
()
,
ownTransform
.
m13
()
,
ownTransform
.
m21
()
,
ownTransform
.
m22
()
,
ownTransform
.
m23
()
,
ownTransform
.
m31
()
+
(
dp
-
mLastTranslateOffset
).
x
()
,
ownTransform
.
m32
()
+
(
dp
-
mLastTranslateOffset
).
y
()
,
ownTransform
.
m33
()
);
item
->
setTransform
(
dTransform
);
}
updateRect
();
mLastMovedPos
=
event
->
pos
();
mLastTranslateOffset
=
dp
;
}
void
UBSelectionFrame
::
mouseReleaseEvent
(
QGraphicsSceneMouseEvent
*/
*
event
*/
)
{
mPressedPos
=
mLastMovedPos
=
QPointF
();
// foreach (UBGraphicsItemDelegate *curDelegate, mEnclosedtems) {
// qDebug() << "TransformBefore" << curDelegate->delegated()->transform();
// }
// QGraphicsRectItem::mouseReleaseEvent(event);
}
void
UBSelectionFrame
::
onZoomChanged
(
qreal
pZoom
)
{
mAntiscaleRatio
=
pZoom
;
updateScale
();
}
void
UBSelectionFrame
::
translateItem
(
QGraphicsItem
*/
*
item
*/
,
const
QPointF
&
/*translatePoint*/
)
{
}
src/domain/UBSelectionFrame.h
View file @
625c239e
...
...
@@ -25,15 +25,27 @@ public:
void
updateScale
();
bool
isEmpty
()
const
{
return
this
->
rect
().
isEmpty
();}
protected
:
void
mousePressEvent
(
QGraphicsSceneMouseEvent
*
event
);
void
mouseMoveEvent
(
QGraphicsSceneMouseEvent
*
event
);
void
mouseReleaseEvent
(
QGraphicsSceneMouseEvent
*
event
);
private
slots
:
void
setAntiScaleRatio
(
qreal
pAntiscaleRatio
)
{
mAntiscaleRatio
=
pAntiscaleRatio
;}
void
onZoomChanged
(
qreal
pZoom
);
private
:
void
translateItem
(
QGraphicsItem
*
item
,
const
QPointF
&
translatePoint
);
private
:
int
mThickness
;
qreal
mAntiscaleRatio
;
QList
<
UBGraphicsItemDelegate
*>
mEnclosedtems
;
QBrush
mLocalBrush
;
QPointF
mPressedPos
;
QPointF
mLastMovedPos
;
QPointF
mLastTranslateOffset
;
};
#endif // UBSELECTIONFRAME_H
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment