Skip to content

Commit

Permalink
Passing a cancel signal from a line edit to moving a model
Browse files Browse the repository at this point in the history
  • Loading branch information
LoneGit committed Jun 4, 2024
1 parent a571952 commit 8c8c11f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/figure_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ def params(self):


class StlMovePanel(QWidget):
def __init__(self, methods, captions):
def __init__(self, viev, methods, captions):
super().__init__()

self.setEnabled(False)
Expand All @@ -302,6 +302,7 @@ def __init__(self, methods, captions):
gridLayout.addWidget(btn_neg, row, 1)

edit = QLineEdit()
edit.installEventFilter(viev)
edit.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed)
edit.setMinimumWidth(20)
gridLayout.addWidget(edit, row, 2)
Expand Down
4 changes: 3 additions & 1 deletion src/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,7 @@ def scaleSet(self):
return scalePos, scaleNeg, scaleSet

self.stl_move_panel = StlMovePanel(
self,
{
(0, "X"): translate(1, 0, 0),
(0, "Y"): translate(0, 1, 0),
Expand Down Expand Up @@ -692,7 +693,8 @@ def change_layer_view(

def eventFilter(self, obj, event):
if event.type() == QEvent.KeyPress:
self.keyPressProcessing(event)
if not self.keyPressProcessing(event):
return super().eventFilter(obj, event)
return True
return super().eventFilter(obj, event)

Expand Down

0 comments on commit 8c8c11f

Please sign in to comment.