how do i resize the Qwt plot when i am resizing the Qwidget
-
I have applayed resizeevent to QWidget if, i am trying to resize the widget inside a widget QWT plot is there that should also resize. I have applayed resizeevent to the QWidget and resize to the plot.
i have written bellow code
void SampleWidget:: resizeEvent(QResizeEvent* event)
{
QWidget::resizeEvent(event);int diffofWidth = event->size().width() - event->oldSize().width(); int diffofHeight = event->size().height() - event->oldSize().height(); QSize size = plot->size(); if ((event->oldSize().width() >= 0) && (event->oldSize().height() >= 0)) { if (event->size().width() <= this->minimumWidth() && event->size().height() <= this->minimumHeight()) { return; } else { plot->resize(size.width() + diffofWidth, size.height() + diffofHeight); plot->replot(); } }
}
I have written this above code widget is able to resize after so many times resize performed to the widget.plot is displayed partial in the widget. i am not able to see whole content in the widget. i have set the minimumsize( 400, 400) of the widget to restrict the minimum size for the widget beyond that limit widget should not minimize. but it's not working.Could you please any one guide me to solve my issue.
-
Hi and welcome to devnet,
Why not use a layout for that ?