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
1df0122f
Commit
1df0122f
authored
Aug 30, 2013
by
Claudio Valerio
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed strokes with pressure on rules and triangle
parent
1c251fae
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
12 deletions
+20
-12
UBGraphicsRuler.cpp
src/tools/UBGraphicsRuler.cpp
+8
-5
UBGraphicsRuler.h
src/tools/UBGraphicsRuler.h
+3
-1
UBGraphicsTriangle.cpp
src/tools/UBGraphicsTriangle.cpp
+8
-6
UBGraphicsTriangle.h
src/tools/UBGraphicsTriangle.h
+1
-0
No files found.
src/tools/UBGraphicsRuler.cpp
View file @
1df0122f
...
@@ -449,12 +449,14 @@ void UBGraphicsRuler::StartLine(const QPointF& scenePos, qreal width)
...
@@ -449,12 +449,14 @@ void UBGraphicsRuler::StartLine(const QPointF& scenePos, qreal width)
{
{
QPointF
itemPos
=
mapFromScene
(
scenePos
);
QPointF
itemPos
=
mapFromScene
(
scenePos
);
mStrokeWidth
=
width
;
qreal
y
;
qreal
y
;
if
(
itemPos
.
y
()
>
rect
().
y
()
+
rect
().
height
()
/
2
)
if
(
itemPos
.
y
()
>
rect
().
y
()
+
rect
().
height
()
/
2
)
{
{
drawLineDirection
=
0
;
drawLineDirection
=
0
;
y
=
rect
().
y
()
+
rect
().
height
()
+
w
idth
/
2
;
y
=
rect
().
y
()
+
rect
().
height
()
+
mStrokeW
idth
/
2
;
}
}
else
else
{
{
...
@@ -471,21 +473,22 @@ void UBGraphicsRuler::StartLine(const QPointF& scenePos, qreal width)
...
@@ -471,21 +473,22 @@ void UBGraphicsRuler::StartLine(const QPointF& scenePos, qreal width)
itemPos
=
mapToScene
(
itemPos
);
itemPos
=
mapToScene
(
itemPos
);
scene
()
->
moveTo
(
itemPos
);
scene
()
->
moveTo
(
itemPos
);
scene
()
->
drawLineTo
(
itemPos
,
w
idth
,
true
);
scene
()
->
drawLineTo
(
itemPos
,
mStrokeW
idth
,
true
);
}
}
void
UBGraphicsRuler
::
DrawLine
(
const
QPointF
&
scenePos
,
qreal
width
)
void
UBGraphicsRuler
::
DrawLine
(
const
QPointF
&
scenePos
,
qreal
width
)
{
{
Q_UNUSED
(
width
);
QPointF
itemPos
=
mapFromScene
(
scenePos
);
QPointF
itemPos
=
mapFromScene
(
scenePos
);
qreal
y
;
qreal
y
;
if
(
drawLineDirection
==
0
)
if
(
drawLineDirection
==
0
)
{
{
y
=
rect
().
y
()
+
rect
().
height
()
+
w
idth
/
2
;
y
=
rect
().
y
()
+
rect
().
height
()
+
mStrokeW
idth
/
2
;
}
}
else
else
{
{
y
=
rect
().
y
()
-
w
idth
/
2
;
y
=
rect
().
y
()
-
mStrokeW
idth
/
2
;
}
}
if
(
itemPos
.
x
()
<
rect
().
x
()
+
sLeftEdgeMargin
)
if
(
itemPos
.
x
()
<
rect
().
x
()
+
sLeftEdgeMargin
)
itemPos
.
setX
(
rect
().
x
()
+
sLeftEdgeMargin
);
itemPos
.
setX
(
rect
().
x
()
+
sLeftEdgeMargin
);
...
@@ -496,7 +499,7 @@ void UBGraphicsRuler::DrawLine(const QPointF& scenePos, qreal width)
...
@@ -496,7 +499,7 @@ void UBGraphicsRuler::DrawLine(const QPointF& scenePos, qreal width)
itemPos
=
mapToScene
(
itemPos
);
itemPos
=
mapToScene
(
itemPos
);
// We have to use "pointed" line for marker tool
// We have to use "pointed" line for marker tool
scene
()
->
drawLineTo
(
itemPos
,
w
idth
,
UBDrawingController
::
drawingController
()
->
stylusTool
()
!=
UBStylusTool
::
Marker
);
scene
()
->
drawLineTo
(
itemPos
,
mStrokeW
idth
,
UBDrawingController
::
drawingController
()
->
stylusTool
()
!=
UBStylusTool
::
Marker
);
}
}
void
UBGraphicsRuler
::
EndLine
()
void
UBGraphicsRuler
::
EndLine
()
...
...
src/tools/UBGraphicsRuler.h
View file @
1df0122f
...
@@ -60,7 +60,7 @@ class UBGraphicsRuler : public UBAbstractDrawRuler, public QGraphicsRectItem, pu
...
@@ -60,7 +60,7 @@ class UBGraphicsRuler : public UBAbstractDrawRuler, public QGraphicsRectItem, pu
virtual
void
EndLine
();
virtual
void
EndLine
();
protected
:
protected
:
virtual
void
paint
(
QPainter
*
painter
,
const
QStyleOptionGraphicsItem
*
styleOption
,
QWidget
*
widget
);
virtual
void
paint
(
QPainter
*
painter
,
const
QStyleOptionGraphicsItem
*
styleOption
,
QWidget
*
widget
);
virtual
QVariant
itemChange
(
GraphicsItemChange
change
,
const
QVariant
&
value
);
virtual
QVariant
itemChange
(
GraphicsItemChange
change
,
const
QVariant
&
value
);
...
@@ -105,6 +105,8 @@ class UBGraphicsRuler : public UBAbstractDrawRuler, public QGraphicsRectItem, pu
...
@@ -105,6 +105,8 @@ class UBGraphicsRuler : public UBAbstractDrawRuler, public QGraphicsRectItem, pu
static
const
int
sMinLength
=
150
;
// 3sm
static
const
int
sMinLength
=
150
;
// 3sm
static
const
int
sMaxLength
=
35000
;
// 700sm
static
const
int
sMaxLength
=
35000
;
// 700sm
qreal
mStrokeWidth
;
};
};
#endif
/* UBGRAPHICSRULER_H_ */
#endif
/* UBGRAPHICSRULER_H_ */
src/tools/UBGraphicsTriangle.cpp
View file @
1df0122f
...
@@ -855,13 +855,14 @@ void UBGraphicsTriangle::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
...
@@ -855,13 +855,14 @@ void UBGraphicsTriangle::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
void
UBGraphicsTriangle
::
StartLine
(
const
QPointF
&
scenePos
,
qreal
width
)
void
UBGraphicsTriangle
::
StartLine
(
const
QPointF
&
scenePos
,
qreal
width
)
{
{
QPointF
itemPos
=
mapFromScene
(
scenePos
);
QPointF
itemPos
=
mapFromScene
(
scenePos
);
mStrokeWidth
=
width
;
qreal
y
;
qreal
y
;
if
(
mOrientation
==
0
||
mOrientation
==
1
)
{
if
(
mOrientation
==
0
||
mOrientation
==
1
)
{
y
=
rect
().
y
()
+
rect
().
height
()
+
w
idth
/
2
;
y
=
rect
().
y
()
+
rect
().
height
()
+
mStrokeW
idth
/
2
;
}
else
if
(
mOrientation
==
2
||
mOrientation
==
3
)
{
}
else
if
(
mOrientation
==
2
||
mOrientation
==
3
)
{
y
=
rect
().
y
()
-
w
idth
/
2
;
y
=
rect
().
y
()
-
mStrokeW
idth
/
2
;
}
}
if
(
itemPos
.
x
()
<
rect
().
x
()
+
sLeftEdgeMargin
)
if
(
itemPos
.
x
()
<
rect
().
x
()
+
sLeftEdgeMargin
)
...
@@ -873,19 +874,20 @@ void UBGraphicsTriangle::StartLine(const QPointF &scenePos, qreal width)
...
@@ -873,19 +874,20 @@ void UBGraphicsTriangle::StartLine(const QPointF &scenePos, qreal width)
itemPos
=
mapToScene
(
itemPos
);
itemPos
=
mapToScene
(
itemPos
);
scene
()
->
moveTo
(
itemPos
);
scene
()
->
moveTo
(
itemPos
);
scene
()
->
drawLineTo
(
itemPos
,
w
idth
,
true
);
scene
()
->
drawLineTo
(
itemPos
,
mStrokeW
idth
,
true
);
}
}
void
UBGraphicsTriangle
::
DrawLine
(
const
QPointF
&
scenePos
,
qreal
width
)
void
UBGraphicsTriangle
::
DrawLine
(
const
QPointF
&
scenePos
,
qreal
width
)
{
{
Q_UNUSED
(
width
);
QPointF
itemPos
=
mapFromScene
(
scenePos
);
QPointF
itemPos
=
mapFromScene
(
scenePos
);
qreal
y
;
qreal
y
;
if
(
mOrientation
==
0
||
mOrientation
==
1
)
{
if
(
mOrientation
==
0
||
mOrientation
==
1
)
{
y
=
rect
().
y
()
+
rect
().
height
()
+
w
idth
/
2
;
y
=
rect
().
y
()
+
rect
().
height
()
+
mStrokeW
idth
/
2
;
}
else
if
(
mOrientation
==
2
||
mOrientation
==
3
)
{
}
else
if
(
mOrientation
==
2
||
mOrientation
==
3
)
{
y
=
rect
().
y
()
-
w
idth
/
2
;
y
=
rect
().
y
()
-
mStrokeW
idth
/
2
;
}
}
if
(
itemPos
.
x
()
<
rect
().
x
()
+
sLeftEdgeMargin
)
if
(
itemPos
.
x
()
<
rect
().
x
()
+
sLeftEdgeMargin
)
...
@@ -897,7 +899,7 @@ void UBGraphicsTriangle::DrawLine(const QPointF &scenePos, qreal width)
...
@@ -897,7 +899,7 @@ void UBGraphicsTriangle::DrawLine(const QPointF &scenePos, qreal width)
itemPos
=
mapToScene
(
itemPos
);
itemPos
=
mapToScene
(
itemPos
);
// We have to use "pointed" line for marker tool
// We have to use "pointed" line for marker tool
scene
()
->
drawLineTo
(
itemPos
,
w
idth
,
scene
()
->
drawLineTo
(
itemPos
,
mStrokeW
idth
,
UBDrawingController
::
drawingController
()
->
stylusTool
()
!=
UBStylusTool
::
Marker
);
UBDrawingController
::
drawingController
()
->
stylusTool
()
!=
UBStylusTool
::
Marker
);
}
}
...
...
src/tools/UBGraphicsTriangle.h
View file @
1df0122f
...
@@ -168,6 +168,7 @@ class UBGraphicsTriangle : public UBAbstractDrawRuler, public QGraphicsPolygonIt
...
@@ -168,6 +168,7 @@ class UBGraphicsTriangle : public UBAbstractDrawRuler, public QGraphicsPolygonIt
static
const
int
sArrowLength
=
30
;
static
const
int
sArrowLength
=
30
;
static
const
int
sMinWidth
=
380
;
static
const
int
sMinWidth
=
380
;
static
const
int
sMinHeight
=
200
;
static
const
int
sMinHeight
=
200
;
qreal
mStrokeWidth
;
};
};
#endif
/* UBGRAPHICSTRIANGLE_H_ */
#endif
/* UBGRAPHICSTRIANGLE_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