Seite 1 von 1

Qwt Runtime Error unter Windows

Verfasst: 3. April 2009 16:37
von mkloth
Hallo,

ich entwickle sowohl unter Linux (Fedora) als auch unter Windows XP. Unter Linux mit Qt 4.4.3 und Qwt 5.1.1 funktioniert der nachfolgende Code ohne Probleme. Unter Windows mit Qt 4.5 und Qwt 5.1.1 startet die Applikation und stürzt ab sobald man versucht zu zoomen.

Code: Alles auswählen

#include <QtGui>
#include <QApplication>

#include <qwt_plot.h>
#include <qwt_plot_curve.h>
#include <qwt_plot_canvas.h>
#include <qwt_plot_zoomer.h>
#include <qwt.h>

class MyPlot : public QwtPlot
{
public:
	MyPlot( QWidget *parent=0) : QwtPlot( parent )
	{

		double x[11], y1[11];
		// Show a title
		setTitle( "This is an Example" );

		// zooming
		QwtPlotCanvas *canvas1 = canvas();
		QwtPlotZoomer *canvas1Zoomer = new QwtPlotZoomer( QwtPlot::xBottom, QwtPlot::yLeft, canvas1 );
		canvas1Zoomer->setSelectionFlags( QwtPicker::DragSelection );
		canvas1Zoomer->setTrackerMode(QwtPicker::ActiveOnly);

		// Show the axes
		setAxisTitle( xBottom, "measurement number" );
		setAxisTitle( yLeft, "values" );

		QwtPlotCurve *curve1 = new QwtPlotCurve("Curve1");
		for (int i=0; i<=10; i++)
		{
			x[i] = i;
			y1[i] = i*2;
		}
		curve1->setData(x, y1, 10);
		curve1->attach(this);
		curve1->setStyle(QwtPlotCurve::CurveStyle(3));
		curve1->setPen(QPen( Qt::blue, 2, Qt::SolidLine ));

		// Show the plots
		replot();
	}
};

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    MyPlot p;
    p.show();

    return a.exec();
}
Mit dem gdb gestartet bekomme ich folgende Fehlermeldung:

Program received signal SIGSEGV, Segmentation fault.
0x100127ce in QwtPicker::PickerWidget::updateMask (this=0x5009258)
at qwt_picker.cpp:133
133 if ( !parentWidget()->testAttribute(Qt::WA_PaintOnScreen) && Current language: auto; currently c++

Bei der Suche im Bugtracker von QtSoftware und Qwt bin ich auch nicht fündig geworden. Vielleicht habt ihr eine Idee.

Verfasst: 3. April 2009 16:47
von MiKla
Ich kenne das Problem, tritt erst seit Qt 4.5. Ich habe folgendes geändert:
qwt_picker.cpp Zeile 132/152:

Code: Alles auswählen

#if QT_VERSION >= 0x045300  //alt #if QT_VERSION >= 0x040300
Qwt neu kompiliert und dann hat es funktioniert!

Ich denke da hat sich was in Qt 4.5 geändert.
Ich hoffe es hilft Dir weiter.


Michael

Verfasst: 3. April 2009 21:15
von mkloth
Hallo Michael,

dein Tipp hat funktioniert. Vielen Dank dafür.

Matthias

Verfasst: 3. April 2009 21:17
von MiKla
Das sollte sich Uwe vielleicht mal anschauen????

Michael

Verfasst: 4. April 2009 01:27
von Uwe
Michael.Klank hat geschrieben:Das sollte sich Uwe vielleicht mal anschauen????
Es gibt doch bereits 2 neue Versionen ( Qwt 5.1.2 und Qwt 5.2.0 ) deren Hauptzweck darin besteht Inkompatibilitäten von Qt 4.5 zu umschiffen.
Den gepostete Stack dagegen glaube ich nicht - bzw. der Absturz kann höchstens ein Folgefehler sein.

Uwe

Verfasst: 4. April 2009 08:16
von MiKla
Danke für die Info. Ich hatte vor einiger Zeit danach geschaut aber nichts gefunden aber das war vor der finalen Version von Qt4.5.0.

Michael