Re: QwtCurve::Steps Flickering
Brought to you by:
rathmann
From: Sathya K. <kri...@is...> - 2004-02-25 12:28:08
|
Hi Uwe: I couldn't spot the problem.. Im attaching the code. Thanks for your help. cheers Sathya ------****------ #include <qapplication.h> #include <qlabel.h> #include <qwt.h> #include <qtable.h> #include <qmainwindow.h> #include <qwt_plot.h> #include <qwidget.h> using std:: vector; class MyScatterWidget : public QwtPlot { public: MyScatterWidget (QWidget * parent); }; class MyHistWidget : public QwtPlot { public: MyHistWidget (QWidget *); };=09 MyScatterWidget::MyScatterWidget (QWidget * parent) : QwtPlot(parent) { setMouseTracking (true); setTitle(QString(" ")); setCanvasBackground(white); setAxisFont(QwtPlot::Axis::yLeft, QFont("sansserif", 5, QFont::Normal,=20 TRUE)); setAxisFont(QwtPlot::Axis::xBottom, QFont("sansserif", 5,=20 QFont::Normal, TRUE)); enableAxis (QwtPlot::xBottom , false); enableAxis (QwtPlot::yLeft , false); enableGridXMin (false); enableGridX (false); enableGridYMin (false); enableGridY (false); enableLegend (false); setAutoLegend (false); enableOutline (false); vector <double> xvals; vector <double> yvals; xvals.resize (100); yvals.resize (100); for (int i=3D0; i < 100; i++) { yvals[i] =3D rand (); xvals[i] =3D rand (); } vector<double>::pointer px1=3D &xvals[0]; vector<double>::pointer px2=3D &yvals[0]; long _curveId =3D insertCurve(QString(" ")); if (_curveId =3D=3D 0 ) { printf ("No curve could be created...\n"); return; } setCurveData (_curveId,px1,px2,100); setCurveStyle(_curveId, QwtCurve::Dots); QwtSymbol sym; sym.setStyle(QwtSymbol::XCross); sym.setSize(1); setCurveSymbol(_curveId, sym); setFixedSize (150, 150); replot (); setAutoReplot(false); } MyHistWidget::MyHistWidget (QWidget *parent) : QwtPlot (parent) { setMouseTracking (true); setTitle(QString(" ")); setCanvasBackground(white); enableAxis (QwtPlot::xBottom , false); enableAxis (QwtPlot::yLeft , false); enableGridXMin (false); enableGridX (false); enableGridYMin (false); enableGridY (false); enableLegend (false); vector<double> xvals; vector<double> yvals; xvals.resize (100); yvals.resize (100); for (int i=3D0; i < 100; i++) { xvals [i] =3D i; yvals [i] =3D rand ()*100; } vector<double>::pointer px1=3D &xvals[0]; vector<double>::pointer px2 =3D &yvals[0]; long _curveId =3D insertCurve(QString(" ")); if (_curveId =3D=3D 0 ) { printf ("No curve could be created...\n"); return; } setCurveData (_curveId, px1,px2,xvals.size ()); setCurveStyle(_curveId, QwtCurve::Steps); QwtSymbol sym; sym.setPen(black); sym.setStyle(QwtSymbol::XCross); sym.setSize(1); const QColor &c =3D white; setCurveSymbol(_curveId, sym); setAxisAutoScale(QwtPlot::xBottom); setAxisAutoScale(QwtPlot::yLeft); setFixedSize (150, 150); replot (); setAutoReplot (false); } class MainWindow : public QMainWindow { public: MainWindow (QWidget *parent =3D 0, const char *name =3D 0, WFlags fl =3D= =20 WType_TopLevel); }; MainWindow::MainWindow (QWidget *parent, const char *name, WFlags fl) : QMainWindow(parent, name, fl) { QWidget *widget =3D new QWidget (this); setCentralWidget (widget); QTable *mytable =3D new QTable (9, 9,widget); for (int i =3D0; i < 8; i++) { mytable->setColumnWidth (i,150); mytable->setRowHeight (i, 150); for (int j =3D0; j < 8; j++) { MyScatterWidget *_widget =3D new MyScatterWidget (widget); mytable->setCellWidget(i,j, _widget); if (i!=3Dj) mytable->setCellWidget(j,i, _widget); } } mytable->setColumnWidth (8,150); mytable->setRowHeight (8, 150); for (int i=3D0; i < 8; i++) { MyHistWidget *_widget =3D new MyHistWidget (widget); mytable->setCellWidget (i,8,_widget); mytable->setCellWidget (8,i,_widget); } resize(QSize(739, 637).expandedTo(minimumSizeHint())); } int main( int argc, char ** argv ) { QApplication a( argc, argv ); =09 /*~~~~~~~~~~~~~~~~~~~~~*/ MainWindow *w =3D new MainWindow; /*~~~~~~~~~~~~~~~~~~~~~*/ a.setMainWidget(w); w->show(); /*~~~~~~~~~~~~~~~*/ int res =3D a.exec(); /*~~~~~~~~~~~~~~~*/ delete w; return res; } Uwe Rathmann wrote: > On Wednesday 25 February 2004 09:56, Sathya Krishnamurthy wrote: >=20 >=20 >>The reason as I scroll to the 9th Row, the last 4 Steps plots start >>violently flickering. In windows, if I drag the scrollbar back then the >>flickering stops, but If I drag again to the end it flickers again. Thi= s >>is completely reproducable. >=20 >=20 > Seems that there are recursive repaints. >=20 > First thing you can try is: QwtPlot::setAutoReplot(FALSE); >=20 > If this doesn=B4t help it is time to start the debugger: set a breakpoi= nt in ...=20 > perhaps QwtPlot::drawCanvas and look at the stack. >=20 > If you can=B4t figure out what is going on, try to isolate the problem = to a=20 > small demo (X11, if possible) and send me the code. >=20 > Uwe >=20 >=20 >=20 > ------------------------------------------------------- > SF.Net is sponsored by: Speed Start Your Linux Apps Now. > Build and deploy apps & Web services for Linux with > a free DVD software kit from IBM. Click Now! > http://ads.osdn.com/?ad_id=1356&alloc_id438&op=CCk > _______________________________________________ > qwt-interest mailing list > qwt...@li... > https://lists.sourceforge.net/lists/listinfo/qwt-interest --=20 ----------------------------------------- Ph Number: +41-1-389-9729 Mobile : +41-76-574-0069 TCAD For Manufacturing Group ISE Integrated Systems Engineering AG Zurich, Switzerland ----------------------------------------- Please Note: ISE Zurich will move to its new location from April 1,2004.=20 New phone number will be: Ph Number: +41-44-389-9729 Web: http://www.ise.com Email: sat...@is... |