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
0bae231b
Commit
0bae231b
authored
May 06, 2013
by
Claudio Valerio
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed issue with strait line strokes
parent
8c9ed200
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
34 deletions
+52
-34
UBBoardView.cpp
src/board/UBBoardView.cpp
+0
-2
UBGraphicsScene.cpp
src/domain/UBGraphicsScene.cpp
+52
-32
No files found.
src/board/UBBoardView.cpp
View file @
0bae231b
...
...
@@ -1069,9 +1069,7 @@ void UBBoardView::mousePressEvent (QMouseEvent *event)
else
{
if
(
UBDrawingController
::
drawingController
()
->
mActiveRuler
==
NULL
)
{
viewport
()
->
setCursor
(
QCursor
(
Qt
::
BlankCursor
));
}
if
(
scene
()
&&
!
mTabletStylusIsPressed
)
{
...
...
src/domain/UBGraphicsScene.cpp
View file @
0bae231b
...
...
@@ -558,6 +558,7 @@ bool UBGraphicsScene::inputDeviceRelease()
// Add the center cross
foreach
(
QGraphicsItem
*
item
,
mAddedItems
){
mAddedItems
.
remove
(
item
);
removeItem
(
item
);
UBCoreGraphicsScene
::
removeItemFromDeletion
(
item
);
mArcPolygonItem
->
setStrokesGroup
(
pStrokes
);
...
...
@@ -732,38 +733,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
)
mCurrentStroke
=
new
UBGraphicsStroke
();
polygonItem
->
setStroke
(
mCurrentStroke
);
QPolygonF
newPolygon
=
UBGeometryUtils
::
lineToPolygon
(
QLineF
(
mPreviousPoint
,
pEndPoint
),
mPreviousWidth
,
pWidth
);
if
(
!
mCurrentPolygon
)
{
mCurrentPolygon
=
new
UBGraphicsPolygonItem
();
mCurrentPolygon
->
setPolygon
(
newPolygon
);
initPolygonItem
(
mCurrentPolygon
);
addItem
(
mCurrentPolygon
);
mAddedItems
.
insert
(
mCurrentPolygon
);
mCurrentPolygon
->
setStroke
(
mCurrentStroke
);
mpLastPolygon
=
mCurrentPolygon
;
}
//newPolygon = newPolygon.united(mCurrentPolygon->polygon());
QPainterPath
strokePainterPath
;
strokePainterPath
.
addPolygon
(
mCurrentPolygon
->
sceneTransform
().
map
(
mCurrentPolygon
->
polygon
()));
//QList<QPolygonF>
QPolygonF
oldPolygons
=
strokePainterPath
.
simplified
().
toFillPolygon
(
mCurrentPolygon
->
sceneTransform
().
inverted
());
newPolygon
=
oldPolygons
.
united
(
newPolygon
);
mpLastPolygon
=
mCurrentPolygon
;
mCurrentPolygon
->
setPolygon
(
newPolygon
);
mPreviousPolygonItems
.
append
(
polygonItem
);
if
(
!
bLineStyle
)
...
...
@@ -845,10 +825,29 @@ void UBGraphicsScene::eraseLineTo(const QPointF &pEndPoint, const qreal &pWidth)
}
}
//remove full polygon item for replace it by couple of polygons who creates the same stroke without a part which intersects with eraser
mRemovedItems
<<
intersectedPolygonItem
;
intersectedPolygonItem
->
strokesGroup
()
->
removeFromGroup
(
intersectedPolygonItem
);
//remove full polygon item for replace it by couple of polygons which creates the same stroke without a part intersects with eraser
mRemovedItems
<<
intersectedPolygonItem
;
QTransform
t
;
bool
bApplyTransform
=
false
;
if
(
intersectedPolygonItem
->
strokesGroup
())
{
if
(
intersectedPolygonItem
->
strokesGroup
()
->
parentItem
())
{
bApplyTransform
=
true
;
t
=
intersectedPolygonItem
->
sceneTransform
();
}
intersectedPolygonItem
->
strokesGroup
()
->
removeFromGroup
(
intersectedPolygonItem
);
}
removeItem
(
intersectedPolygonItem
);
if
(
bApplyTransform
)
intersectedPolygonItem
->
setTransform
(
t
);
removeItem
(
intersectedPolygonItem
);
if
(
bApplyTransform
)
intersectedPolygonItem
->
setTransform
(
t
);
}
if
(
!
intersectedItems
.
empty
())
...
...
@@ -1505,9 +1504,30 @@ UBGraphicsTextItem* UBGraphicsScene::textForObjectName(const QString& pString, c
textItem
->
setData
(
UBGraphicsItemData
::
ItemEditable
,
QVariant
(
false
));
textItem
->
adjustSize
();
textItem
->
setTextInteractionFlags
(
Qt
::
TextSelectableByMouse
|
Qt
::
TextSelectableByKeyboard
);
textItem
->
setPlainText
(
pString
);
}
else
{
textItem
->
setTextInteractionFlags
(
Qt
::
TextSelectableByMouse
|
Qt
::
TextSelectableByKeyboard
);
if
(
pString
==
textItem
->
toPlainText
())
return
textItem
;
textItem
->
setPlainText
(
pString
);
QTextCursor
curCursor
=
textItem
->
textCursor
();
QFont
font
=
textItem
->
font
();
QColor
color
=
curCursor
.
charFormat
().
foreground
().
color
();
textItem
->
setPlainText
(
pString
);
textItem
->
clearFocus
();
textItem
->
setFont
(
font
);
QTextCharFormat
format
;
format
.
setForeground
(
QBrush
(
color
));
curCursor
.
mergeCharFormat
(
format
);
textItem
->
setTextCursor
(
curCursor
);
// textItem->setSelected(true);
textItem
->
contentsChanged
();
}
textItem
->
clearFocus
();
return
textItem
;
...
...
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