summaryrefslogtreecommitdiffstats
path: root/tqtinterface/qt4/src
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2011-08-13 21:42:41 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2011-08-13 21:42:41 -0500
commit88b0885ab8a6f30966f13e741a33d5416a15e763 (patch)
tree9ae790871f4dcbeae437f541c2971cfed6f1c807 /tqtinterface/qt4/src
parent12897770f4bd92f5865d42c8e107a32fd315a1ca (diff)
downloadexperimental-88b0885ab8a6f30966f13e741a33d5416a15e763.tar.gz
experimental-88b0885ab8a6f30966f13e741a33d5416a15e763.zip
Add missing TQPainter::tqdrawPolyline(...) method
Diffstat (limited to 'tqtinterface/qt4/src')
-rw-r--r--tqtinterface/qt4/src/kernel/tqpainter.h1
-rw-r--r--tqtinterface/qt4/src/kernel/tqpainter_x11.cpp66
2 files changed, 65 insertions, 2 deletions
diff --git a/tqtinterface/qt4/src/kernel/tqpainter.h b/tqtinterface/qt4/src/kernel/tqpainter.h
index c1a5092..b3cd896 100644
--- a/tqtinterface/qt4/src/kernel/tqpainter.h
+++ b/tqtinterface/qt4/src/kernel/tqpainter.h
@@ -302,6 +302,7 @@ public:
inline void tqdrawPolyline(const QPolygon &pa, int index, int npoints = -1) { drawPolyline(pa.constData() + index, npoints == -1 ? pa.size() - index : npoints); }
inline void tqdrawPolygon(const QPolygon &pa, bool winding, int index = 0, int npoints = -1) { drawPolygon(pa.constData() + index, npoints == -1 ? pa.size() - index : npoints, winding ? Qt::WindingFill : Qt::OddEvenFill); }
inline void tqdrawPolygon(const QPolygonF &polygon, bool winding, int index = 0, int npoints = -1) { drawPolygon(polygon.constData() + index, npoints == -1 ? polygon.size() - index : npoints, winding ? Qt::WindingFill : Qt::OddEvenFill); }
+ void tqdrawPolyline( const TQPointArray &, int index=0, int npoints=-1 );
inline void tqdrawConvexPolygon(const QPolygonF &polygon, int index, int npoints = -1) { drawConvexPolygon(polygon.constData() + index, npoints == -1 ? polygon.size() - index : npoints); }
inline void tqdrawConvexPolygon(const QPolygon &pa, int index, int npoints = -1) { drawConvexPolygon(pa.constData() + index, npoints == -1 ? pa.size() - index : npoints); }
// static inline void redirect(QPaintDevice *pdev, QPaintDevice *replacement) { setRedirected(pdev, replacement); }
diff --git a/tqtinterface/qt4/src/kernel/tqpainter_x11.cpp b/tqtinterface/qt4/src/kernel/tqpainter_x11.cpp
index 7e68625..f5ad348 100644
--- a/tqtinterface/qt4/src/kernel/tqpainter_x11.cpp
+++ b/tqtinterface/qt4/src/kernel/tqpainter_x11.cpp
@@ -242,12 +242,74 @@ void TQPainter::drawWinFocusRect( int x, int y, int w, int h, bool xorPaint, con
printf("[WARNING] TQPainter::drawWinFocusRect may not draw the correct rectangle in all cases [due to shift from Xorg to Qt painting]\n\r");
// drawRect( x, y, w-1, h-1 );
- drawRect( x, y, w, h );
+ drawRect( x, y, w, h );
setRasterOp( old_rop );
setPen( old_pen );
}
+/*!
+ Draws the polyline defined by the \a npoints points in \a a
+ starting at \a a[index]. (\a index defaults to 0.)
+
+ If \a npoints is -1 (the default) all points until the end of the
+ array are used (i.e. a.size()-index-1 line segments are drawn).
+
+ \warning On X11, coordinates that do not fit into 16-bit signed
+ values are truncated. This limitation is expected to go away in
+ TQt 4.
+
+ \sa drawLineSegments(), drawPolygon(), TQPen
+*/
+
+void TQPainter::tqdrawPolyline( const TQPointArray &a, int index, int npoints )
+{
+ if ( npoints < 0 )
+ npoints = a.size() - index;
+ if ( index + npoints > (int)a.size() )
+ npoints = a.size() - index;
+ if ( !isActive() || npoints < 2 || index < 0 )
+ return;
+ TQPointArray pa = a;
+ if ( testf(ExtDev|VxF|WxF) ) {
+ if ( testf(ExtDev) ) {
+// if ( npoints != (int)pa.size() ) {
+// pa = TQPointArray( npoints );
+// for ( int i=0; i<npoints; i++ )
+// pa.setPoint( i, a.point(index+i) );
+// index = 0;
+// }
+// TQPDevCmdParam param[1];
+// param[0].ptarr = (TQPointArray*)&pa;
+// if ( !pdev->cmd(TQPaintDevice::PdcDrawPolyline, this, param) || !hd )
+// return;
+ printf("[FIXME] TQPainter::drawPolyline not yet supported on external paint devices\n\r");
+ }
+#if 0
+ if ( txop != TxNone ) {
+ pa = xForm( pa, index, npoints );
+ if ( pa.size() != a.size() ) {
+ index = 0;
+ npoints = pa.size();
+ }
+ }
+ }
+ if ( cpen.style() != Qt::NoPen ) {
+ while(npoints>65535) {
+ XDrawLines( dpy, hd, gc, (XPoint*)(pa.shortPoints( index, 65535 )),
+ 65535, CoordModeOrigin );
+ npoints-=65535;
+ index+=65535;
+ }
+ XDrawLines( dpy, hd, gc, (XPoint*)(pa.shortPoints( index, npoints )),
+ npoints, CoordModeOrigin );
+ }
+#else
+ }
+ printf("[WARNING] TQPainter::tqdrawPolyline UNIMPLEMENTED\n\r");
+#endif
+}
+
#else // USE_QT4
// paintevent magic to provide Windows semantics on X11
@@ -3345,4 +3407,4 @@ TQPoint TQPainter::pos() const
return curPt;
}
-#endif // USE_QT4 \ No newline at end of file
+#endif // USE_QT4