Can we allow only one widget to layout?
-
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?
-
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. -
Putting in mind my heirarchy of widgets can you please tell me how can i put such condition to add only one graph if it is present?
@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.