Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B-ASIC - Better ASIC Toolbox
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Computer Engineering
B-ASIC - Better ASIC Toolbox
Merge requests
!129
Add testing with pyqt5
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Add testing with pyqt5
testpyqt5
into
master
Overview
0
Commits
1
Pipelines
15
Changes
8
Merged
Oscar Gustafsson
requested to merge
testpyqt5
into
master
2 years ago
Overview
0
Commits
1
Pipelines
15
Changes
8
Expand
Closes
#146 (closed)
Edited
2 years ago
by
Oscar Gustafsson
0
0
Merge request reports
Viewing commit
ef01e513
Show latest version
8 files
+
79
−
21
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
8
Search (e.g. *.vue) (Ctrl+P)
ef01e513
Add testing with pyqt5
· ef01e513
Oscar Gustafsson
authored
2 years ago
b_asic/GUI/drag_button.py
+
15
−
5
Options
@@ -83,22 +83,30 @@ class DragButton(QPushButton):
def
mousePressEvent
(
self
,
event
):
if
event
.
button
()
==
Qt
.
MouseButton
.
LeftButton
:
self
.
_m_press
=
True
self
.
_mouse_press_pos
=
event
.
pos
()
self
.
_mouse_move_pos
=
event
.
pos
()
pos
=
event
.
globalPosition
().
toPoint
()
self
.
_mouse_press_pos
=
pos
self
.
_mouse_move_pos
=
pos
super
().
mousePressEvent
(
event
)
def
mouseMoveEvent
(
self
,
event
):
if
event
.
buttons
()
==
Qt
.
MouseButton
.
LeftButton
and
self
.
_m_press
:
self
.
_m_drag
=
True
self
.
move
(
self
.
mapToParent
(
event
.
pos
()
-
self
.
_mouse_press_pos
))
self
.
move
(
self
.
mapToParent
(
event
.
globalPosition
().
toPoint
()
-
self
.
_mouse_press_pos
)
)
if
self
in
self
.
_window
.
pressed_operations
:
for
button
in
self
.
_window
.
pressed_operations
:
if
button
is
self
:
continue
button
.
move
(
button
.
mapToParent
(
event
.
pos
()
-
self
.
_mouse_press_pos
)
button
.
mapToParent
(
event
.
globalPosition
().
toPoint
()
-
self
.
_mouse_press_pos
)
)
self
.
_window
.
scene
.
update
()
@@ -109,7 +117,9 @@ class DragButton(QPushButton):
self
.
_m_press
=
False
if
self
.
_m_drag
:
if
self
.
_mouse_press_pos
is
not
None
:
moved
=
event
.
pos
()
-
self
.
_mouse_press_pos
moved
=
(
event
.
globalPosition
().
toPoint
()
-
self
.
_mouse_press_pos
)
if
moved
.
manhattanLength
()
>
3
:
event
.
ignore
()
Loading