Divide a custom vertical layout by a Vertical splitter
-
Hi,
I created my layout
PlotVLayout
inherited from abstract classQLayout
PlotVLayout
vertically setsQwtPlot
widgets in a way that all canvases of these plots are one below another. So the main functionality ofPlotVLayout
is that it calculates the XY coordinates for eachQwtPlot
Now I would like to insert something like aQSplitter
betweenQwtPlot
to allow the user to change the height of eachQwtPlot
. The picture is attached.
Is there a way to implement such functionality in myPlotVLayout
?
-
I don't know what is inside your code so I can't really comment,
Why a reference rather than a const reference ?
-
Hi,
Something is not clear. You seem to have re-invented QVBoxLayout. Is that the case ?
In any case, a layout does not have a visual presence, they just do positioning. QSplitter is a widget that seem to do what you want directly. Just use it with the right direction.
-
Hi,
Something is not clear. You seem to have re-invented QVBoxLayout. Is that the case ?
In any case, a layout does not have a visual presence, they just do positioning. QSplitter is a widget that seem to do what you want directly. Just use it with the right direction.
@SGaist no I dont reinvent QVBoxLayout.
Lets suppose that we need twoQwtPlot
one below another but the canvas of each plot should have the same X-pos and different Y. So it is like twoQwtPlot
that share the same X-axis. Like in the picture:
-
I see. In that case you should make a widget that takes advantage of your custom layout and adds a control that works like QSplitter.
You can check QSplitter's implementation.
-
I see. In that case you should make a widget that takes advantage of your custom layout and adds a control that works like QSplitter.
You can check QSplitter's implementation.
@SGaist I encountered a strange problem...
I have two custom layouts (PlotVLayout
) and in private variable (QList<QwtPlot *> splitterPlotList;
) I store list of widgets of both layouts.When I resize the mainwindow I can see that this list changes its size (count of elemetns) from 1 to 2 but it should always be 2 elements in list (I have
qDebug() << splitterPlotList.count();
)I set
splitterPlotList
by reference via:void PlotVLayout::setPlotList(QList<QwtPlot *> &splitterPlotList){ this->splitterPlotList = splitterPlotList; }
Why this happens?
I suspect that when I resize the mainwindow my layouts work in parrallel threads and they are trying to achieve the same variable at the same time? -
I don't know what is inside your code so I can't really comment,
Why a reference rather than a const reference ?
-
I don't know what is inside your code so I can't really comment,
Why a reference rather than a const reference ?
@SGaist I just changed to
const List<> &
and now it works :)
thank you!