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
855142f1
Commit
855142f1
authored
Apr 25, 2012
by
Ivan Ilin
Browse files
Options
Browse Files
Download
Plain Diff
merge conflicts resolved
parents
9bd20fdb
ef45f3fc
Changes
17
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
283 additions
and
72 deletions
+283
-72
UBBoardView.cpp
src/board/UBBoardView.cpp
+0
-7
UBDrawingController.cpp
src/board/UBDrawingController.cpp
+11
-0
UBDrawingController.h
src/board/UBDrawingController.h
+8
-0
UBApplicationController.cpp
src/core/UBApplicationController.cpp
+2
-0
UBGraphicsPolygonItem.cpp
src/domain/UBGraphicsPolygonItem.cpp
+0
-9
UBGraphicsPolygonItem.h
src/domain/UBGraphicsPolygonItem.h
+0
-1
UBGraphicsScene.cpp
src/domain/UBGraphicsScene.cpp
+116
-46
UBGraphicsScene.h
src/domain/UBGraphicsScene.h
+3
-0
UBGraphicsStroke.cpp
src/domain/UBGraphicsStroke.cpp
+7
-0
UBGraphicsStroke.h
src/domain/UBGraphicsStroke.h
+2
-0
UBGraphicsStrokesGroup.cpp
src/domain/UBGraphicsStrokesGroup.cpp
+86
-0
UBGraphicsStrokesGroup.h
src/domain/UBGraphicsStrokesGroup.h
+28
-0
domain.pri
src/domain/domain.pri
+4
-2
UBCoreGraphicsScene.cpp
src/frameworks/UBCoreGraphicsScene.cpp
+6
-0
UBCoreGraphicsScene.h
src/frameworks/UBCoreGraphicsScene.h
+1
-0
UBGraphicsProtractor.cpp
src/tools/UBGraphicsProtractor.cpp
+1
-2
UBGraphicsRuler.cpp
src/tools/UBGraphicsRuler.cpp
+8
-5
No files found.
src/board/UBBoardView.cpp
View file @
855142f1
...
...
@@ -316,7 +316,6 @@ void UBBoardView::tabletEvent (QTabletEvent * event)
}
QPointF
scenePos
=
viewportTransform
().
inverted
().
map
(
tabletPos
);
qDebug
()
<<
"scene Pos "
<<
scenePos
;
qreal
pressure
=
1.0
;
if
(((
currentTool
==
UBStylusTool
::
Pen
||
currentTool
==
UBStylusTool
::
Line
)
...
...
@@ -329,16 +328,12 @@ void UBBoardView::tabletEvent (QTabletEvent * event)
switch
(
event
->
type
())
{
case
QEvent
:
:
TabletPress
:
{
qDebug
()
<<
"TabletPress"
;
mTabletStylusIsPressed
=
true
;
scene
()
->
inputDevicePress
(
scenePos
,
pressure
);
break
;
}
case
QEvent
:
:
TabletMove
:
{
qDebug
()
<<
"TabletMove"
;
if
(
mTabletStylusIsPressed
)
scene
()
->
inputDeviceMove
(
scenePos
,
pressure
);
...
...
@@ -348,8 +343,6 @@ void UBBoardView::tabletEvent (QTabletEvent * event)
}
case
QEvent
:
:
TabletRelease
:
{
qDebug
()
<<
"TabletRelease"
;
UBStylusTool
::
Enum
currentTool
=
(
UBStylusTool
::
Enum
)
dc
->
stylusTool
();
scene
()
->
setToolCursor
(
currentTool
);
setToolCursor
(
currentTool
);
...
...
src/board/UBDrawingController.cpp
View file @
855142f1
...
...
@@ -45,6 +45,7 @@ UBDrawingController::UBDrawingController(QObject * parent)
,
mActiveRuler
(
NULL
)
,
mStylusTool
((
UBStylusTool
::
Enum
)
-
1
)
,
mLatestDrawingTool
((
UBStylusTool
::
Enum
)
-
1
)
//, mDrawingMode(eDrawingMode_Vector)
{
connect
(
UBSettings
::
settings
(),
SIGNAL
(
colorContextChanged
()),
this
,
SIGNAL
(
colorPaletteChanged
()));
...
...
@@ -387,3 +388,13 @@ void UBDrawingController::captureToolSelected(bool checked)
if
(
checked
)
setStylusTool
(
UBStylusTool
::
Capture
);
}
void
UBDrawingController
::
setDrawingMode
(
eDrawingMode
mode
)
{
mDrawingMode
=
mode
;
}
eDrawingMode
UBDrawingController
::
drawingMode
()
{
return
mDrawingMode
;
}
src/board/UBDrawingController.h
View file @
855142f1
...
...
@@ -22,6 +22,11 @@
class
UBAbstractDrawRuler
;
typedef
enum
{
eDrawingMode_Artistic
,
eDrawingMode_Vector
}
eDrawingMode
;
class
UBDrawingController
:
public
QObject
{
Q_OBJECT
;
...
...
@@ -49,6 +54,8 @@ class UBDrawingController : public QObject
void
setPenColor
(
bool
onDarkBackground
,
const
QColor
&
color
,
int
pIndex
);
void
setMarkerColor
(
bool
onDarkBackground
,
const
QColor
&
color
,
int
pIndex
);
void
setMarkerAlpha
(
qreal
alpha
);
void
setDrawingMode
(
eDrawingMode
mode
);
eDrawingMode
drawingMode
();
UBAbstractDrawRuler
*
mActiveRuler
;
...
...
@@ -69,6 +76,7 @@ class UBDrawingController : public QObject
private
:
UBStylusTool
::
Enum
mStylusTool
;
UBStylusTool
::
Enum
mLatestDrawingTool
;
eDrawingMode
mDrawingMode
;
static
UBDrawingController
*
sDrawingController
;
...
...
src/core/UBApplicationController.cpp
View file @
855142f1
...
...
@@ -463,6 +463,7 @@ void UBApplicationController::showDesktop(bool dontSwitchFrontProcess)
UBPlatformUtils
::
bringPreviousProcessToFront
();
}
UBDrawingController
::
drawingController
()
->
setDrawingMode
(
eDrawingMode_Artistic
);
UBDrawingController
::
drawingController
()
->
setStylusTool
(
UBStylusTool
::
Selector
);
}
...
...
@@ -606,6 +607,7 @@ void UBApplicationController::checkUpdateRequest()
void
UBApplicationController
::
hideDesktop
()
{
mDisplayManager
->
adjustScreens
(
-
1
);
UBDrawingController
::
drawingController
()
->
setDrawingMode
(
eDrawingMode_Vector
);
if
(
mMainMode
==
Board
)
{
...
...
src/domain/UBGraphicsPolygonItem.cpp
View file @
855142f1
...
...
@@ -176,7 +176,6 @@ UBGraphicsPolygonItem* UBGraphicsPolygonItem::deepCopy(const QPolygonF& pol) con
void
UBGraphicsPolygonItem
::
paint
(
QPainter
*
painter
,
const
QStyleOptionGraphicsItem
*
option
,
QWidget
*
widget
)
{
if
(
mHasAlpha
&&
scene
()
&&
scene
()
->
isLightBackground
())
{
painter
->
setCompositionMode
(
QPainter
::
CompositionMode_Darken
);
...
...
@@ -203,11 +202,3 @@ UBGraphicsScene* UBGraphicsPolygonItem::scene()
{
return
qobject_cast
<
UBGraphicsScene
*>
(
QGraphicsPolygonItem
::
scene
());
}
src/domain/UBGraphicsPolygonItem.h
View file @
855142f1
...
...
@@ -118,7 +118,6 @@ class UBGraphicsPolygonItem : public QGraphicsPolygonItem, public UBItem
QPainterPath
shape
()
const
;
private
:
void
clearStroke
();
...
...
src/domain/UBGraphicsScene.cpp
View file @
855142f1
...
...
@@ -55,6 +55,8 @@
#include "UBGraphicsWidgetItem.h"
#include "UBGraphicsPDFItem.h"
#include "UBGraphicsTextItem.h"
#include "UBGraphicsStrokesGroup.h"
#include "domain/ubgraphicsgroupcontaineritem.h"
#include "UBAppleWidget.h"
...
...
@@ -268,8 +270,9 @@ UBGraphicsScene::UBGraphicsScene(UBDocumentProxy* parent)
,
magniferDisplayViewWidget
(
0
)
,
mZLayerController
(
new
UBZLayerController
(
this
))
,
mIsDesktopMode
(
false
)
,
mpLastPolygon
(
NULL
)
{
UBCoreGraphicsScene
::
setObjectName
(
"BoardScene"
);
#ifdef __ppc__
mShouldUseOMP
=
false
;
#elif defined(Q_WS_MAC)
...
...
@@ -363,19 +366,29 @@ bool UBGraphicsScene::inputDevicePress(const QPointF& scenePos, const qreal& pre
if
(
UBDrawingController
::
drawingController
()
->
isDrawingTool
())
{
// -----------------------------------------------------------------
// We fall here if we are using the Pen, the Marker or the Line tool
// -----------------------------------------------------------------
qreal
width
=
0
;
// delete current stroke, if not assigned to any polygon
if
(
mCurrentStroke
)
if
(
mCurrentStroke
->
polygons
().
empty
())
if
(
mCurrentStroke
&&
mCurrentStroke
->
polygons
().
empty
()){
delete
mCurrentStroke
;
mCurrentStroke
=
NULL
;
}
// ---------------------------------------------------------------
// Create a new Stroke. A Stroke is a collection of QGraphicsLines
// ---------------------------------------------------------------
mCurrentStroke
=
new
UBGraphicsStroke
();
if
(
currentTool
!=
UBStylusTool
::
Line
)
if
(
currentTool
!=
UBStylusTool
::
Line
){
// Handle the pressure
width
=
UBDrawingController
::
drawingController
()
->
currentToolWidth
()
*
pressure
;
else
width
=
UBDrawingController
::
drawingController
()
->
currentToolWidth
();
//ignore pressure for line tool
}
else
{
// Ignore pressure for the line tool
width
=
UBDrawingController
::
drawingController
()
->
currentToolWidth
();
}
width
/=
UBApplication
::
boardController
->
systemScaleFactor
();
width
/=
UBApplication
::
boardController
->
currentZoom
();
...
...
@@ -385,14 +398,12 @@ bool UBGraphicsScene::inputDevicePress(const QPointF& scenePos, const qreal& pre
if
(
UBDrawingController
::
drawingController
()
->
mActiveRuler
)
{
UBDrawingController
::
drawingController
()
->
mActiveRuler
->
StartLine
(
scenePos
,
width
);
UBDrawingController
::
drawingController
()
->
mActiveRuler
->
StartLine
(
scenePos
,
width
);
}
else
{
moveTo
(
scenePos
);
drawLineTo
(
scenePos
,
width
,
UBDrawingController
::
drawingController
()
->
stylusTool
()
==
UBStylusTool
::
Line
);
drawLineTo
(
scenePos
,
width
,
UBDrawingController
::
drawingController
()
->
stylusTool
()
==
UBStylusTool
::
Line
);
}
accepted
=
true
;
}
...
...
@@ -443,24 +454,31 @@ bool UBGraphicsScene::inputDeviceMove(const QPointF& scenePos, const qreal& pres
{
qreal
width
=
0
;
if
(
currentTool
!=
UBStylusTool
::
Line
)
if
(
currentTool
!=
UBStylusTool
::
Line
){
// Handle the pressure
width
=
dc
->
currentToolWidth
()
*
pressure
;
else
width
=
dc
->
currentToolWidth
();
//ignore pressure for line tool
}
else
{
// Ignore pressure for line tool
width
=
dc
->
currentToolWidth
();
}
width
/=
UBApplication
::
boardController
->
systemScaleFactor
();
width
/=
UBApplication
::
boardController
->
currentZoom
();
if
(
dc
->
mActiveRuler
)
if
(
currentTool
==
UBStylusTool
::
Line
||
dc
->
mActiveRuler
)
{
dc
->
mActiveRuler
->
DrawLine
(
position
,
width
);
if
(
NULL
!=
mpLastPolygon
&&
NULL
!=
mCurrentStroke
&&
mAddedItems
.
size
()
>
0
){
UBCoreGraphicsScene
::
removeItemFromDeletion
(
mpLastPolygon
);
mAddedItems
.
remove
(
mpLastPolygon
);
mCurrentStroke
->
remove
(
mpLastPolygon
);
removeItem
(
mpLastPolygon
);
mPreviousPolygonItems
.
removeAll
(
mpLastPolygon
);
}
else
{
if
(
currentTool
==
UBStylusTool
::
Line
)
{
// TODO: Verify this beautiful implementation and check if
// it is possible to optimize it
// ------------------------------------------------------------------------
// Here we wanna make sure that the Line will 'grip' at i*45, i*90 degrees
// ------------------------------------------------------------------------
QLineF
radius
(
mPreviousPoint
,
position
);
qreal
angle
=
radius
.
angle
();
angle
=
qRound
(
angle
/
45
)
*
45
;
...
...
@@ -473,8 +491,10 @@ bool UBGraphicsScene::inputDeviceMove(const QPointF& scenePos, const qreal& pres
position
=
newPosition
;
}
drawLineTo
(
position
,
width
,
UBDrawingController
::
drawingController
()
->
stylusTool
()
==
UBStylusTool
::
Line
);
if
(
dc
->
mActiveRuler
){
dc
->
mActiveRuler
->
DrawLine
(
position
,
width
);
}
else
{
drawLineTo
(
position
,
width
,
UBDrawingController
::
drawingController
()
->
stylusTool
()
==
UBStylusTool
::
Line
);
}
}
else
if
(
currentTool
==
UBStylusTool
::
Eraser
)
...
...
@@ -520,14 +540,57 @@ bool UBGraphicsScene::inputDeviceRelease()
}
UBDrawingController
*
dc
=
UBDrawingController
::
drawingController
();
if
(
dc
->
isDrawingTool
())
// TODO: Find a way to detect that we just did a compass drawing and replace the mArcPolygonItem just below
if
(
dc
->
isDrawingTool
()
||
mDrawWithCompass
)
{
if
(
mCurrentStroke
)
{
if
(
mCurrentStroke
->
polygons
().
empty
())
if
(
eDrawingMode_Vector
==
dc
->
drawingMode
()){
UBGraphicsStrokesGroup
*
pStrokes
=
new
UBGraphicsStrokesGroup
();
// Remove the strokes that were just drawn here and replace them by a stroke item
foreach
(
UBGraphicsPolygonItem
*
poly
,
mCurrentStroke
->
polygons
()){
mPreviousPolygonItems
.
removeAll
(
poly
);
removeItem
(
poly
);
UBCoreGraphicsScene
::
removeItemFromDeletion
(
poly
);
pStrokes
->
addToGroup
(
poly
);
}
// TODO LATER : Generate well pressure-interpolated polygons and create the line group with them
mAddedItems
.
clear
();
mAddedItems
<<
pStrokes
;
addItem
(
pStrokes
);
}
if
(
mCurrentStroke
->
polygons
().
empty
()){
delete
mCurrentStroke
;
mCurrentStroke
=
0
;
}
}
else
if
(
mArcPolygonItem
){
if
(
eDrawingMode_Vector
==
dc
->
drawingMode
()){
UBGraphicsStrokesGroup
*
pStrokes
=
new
UBGraphicsStrokesGroup
();
// Add the arc
mAddedItems
.
remove
(
mArcPolygonItem
);
removeItem
(
mArcPolygonItem
);
UBCoreGraphicsScene
::
removeItemFromDeletion
(
mArcPolygonItem
);
pStrokes
->
addToGroup
(
mArcPolygonItem
);
// Add the center cross
foreach
(
QGraphicsItem
*
item
,
mAddedItems
){
removeItem
(
item
);
UBCoreGraphicsScene
::
removeItemFromDeletion
(
item
);
pStrokes
->
addToGroup
(
item
);
}
mAddedItems
.
clear
();
mAddedItems
<<
pStrokes
;
addItem
(
pStrokes
);
mDrawWithCompass
=
false
;
}
}
}
if
(
mRemovedItems
.
size
()
>
0
||
mAddedItems
.
size
()
>
0
)
...
...
@@ -626,6 +689,7 @@ void UBGraphicsScene::moveTo(const QPointF &pPoint)
mPreviousWidth
=
-
1.0
;
mPreviousPolygonItems
.
clear
();
mArcPolygonItem
=
0
;
mDrawWithCompass
=
false
;
}
...
...
@@ -638,6 +702,9 @@ void UBGraphicsScene::drawLineTo(const QPointF &pEndPoint, const qreal &pWidth,
if
(
!
polygonItem
->
brush
().
isOpaque
())
{
// -------------------------------------------------------------------------------------
// Here we substract the polygons that are overlapping in order to keep the transparency
// -------------------------------------------------------------------------------------
for
(
int
i
=
0
;
i
<
mPreviousPolygonItems
.
size
();
i
++
)
{
UBGraphicsPolygonItem
*
previous
=
mPreviousPolygonItems
.
value
(
i
);
...
...
@@ -657,15 +724,17 @@ void UBGraphicsScene::drawLineTo(const QPointF &pEndPoint, const qreal &pWidth,
mAddedItems
.
clear
();
}
mpLastPolygon
=
polygonItem
;
mAddedItems
.
insert
(
polygonItem
);
// Here we add the item to the scene
addItem
(
polygonItem
);
if
(
mCurrentStroke
)
{
polygonItem
->
setStroke
(
mCurrentStroke
);
}
addItem
(
polygonItem
);
mPreviousPolygonItems
.
append
(
polygonItem
);
if
(
!
bLineStyle
)
...
...
@@ -803,6 +872,7 @@ void UBGraphicsScene::eraseLineTo(const QPointF &pEndPoint, const qreal &pWidth)
void
UBGraphicsScene
::
drawArcTo
(
const
QPointF
&
pCenterPoint
,
qreal
pSpanAngle
)
{
mDrawWithCompass
=
true
;
if
(
mArcPolygonItem
)
{
mAddedItems
.
remove
(
mArcPolygonItem
);
...
...
src/domain/UBGraphicsScene.h
View file @
855142f1
...
...
@@ -399,6 +399,9 @@ public slots:
UBMagnifier
*
magniferDisplayViewWidget
;
UBZLayerController
*
mZLayerController
;
UBGraphicsPolygonItem
*
mpLastPolygon
;
bool
mDrawWithCompass
;
};
...
...
src/domain/UBGraphicsStroke.cpp
View file @
855142f1
...
...
@@ -86,3 +86,10 @@ bool UBGraphicsStroke::hasAlpha() const
}
}
void
UBGraphicsStroke
::
clear
()
{
if
(
!
mPolygons
.
empty
()){
mPolygons
.
clear
();
}
}
src/domain/UBGraphicsStroke.h
View file @
855142f1
...
...
@@ -41,6 +41,8 @@ class UBGraphicsStroke
bool
hasAlpha
()
const
;
void
clear
();
protected
:
void
addPolygon
(
UBGraphicsPolygonItem
*
pol
);
...
...
src/domain/UBGraphicsStrokesGroup.cpp
0 → 100644
View file @
855142f1
#include "UBGraphicsStrokesGroup.h"
UBGraphicsStrokesGroup
::
UBGraphicsStrokesGroup
(
QGraphicsItem
*
parent
)
:
QGraphicsItemGroup
(
parent
)
{
mDelegate
=
new
UBGraphicsItemDelegate
(
this
,
0
,
true
,
true
);
mDelegate
->
init
();
mDelegate
->
setFlippable
(
true
);
setData
(
UBGraphicsItemData
::
ItemLayerType
,
UBItemLayerType
::
Object
);
setData
(
UBGraphicsItemData
::
itemLayerType
,
QVariant
(
itemLayerType
::
ObjectItem
));
//Necessary to set if we want z value to be assigned correctly
setFlag
(
QGraphicsItem
::
ItemSendsGeometryChanges
,
true
);
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
true
);
setFlag
(
QGraphicsItem
::
ItemIsMovable
,
true
);
}
UBGraphicsStrokesGroup
::~
UBGraphicsStrokesGroup
()
{
if
(
mDelegate
){
delete
mDelegate
;
}
}
void
UBGraphicsStrokesGroup
::
mousePressEvent
(
QGraphicsSceneMouseEvent
*
event
)
{
if
(
mDelegate
->
mousePressEvent
(
event
))
{
//NOOP
}
else
{
// QGraphicsItemGroup::mousePressEvent(event);
}
}
void
UBGraphicsStrokesGroup
::
mouseMoveEvent
(
QGraphicsSceneMouseEvent
*
event
)
{
if
(
mDelegate
->
mouseMoveEvent
(
event
))
{
// NOOP;
}
else
{
QGraphicsItemGroup
::
mouseMoveEvent
(
event
);
}
}
void
UBGraphicsStrokesGroup
::
mouseReleaseEvent
(
QGraphicsSceneMouseEvent
*
event
)
{
mDelegate
->
mouseReleaseEvent
(
event
);
QGraphicsItemGroup
::
mouseReleaseEvent
(
event
);
}
UBItem
*
UBGraphicsStrokesGroup
::
deepCopy
()
const
{
UBGraphicsStrokesGroup
*
copy
=
new
UBGraphicsStrokesGroup
();
copy
->
setPos
(
this
->
pos
());
copy
->
setTransform
(
this
->
transform
());
copy
->
setFlag
(
QGraphicsItem
::
ItemIsMovable
,
true
);
copy
->
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
true
);
copy
->
setData
(
UBGraphicsItemData
::
ItemLayerType
,
this
->
data
(
UBGraphicsItemData
::
ItemLayerType
));
copy
->
setData
(
UBGraphicsItemData
::
ItemLocked
,
this
->
data
(
UBGraphicsItemData
::
ItemLocked
));
return
copy
;
}
void
UBGraphicsStrokesGroup
::
remove
()
{
if
(
mDelegate
)
mDelegate
->
remove
(
true
);
}
void
UBGraphicsStrokesGroup
::
paint
(
QPainter
*
painter
,
const
QStyleOptionGraphicsItem
*
option
,
QWidget
*
widget
)
{
// Never draw the rubber band, we draw our custom selection with the DelegateFrame
QStyleOptionGraphicsItem
styleOption
=
QStyleOptionGraphicsItem
(
*
option
);
styleOption
.
state
&=
~
QStyle
::
State_Selected
;
QGraphicsItemGroup
::
paint
(
painter
,
&
styleOption
,
widget
);
}
QVariant
UBGraphicsStrokesGroup
::
itemChange
(
GraphicsItemChange
change
,
const
QVariant
&
value
)
{
QVariant
newValue
=
mDelegate
->
itemChange
(
change
,
value
);
return
QGraphicsItemGroup
::
itemChange
(
change
,
newValue
);
}
src/domain/UBGraphicsStrokesGroup.h
0 → 100644
View file @
855142f1
#ifndef UBGRAPHICSSTROKESGROUP_H
#define UBGRAPHICSSTROKESGROUP_H
#include <QGraphicsItemGroup>
#include <QGraphicsSceneMouseEvent>
#include "core/UB.h"
#include "UBItem.h"
class
UBGraphicsStrokesGroup
:
public
QObject
,
public
QGraphicsItemGroup
,
public
UBItem
,
public
UBGraphicsItem
{
Q_OBJECT
public
:
UBGraphicsStrokesGroup
(
QGraphicsItem
*
parent
=
0
);
~
UBGraphicsStrokesGroup
();
virtual
UBItem
*
deepCopy
()
const
;
virtual
void
remove
();
virtual
UBGraphicsItemDelegate
*
Delegate
()
const
{
return
mDelegate
;}
protected
:
virtual
void
mousePressEvent
(
QGraphicsSceneMouseEvent
*
event
);
virtual
void
mouseMoveEvent
(
QGraphicsSceneMouseEvent
*
event
);
virtual
void
mouseReleaseEvent
(
QGraphicsSceneMouseEvent
*
event
);
virtual
void
paint
(
QPainter
*
painter
,
const
QStyleOptionGraphicsItem
*
option
,
QWidget
*
widget
);
virtual
QVariant
itemChange
(
GraphicsItemChange
change
,
const
QVariant
&
value
);
};
#endif // UBGRAPHICSSTROKESGROUP_H
src/domain/domain.pri
View file @
855142f1
...
...
@@ -25,7 +25,8 @@ HEADERS += src/domain/UBGraphicsScene.h \
src/domain/UBAbstractUndoCommand.h\
src/domain/UBAngleWidget.h \
src/domain/ubgraphicsgroupcontaineritem.h \
src/domain/ubgraphicsgroupcontaineritemdelegate.h
src/domain/ubgraphicsgroupcontaineritemdelegate.h \
src/domain/UBGraphicsStrokesGroup.h
HEADERS += src/domain/UBGraphicsItemDelegate.h \
src/domain/UBGraphicsVideoItemDelegate.h \
...
...
@@ -60,7 +61,8 @@ SOURCES += src/domain/UBGraphicsScene.cpp \
src/domain/UBAbstractUndoCommand.cpp \
src/domain/UBAngleWidget.cpp \
src/domain/ubgraphicsgroupcontaineritem.cpp \
src/domain/ubgraphicsgroupcontaineritemdelegate.cpp
src/domain/ubgraphicsgroupcontaineritemdelegate.cpp \
src/domain/UBGraphicsStrokesGroup.cpp
SOURCES += src/domain/UBGraphicsItemDelegate.cpp \
src/domain/UBGraphicsVideoItemDelegate.cpp \
...
...
src/frameworks/UBCoreGraphicsScene.cpp
View file @
855142f1
...
...
@@ -87,3 +87,9 @@ bool UBCoreGraphicsScene::deleteItem(QGraphicsItem* item)
return
false
;
}
void
UBCoreGraphicsScene
::
removeItemFromDeletion
(
QGraphicsItem
*
item
)
{
if
(
NULL
!=
item
){
mItemsToDelete
.
remove
(
item
);
}
}
src/frameworks/UBCoreGraphicsScene.h
View file @
855142f1
...
...
@@ -30,6 +30,7 @@ class UBCoreGraphicsScene : public QGraphicsScene
virtual
bool
deleteItem
(
QGraphicsItem
*
item
);
void
removeItemFromDeletion
(
QGraphicsItem
*
item
);
private
:
QSet
<
QGraphicsItem
*>
mItemsToDelete
;
...
...
src/tools/UBGraphicsProtractor.cpp
View file @
855142f1
...
...
@@ -79,8 +79,7 @@ void UBGraphicsProtractor::paint(QPainter *painter, const QStyleOptionGraphicsIt
painter
->
setFont
(
QFont
(
"Arial"
));
painter
->
setPen
(
drawColor
());
painter
->
setBrush
(
fillBrush
());
painter
->
drawPie
(
QRectF
(
rect
().
center
().
x
()
-
radius
(),
rect
().
center
().
y
()
-
radius
(),
2
*
radius
(),
2
*
radius
()),
mStartAngle
*
16
,
mSpan
*
16
);
painter
->
drawPie
(
QRectF
(
rect
().
center
().
x
()
-
radius
(),
rect
().
center
().
y
()
-
radius
(),
2
*
radius
(),
2
*
radius
()),
mStartAngle
*
16
,
mSpan
*
16
);
paintGraduations
(
painter
);
paintButtons
(
painter
);
paintAngleMarker
(
painter
);
...
...
src/tools/UBGraphicsRuler.cpp
View file @
855142f1
...
...
@@ -103,6 +103,7 @@ void UBGraphicsRuler::paint(QPainter *painter, const QStyleOptionGraphicsItem *s
painter
->
setPen
(
drawColor
());
painter
->
setRenderHint
(
QPainter
::
Antialiasing
,
true
);
painter
->
drawRoundedRect
(
rect
(),
sRoundingRadius
,
sRoundingRadius
);
fillBackground
(
painter
);
paintGraduations
(
painter
);
...
...
@@ -478,9 +479,11 @@ void UBGraphicsRuler::DrawLine(const QPointF& scenePos, qreal width)
itemPos
=
mapToScene
(
itemPos
);
// We have to use "pointed" line for marker tool
scene
()
->
drawLineTo
(
itemPos
,
width
,
UBDrawingController
::
drawingController
()
->
stylusTool
()
!=
UBStylusTool
::
Marker
);
scene
()
->
drawLineTo
(
itemPos
,
width
,
UBDrawingController
::
drawingController
()
->
stylusTool
()
!=
UBStylusTool
::
Marker
);
}
void
UBGraphicsRuler
::
EndLine
()
{}
{
// We never come to this place
scene
()
->
inputDeviceRelease
();
}
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