jchanvfx / NodeGraphQt

Node graph framework that can be re-implemented into applications that supports PySide2
http://chantonic.com/NodeGraphQt/
MIT License
1.29k stars 264 forks source link

how to add auto_complete within node text input ? #295

Closed RichardTrouve closed 1 year ago

RichardTrouve commented 1 year ago

hi, not an issue per say, I hope the question is self explenatory enough, i'm trying to figure out how to implement an autocompletion feature into nodes text input. is it actually possible ?

jchanvfx commented 1 year ago

Hi @RichardTrouve,

I think it might be possible you could try accessing the QLineEdit widget from the node and then setting a autocompleter on it.

from NodeGraphQt import NodeGraph, BaseNode

class TestNode(BaseNode):

    __identifier__ = 'my.test'
    NODE_NAME = 'My Text Node'

    def __init__(self):
        super(TestNode, self).__init__()
        self.add_input('in')
        self.add_output('out')

        self.add_text_input('text_input')

        node_widget = node.get_widget('text_input')
        line_edit_widget = node_widget.get_custom_widget()

        print(line_edit_widget)

or you could set your own custom widget to the node from this example. https://jchanvfx.github.io/NodeGraphQt/api/examples/ex_node.html#embedding-custom-widgets

Cheers, Johnny