Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scroll wheel zoom Qt5 #39

Open
tjtr33 opened this issue Nov 2, 2021 · 0 comments
Open

scroll wheel zoom Qt5 #39

tjtr33 opened this issue Nov 2, 2021 · 0 comments

Comments

@tjtr33
Copy link

tjtr33 commented Nov 2, 2021

hello, the mouse wheel crashes the app.
So, in nodz_main.py,
i changed 'event.delta() > 0' to 'event.angleDelta() > 0' ,

    # tjp 02nov  qt5 has angleDelta and pixel Delta if event.delta() > 0:
#  angleDelta always increased despite wheel dir
#  same for pixelDelta
if event.angleDelta() > 0:
        zoomFactor = inFactor
    else:
        zoomFactor = outFactor

I never gto scrollwheel zoom to work
but added KEY_PLUS and KEY_MINUS to do same

    if event.key() == QtCore.Qt.Key_Plus:
    zoomFactor = inFactor
        self.scale(zoomFactor, zoomFactor)
        self.currentState = 'DEFAULT'

    if event.key() == QtCore.Qt.Key_Minus:
    zoomFactor = outFactor
        self.scale(zoomFactor, zoomFactor)
        self.currentState = 'DEFAULT'

Also enabled the scroll bars to all paning hopriz & vert

    #self.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
self.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn)
    #self.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
self.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn)

Then changed the transparency to allow nets to show through nodes
( circumventing coding to avoid other nodes )

// Custom colors > Add and remove as you want.
// Don't forget to edit the end of the dictionary if editing the
// following part.
// 03nov2021 was  "bg": [80, 80, 80, 255],
"node_preset_1": {
    "bg": [80, 80, 80, 127],
    "border": [50, 50, 50, 255],
    "border_sel": [170, 80, 80, 255],
    "text": [230, 230, 230, 255]
},
// 03nov2021 was "bg": [60, 60, 60, 255],
"attr_preset_1": {
    "bg": [60, 60, 60, 127],
    "text": [220, 220, 220, 255],
    "plug": [255, 155, 0, 255],
    "socket": [255, 155, 0, 255]
},

and added arrays of nodes

as in:

------------------mult2------------------------------

mult2 = []
mult2.append( nodz.createNode(name='mult2[0]', preset='node_preset_1', position=None) )
nodz.createAttribute(node=mult2[0], name='in0', index=-1, preset='attr_preset_1', plug=False, socket=True, dataType=float)
nodz.createAttribute(node=mult2[0], name='out', index=-1, preset='attr_preset_1', plug=True, socket=False, dataType=float)
nodz.createAttribute(node=mult2[0], name='in1', index=-1, preset='attr_preset_1', plug=False, socket=True, dataType=float)

------------------end mult2[0]------------------------------

------------------mult2[1]-----------------------------

mult2.append( nodz.createNode(name='mult2[1]', preset='node_preset_1', position=None) )
....

thanks for a nice tool!
I need to make a library of widgets
and drag/drop from a palette
and make visible names for the nets/signals/wires
and allow custome widths

My application is to visulaize the Hal component files of the LinuxCNC project.
thanks TomP 21:06 03nov2021 Thailand

Nodz-zoom-pan-arraysOfWidgets-2021-11-03_20-51-54

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant