Important: Please read the Qt Code of Conduct -

[Solved]Align scrollbar

  • 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.


  • 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.

  • 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

  • Show us the code then.

  • The code where I set Up the plot

    @ ui->qwtPlot->setAxisScale(0,0,310,50);

        ui->qwtPlot->setAxisTitle(2,"Time [Sec]");

    // panner = new QwtPanner(ui->qwtPlot->canvas());

        scrollArea = new QScrollArea();


  • 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.


  • OK thanks Uwe
    Maybe I can reach my goal if I use the panner in qwt?

Log in to reply