Search code examples
c++qtqtwidgets

scrolless but draggable widget


I’m willing to create a widget that draw graphics using OpenGL that doesn’t have a scroll but you can drag it to show the rest of the graphic. This image describes more or less what I’m talking about:

widget

As you can see there’s an arrow which points the direction that the user can drag and the rest of the graphic is showing.

From where I can start? Is there a tutorial or example that has something similar?


Solution

  • Such widget already exists in Qwt library, additional tool based on Qt.

    Qwt: http://qwt.sourceforge.net/index.html

    QwtPlotPanner: http://qwt.sourceforge.net/class_qwt_plot_panner.html

    example of usage:

    QwtPlotPanner *d_panner = new QwtPlotPanner( ui->qwtPlot->canvas() );
    d_panner->setMouseButton( Qt::LeftButton );
    

    where ui->qwtPlot is a QwtPlot - widget for plotting.