Can we allow only one widget to layout?
Unsolved
Qt for Python
-
I have a situation where I want to make a graph (matplotlib)..When I push button, it takes data from qlineedits and make a graph in UI which contain qwidget->scroll->vboxlayout.. When I press button it makes graph.. but when I edit data instead of updating my graph it adds another graph.. So I want one edited graph.. how can i do this?
-
@aadil50 said in Can we allow only one widget to layout?:
how can i do this?
Don't add second one, right?
So, fix your code and only add graph if there is no graph yet. -
@aadil50 Isn't it simple?
if (!ui->graphWidget) { // Create the graph widget: ui->graphWidget = new ... // Add the graph widget to the layout }
ui->graphWidget is just a place holder, adjust it to your code.
I also assume that you initialize ui->graphWidget as nullptr.