mirror of
https://github.com/GNS3/gns3-gui.git
synced 2026-05-17 00:46:01 +03:00
Add Snap to Grid to Qt ui file
This commit is contained in:
@@ -377,7 +377,8 @@ class NodeItem():
|
||||
:param value: value of the change
|
||||
"""
|
||||
|
||||
if change == 9 and self._main_window.uiSnapToGridAction.isChecked(): # Unsure but change seems to alternate between 0/9 while dragging
|
||||
# was causing infinite recursion loops when placed within the below if statements
|
||||
if change == QtWidgets.QGraphicsItem.ItemPositionHasChanged and self._main_window.uiSnapToGridAction.isChecked():
|
||||
GRID_SIZE = 75
|
||||
self.setPos(float(GRID_SIZE * round(self.x() / GRID_SIZE)), float(GRID_SIZE * round(self.y() / GRID_SIZE)))
|
||||
|
||||
|
||||
@@ -126,6 +126,7 @@ background-none;
|
||||
<addaction name="uiFitInViewAction"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="uiShowLayersAction"/>
|
||||
<addaction name="uiSnapToGridAction"/>
|
||||
<addaction name="uiResetPortLabelsAction"/>
|
||||
<addaction name="uiShowPortNamesAction"/>
|
||||
<addaction name="separator"/>
|
||||
@@ -889,6 +890,17 @@ background-none;
|
||||
<string>Show layers</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="uiSnapToGridAction">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Snap To Grid</string>
|
||||
</property>
|
||||
<property name="statusTip">
|
||||
<string>Snap To Grid</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="uiSaveProjectAsAction">
|
||||
<property name="icon">
|
||||
<iconset resource="../../resources/resources.qrc">
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Form implementation generated from reading ui file '/home/grossmj/PycharmProjects/gns3-gui/gns3/ui/main_window.ui'
|
||||
# Form implementation generated from reading ui file '/home/cometo/dev/gns3-gui/gns3/ui/main_window.ui'
|
||||
#
|
||||
# Created: Tue Apr 26 11:38:43 2016
|
||||
# by: PyQt5 UI code generator 5.2.1
|
||||
# Created by: PyQt5 UI code generator 5.5.1
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
|
||||
|
||||
Reference in New Issue
Block a user