PDA

View Full Version : QwtPlotCurve and QScrollArea



Fanwa
1st December 2010, 15:53
Hello,
I hope this is the right Forum for this, perhaps it's more a general QT-Question, but my main problem is that I have to add a ScrollBar to a QwtCurvePlot and I fail to do so.
My code in short looks like this:

widget.cpp

Widget::Widget(QWidget *parent) : QwtPlot(parent),
ui(new Ui::Widget)
{
ui->setupUi(this);
this.setupPlot();
}

setupPlot() {
QwtPlotCurve *curve new QwtPlotCurve();
QScrollArea *sa = new QScrollArea;

// sa->setWidget(this); // he compiles this line, but shows no window...

curve->attach(this);

}

So my question is: How do I "link" the QScrollArea with my widget/curve, so that I can Scroll the QwtPlotCurve? I tried everything I could imagine but I'm running out of ideas. As a QT-Noobie, I guessed I have the widget (this) where my curve is attached to, but when I attach the QScrollArea to "this", he shows no Window after building the code. If I run:

QScrollArea *sa = new QScrollArea(this);

instead of:

sa->setWidget(this).

I get a grey Box in the top left corner, I guess this is the ScrollArea I wanted, but how can i attach the curve to that Area?

Thanks in advance,
Fanwa

Uwe
2nd December 2010, 07:49
No answer to your question, but: check the Qwt realtime example. It implemets a zoomer, that adds scrollbars when you zoom in.

Uwe