[Solved]Align scrollbar
-
wrote on 31 Jan 2012, 10:12 last edited by
Is there anyone who can in a simple way explain how I could align a Scrollbar to a QWT Plot widget.
I have tried with a scrollbar and a scrollarea but nothing works.Maybe someone have done this and got a smaller example.
pls
-
wrote on 31 Jan 2012, 10:25 last edited by
You can set the QWT plot widget as the widget for a QScrollArea using QScrollArea::setWidget. Note that it is up to you to make sure the plot widget then has the needed size.
-
wrote on 31 Jan 2012, 10:30 last edited by
Yes I tried that but if I set the setWidget(QWtplot)
the plotter area(Canvas) disappers.I'm a very newbee on this so I need some help
-
wrote on 31 Jan 2012, 10:32 last edited by
Show us the code then.
-
wrote on 31 Jan 2012, 10:33 last edited by
The code where I set Up the plot
@ ui->qwtPlot->setAxisScale(0,0,310,50);
ui->qwtPlot->setCanvasBackground(QBrush(Qt::white));ui->qwtPlot->setTitle("Power"); ui->qwtPlot->setAxisMaxMinor(2,0); //ui->qwtPlot->plotLayout()->setAlignCanvasToScales(true); ui->qwtPlot->setAxisTitle(0,"[kw]"); ui->qwtPlot->setAxisTitle(2,"Time [Sec]");
// panner = new QwtPanner(ui->qwtPlot->canvas());
ui->qwtPlot->canvas()->setPaintAttribute(QwtPlotCanvas::BackingStore,false);ui->qwtPlot->canvas()->setBaseSize(490,271); scrollArea = new QScrollArea(); scrollArea->setBackgroundRole(QPalette::Window); scrollArea->setWidget(ui->qwtPlot->canvas()); scrollArea->setAlignment(Qt::AlignBottom);
@
-
wrote on 2 Feb 2012, 07:22 last edited by
Qwt comes with a set of examples. In the realtime example you find a class ScrollZoomer, that adds scrollbars depending on the zoom base and the current zoom rectangle.
Adopting this class shoudln't be too difficult, but the code above that will never work as it breaks the layout code of QwtPlot and changes the parent/child relation of QwtPlot and its canvas.
Uwe
-
wrote on 2 Feb 2012, 12:32 last edited by
OK thanks Uwe
Maybe I can reach my goal if I use the panner in qwt?
7/7