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
b84294df
Commit
b84294df
authored
Oct 15, 2012
by
Claudio Valerio
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed issue with ruler and compass. They show now the correct radius information
parent
c57d086e
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
139 additions
and
130 deletions
+139
-130
UBFileSystemUtils.cpp
src/frameworks/UBFileSystemUtils.cpp
+0
-1
UBGraphicsCompass.cpp
src/tools/UBGraphicsCompass.cpp
+23
-16
UBGraphicsCompass.h
src/tools/UBGraphicsCompass.h
+1
-1
UBGraphicsRuler.cpp
src/tools/UBGraphicsRuler.cpp
+115
-112
No files found.
src/frameworks/UBFileSystemUtils.cpp
View file @
b84294df
...
...
@@ -397,7 +397,6 @@ QString UBFileSystemUtils::lastPathComponent(const QString& path)
QString
UBFileSystemUtils
::
mimeTypeFromFileName
(
const
QString
&
fileName
)
{
Q_ASSERT
(
fileName
.
length
());
QString
ext
=
extension
(
fileName
);
if
(
ext
==
"xls"
||
ext
==
"xlsx"
)
return
"application/msexcel"
;
...
...
src/tools/UBGraphicsCompass.cpp
View file @
b84294df
...
...
@@ -51,6 +51,13 @@ UBGraphicsCompass::UBGraphicsCompass()
,
mDrewCenterCross
(
false
)
{
setRect
(
sDefaultRect
);
setBrush
(
QBrush
(
Qt
::
red
));
//TODO claudio: remove code duplication
QDesktopWidget
*
desktop
=
UBApplication
::
desktop
();
int
dpiCommon
=
(
desktop
->
physicalDpiX
()
+
desktop
->
physicalDpiY
())
/
2
;
mPixelsPerMillimeter
=
qRound
(
dpiCommon
/
25.4
f
);
setFlag
(
QGraphicsItem
::
ItemIsMovable
,
true
);
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
true
);
setFlag
(
QGraphicsItem
::
ItemSendsGeometryChanges
,
true
);
...
...
@@ -68,7 +75,7 @@ UBGraphicsCompass::UBGraphicsCompass()
updateResizeCursor
();
updateDrawCursor
();
unsetCursor
();
unsetCursor
();
setData
(
UBGraphicsItemData
::
itemLayerType
,
QVariant
(
itemLayerType
::
CppTool
));
//Necessary to set if we want z value to be assigned correctly
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
false
);
...
...
@@ -179,9 +186,9 @@ QVariant UBGraphicsCompass::itemChange(GraphicsItemChange change, const QVariant
void
UBGraphicsCompass
::
mousePressEvent
(
QGraphicsSceneMouseEvent
*
event
)
{
if
(
UBDrawingController
::
drawingController
()
->
stylusTool
()
!=
UBStylusTool
::
Selector
&&
if
(
UBDrawingController
::
drawingController
()
->
stylusTool
()
!=
UBStylusTool
::
Selector
&&
UBDrawingController
::
drawingController
()
->
stylusTool
()
!=
UBStylusTool
::
Play
)
return
;
return
;
if
(
resizeButtonRect
().
contains
(
event
->
pos
()))
{
...
...
@@ -216,9 +223,9 @@ void UBGraphicsCompass::mousePressEvent(QGraphicsSceneMouseEvent *event)
void
UBGraphicsCompass
::
mouseMoveEvent
(
QGraphicsSceneMouseEvent
*
event
)
{
if
(
UBDrawingController
::
drawingController
()
->
stylusTool
()
!=
UBStylusTool
::
Selector
&&
if
(
UBDrawingController
::
drawingController
()
->
stylusTool
()
!=
UBStylusTool
::
Selector
&&
UBDrawingController
::
drawingController
()
->
stylusTool
()
!=
UBStylusTool
::
Play
)
return
;
return
;
if
(
!
mResizing
&&
!
mRotating
&&
!
mDrawing
)
{
...
...
@@ -261,9 +268,9 @@ void UBGraphicsCompass::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
void
UBGraphicsCompass
::
mouseReleaseEvent
(
QGraphicsSceneMouseEvent
*
event
)
{
if
(
UBDrawingController
::
drawingController
()
->
stylusTool
()
!=
UBStylusTool
::
Selector
&&
if
(
UBDrawingController
::
drawingController
()
->
stylusTool
()
!=
UBStylusTool
::
Selector
&&
UBDrawingController
::
drawingController
()
->
stylusTool
()
!=
UBStylusTool
::
Play
)
return
;
return
;
if
(
mResizing
)
{
...
...
@@ -302,9 +309,9 @@ void UBGraphicsCompass::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
void
UBGraphicsCompass
::
hoverEnterEvent
(
QGraphicsSceneHoverEvent
*
event
)
{
if
(
UBDrawingController
::
drawingController
()
->
stylusTool
()
!=
UBStylusTool
::
Selector
&&
if
(
UBDrawingController
::
drawingController
()
->
stylusTool
()
!=
UBStylusTool
::
Selector
&&
UBDrawingController
::
drawingController
()
->
stylusTool
()
!=
UBStylusTool
::
Play
)
return
;
return
;
mOuterCursor
=
cursor
();
mShowButtons
=
shape
().
contains
(
event
->
pos
());
...
...
@@ -332,9 +339,9 @@ void UBGraphicsCompass::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
void
UBGraphicsCompass
::
hoverLeaveEvent
(
QGraphicsSceneHoverEvent
*
event
)
{
if
(
UBDrawingController
::
drawingController
()
->
stylusTool
()
!=
UBStylusTool
::
Selector
&&
if
(
UBDrawingController
::
drawingController
()
->
stylusTool
()
!=
UBStylusTool
::
Selector
&&
UBDrawingController
::
drawingController
()
->
stylusTool
()
!=
UBStylusTool
::
Play
)
return
;
return
;
mShowButtons
=
false
;
mCloseSvgItem
->
setVisible
(
mShowButtons
);
...
...
@@ -346,9 +353,9 @@ void UBGraphicsCompass::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
void
UBGraphicsCompass
::
hoverMoveEvent
(
QGraphicsSceneHoverEvent
*
event
)
{
if
(
UBDrawingController
::
drawingController
()
->
stylusTool
()
!=
UBStylusTool
::
Selector
&&
if
(
UBDrawingController
::
drawingController
()
->
stylusTool
()
!=
UBStylusTool
::
Selector
&&
UBDrawingController
::
drawingController
()
->
stylusTool
()
!=
UBStylusTool
::
Play
)
return
;
return
;
mShowButtons
=
shape
().
contains
(
event
->
pos
());
mCloseSvgItem
->
setVisible
(
mShowButtons
);
...
...
@@ -399,7 +406,7 @@ void UBGraphicsCompass::paintAngleDisplay(QPainter *painter)
void
UBGraphicsCompass
::
paintRadiusDisplay
(
QPainter
*
painter
)
{
qreal
radiusInCentimeters
=
rect
().
width
()
/
(
s
PixelsPerMillimeter
*
10
);
qreal
radiusInCentimeters
=
rect
().
width
()
/
(
m
PixelsPerMillimeter
*
10
);
QString
format
=
rect
().
width
()
>=
sDisplayRadiusUnitMinLength
?
"%1 cm"
:
"%1"
;
QString
radiusText
=
QString
(
format
).
arg
(
radiusInCentimeters
,
0
,
'f'
,
1
);
...
...
@@ -557,10 +564,10 @@ void UBGraphicsCompass::paintCenterCross()
QPointF
needleCrossCenter
=
mapToScene
(
needlePosition
());
scene
()
->
moveTo
(
QPointF
(
needleCrossCenter
.
x
()
-
5
,
needleCrossCenter
.
y
()));
scene
()
->
drawLineTo
(
QPointF
(
needleCrossCenter
.
x
()
+
5
,
needleCrossCenter
.
y
()),
1
,
UBDrawingController
::
drawingController
()
->
stylusTool
()
==
UBStylusTool
::
Line
);
UBDrawingController
::
drawingController
()
->
stylusTool
()
==
UBStylusTool
::
Line
);
scene
()
->
moveTo
(
QPointF
(
needleCrossCenter
.
x
(),
needleCrossCenter
.
y
()
-
5
));
scene
()
->
drawLineTo
(
QPointF
(
needleCrossCenter
.
x
(),
needleCrossCenter
.
y
()
+
5
),
1
,
UBDrawingController
::
drawingController
()
->
stylusTool
()
==
UBStylusTool
::
Line
);
UBDrawingController
::
drawingController
()
->
stylusTool
()
==
UBStylusTool
::
Line
);
}
QPointF
UBGraphicsCompass
::
needlePosition
()
const
...
...
src/tools/UBGraphicsCompass.h
View file @
b84294df
...
...
@@ -113,6 +113,7 @@ class UBGraphicsCompass: public QObject, public QGraphicsRectItem, public UBItem
QGraphicsSvgItem
*
mResizeSvgItem
;
qreal
mAntiScaleRatio
;
bool
mDrewCenterCross
;
int
mPixelsPerMillimeter
;
// Constants
static
const
QRect
sDefaultRect
;
...
...
@@ -130,7 +131,6 @@ class UBGraphicsCompass: public QObject, public QGraphicsRectItem, public UBItem
static
const
QColor
sDarkBackgroundEdgeFillColor
;
static
const
QColor
sDarkBackgroundMiddleFillColor
;
static
const
QColor
sDarkBackgroundDrawColor
;
static
const
int
sPixelsPerMillimeter
=
5
;
static
const
int
sDisplayRadiusOnPencilArmMinLength
=
300
;
static
const
int
sDisplayRadiusUnitMinLength
=
250
;
};
...
...
src/tools/UBGraphicsRuler.cpp
View file @
b84294df
This diff is collapsed.
Click to expand it.
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