Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
OpenGEODE
Commits
9ab2be82
Commit
9ab2be82
authored
Nov 07, 2019
by
Maxime Perrotin
Browse files
Fix various geometry issues
due to Qt5 regressions
parent
4ba4cd84
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
opengeode/genericSymbols.py
View file @
9ab2be82
...
...
@@ -160,7 +160,7 @@ class Symbol(QObject, QGraphicsPathItem):
self
.
setCacheMode
(
QGraphicsItem
.
NoCache
)
# Initialize variables used when moving/resizing
self
.
coord
=
self
.
position
self
.
height
=
0
#
self.height = 0
defined at subclass level
self
.
old_rect
=
self
.
boundingRect
()
# List of visible connection points (that can move)
self
.
movable_points
=
[]
...
...
@@ -191,6 +191,9 @@ class Symbol(QObject, QGraphicsPathItem):
except
AttributeError
:
return
False
def
boundingRect
(
self
):
return
QRectF
(
0
,
0
,
self
.
width
,
self
.
height
)
@
property
def
allowed_followers
(
self
):
'''
...
...
@@ -503,15 +506,7 @@ class Symbol(QObject, QGraphicsPathItem):
return
delta_x
=
(
self
.
boundingRect
().
width
()
-
rect
.
width
())
/
2.0
delta_y
=
self
.
boundingRect
().
height
()
-
rect
.
height
()
# Qt5 behaves differently from Qt4 (most likely a bug in Qt5)
# when setting the shape, the bounnding rect of the parent is not set
# to the same value as the bounding rect of the shape! The value
# is increased by 1 for some reason.. To compensate we have to
# decrease by 1 the width and height here.
# It is likely that if this bug is fixed at some point (in Qt5 or
# PySide2), the effect will be that the symbols will SHRINK in size
# when user clicks on the scene or edits the text...
self
.
set_shape
(
rect
.
width
()
-
1
,
rect
.
height
()
-
1
)
self
.
set_shape
(
rect
.
width
(),
rect
.
height
())
# Align children properly when resizing
try
:
self
.
text
.
set_textbox_position
()
...
...
@@ -547,6 +542,9 @@ class Symbol(QObject, QGraphicsPathItem):
def
set_shape
(
self
,
width
,
height
):
''' to be implemented per symbol in subclasses '''
#LOG.debug("generic set_shape")
#rect = self.boundingRect()
#self.width, self.height = rect.width(), rect.height()
self
.
width
,
self
.
height
=
width
,
height
_
,
_
=
width
,
height
self
.
prepareGeometryChange
()
self
.
updateConnectionPoints
()
...
...
opengeode/sdlSymbols.py
View file @
9ab2be82
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
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