jchanvfx / NodeGraphQt

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

Occupying the whole node area with a custom widget #422

Open EssenOH opened 3 weeks ago

EssenOH commented 3 weeks ago

I am trying to place a custom widget occupying entire node area, but I got following result :

image

I'd like to make it such as following :

image

so, I have assigned input port without name, and didn't assign output port, but the custom node always keep some space from the input port as the picture.

jack-mil commented 3 weeks ago

Likely related to #402

EssenOH commented 2 weeks ago

What do you think about this change ?

    # width = port_width + max([text_w, port_text_width]) + side_padding
    # height = max([text_h, p_input_height, p_output_height, widget_height])
    # if widget_width:
    #     # add additional width for node widget.
    #     width += widget_width

    height = max([text_h, p_input_height, p_output_height, widget_height])
    if widget_width:
        # add additional width for node widget.
        if port_text_width:
            width = port_width + max([text_w, port_text_width]) + side_padding
            width += widget_width
        else:
            width = port_width + max([text_w, widget_width])
    else:
        width = port_width + max([text_w, port_text_width]) + side_padding

    if widget_height:
        # add bottom margin for node widget.
        height += 2.0
    height *= 1.05
    return width, height

image

Still, there is some space on left side, but it is much better than before.