0

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?

yayuj
  • 2,194
  • 3
  • 17
  • 29
  • 1
    I think i'd go with an OpenGL camera that moves along the graph (transformation matrix that moves the graph) and completely bypass Qt scrolling features. – Uroc327 Oct 30 '14 at 17:07
  • It might work, I will try it out. Thanks @Uroc327 – yayuj Oct 30 '14 at 17:08

1 Answers1

1

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.

Jablonski
  • 18,083
  • 2
  • 46
  • 47
  • Amazing, I will check for examples and how to implement this better. – yayuj Oct 30 '14 at 17:17
  • 1
    @MrAlmighty Note: Qwt is really powerful tool and has much more than just plotting but it is a third-party library but it great works with Qt – Jablonski Oct 30 '14 at 17:19
  • The real propose is to study and try to implement my own, even simpler than Qwt's plotting. It's totally reinventing the well but I need to understand how it works. – yayuj Oct 30 '14 at 17:25