diff --git a/ryven-editor/ryven/example_nodes/std/gui.py b/ryven-editor/ryven/example_nodes/std/gui.py index 8d332bd3..7adae1e7 100644 --- a/ryven-editor/ryven/example_nodes/std/gui.py +++ b/ryven-editor/ryven/example_nodes/std/gui.py @@ -197,7 +197,7 @@ def rebuild_remove_actions(self): {'method': self.remove_output, 'data': i} -class ButtonNode_MainWidget(QPushButton, NodeMainWidget): +class ButtonNode_MainWidget(NodeMainWidget, QPushButton): def __init__(self, params): NodeMainWidget.__init__(self, params) diff --git a/ryven-editor/ryven/gui/startup_dialog/StartupDialog.py b/ryven-editor/ryven/gui/startup_dialog/StartupDialog.py index bed2b94d..16e04877 100644 --- a/ryven-editor/ryven/gui/startup_dialog/StartupDialog.py +++ b/ryven-editor/ryven/gui/startup_dialog/StartupDialog.py @@ -71,7 +71,8 @@ def minimumSizeHint(self): def sizeHint(self): hint = self.fontMetrics().boundingRect(self.text()).size() - l, t, r, b = self.getContentsMargins() + c_margins = self.contentsMargins() + l, t, r, b = c_margins.left(), c_margins.top(), c_margins.right(), c_margins.bottom() margin = self.margin() * 2 return QSize( min(100, hint.width()) + l + r + margin, @@ -83,7 +84,8 @@ def paintEvent(self, event): opt = QStyleOptionFrame() self.initStyleOption(opt) self.style().drawControl(QStyle.CE_ShapedFrame, opt, qp, self) - l, t, r, b = self.getContentsMargins() + c_margins = self.contentsMargins() + l, t, r, b = c_margins.left(), c_margins.top(), c_margins.right(), c_margins.bottom() margin = self.margin() try: # since Qt >= 5.11 diff --git a/ryvencore-qt/ryvencore_qt/src/flows/FlowView.py b/ryvencore-qt/ryvencore_qt/src/flows/FlowView.py index 317f72cb..42f06bd2 100644 --- a/ryvencore-qt/ryvencore_qt/src/flows/FlowView.py +++ b/ryvencore-qt/ryvencore_qt/src/flows/FlowView.py @@ -31,12 +31,17 @@ QShortcut, QMenu, QGraphicsItem, - QUndoStack, QPushButton, QHBoxLayout, QWidget, ) +# for compatibility between qt5 and qt6 +try: + from qtpy.QtGui import QUndoStack +except ImportError: + from qtpy.QtWidgets import QUndoStack + from ryvencore.Flow import Flow from ryvencore.Node import Node from ryvencore.NodePort import NodePort, NodeInput, NodeOutput @@ -254,13 +259,11 @@ def init_proxy_widget(widget: QWidget, proxy: FlowViewProxyWidget): menu_layout_widget.layout().addWidget(menu_button) def menu_button_clicked(): - point = self._menu_layout_proxy.scenePos() - view_pos = self.mapFromScene(point.toPoint()) - # apply offset after - global_pos = self.viewport().mapToGlobal( - view_pos) + QPoint(8, self._menu_layout_proxy.widget().height() - ) - self._menu.exec_(global_pos) + # prob not entirely correct, since menu is part of a layout + # but since it's the first item, it's the same + menu_pos = self._menu_button.pos() + menu_pos = self.mapToGlobal(menu_pos) + QPoint(8, self._menu_button.height() + 10) + self._menu.exec_(menu_pos) menu_button.clicked.connect(menu_button_clicked) @@ -506,13 +509,15 @@ def wheelEvent(self, event): if event.modifiers() & Qt.ControlModifier: event.accept() - self._zoom_data['viewport pos'] = event.posF() - self._zoom_data['scene pos'] = pointF_mapped(self.mapToScene(event.pos()), event.posF()) + view_pos = event.position() + self._zoom_data['viewport pos'] = view_pos + self._zoom_data['scene pos'] = self.mapToScene(view_pos.toPoint()) - self._zoom_data['delta'] += event.delta() + y_delta = event.angleDelta().y() + self._zoom_data['delta'] += y_delta - if self._zoom_data['delta'] * event.delta() < 0: - self._zoom_data['delta'] = event.delta() + if self._zoom_data['delta'] * y_delta < 0: + self._zoom_data['delta'] = y_delta() anim = QTimeLine(100, self) anim.setUpdateInterval(10) diff --git a/ryvencore-qt/ryvencore_qt/src/flows/node_list_widget/NodeListWidget.py b/ryvencore-qt/ryvencore_qt/src/flows/node_list_widget/NodeListWidget.py index 0d573fb1..d892164f 100644 --- a/ryvencore-qt/ryvencore_qt/src/flows/node_list_widget/NodeListWidget.py +++ b/ryvencore-qt/ryvencore_qt/src/flows/node_list_widget/NodeListWidget.py @@ -151,10 +151,10 @@ def search_pkg_tree(self, search: str): # removes whitespace and escapes all special regex chars new_search = escape(search.strip()) # regex that enforces the text starts with - self.pack_proxy_model.setFilterRegExp(f'^{new_search}') + self.pack_proxy_model.setFilterRegularExpression(f'^{new_search}') self.pack_tree.expandAll() else: - self.pack_proxy_model.setFilterRegExp('') + self.pack_proxy_model.setFilterRegularExpression('') self.pack_tree.collapseAll() def make_nodes_current(self, pack_nodes, pkg_name: str):