qwt_painter.cpp
Go to the documentation of this file.
1 /******************************************************************************
2  * Qwt Widget Library
3  * Copyright (C) 1997 Josef Wilgen
4  * Copyright (C) 2002 Uwe Rathmann
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the Qwt License, Version 1.0
8  *****************************************************************************/
9 
10 #include "qwt_painter.h"
11 #include "qwt_math.h"
12 #include "qwt_clipper.h"
13 #include "qwt_color_map.h"
14 #include "qwt_scale_map.h"
15 
16 #include <qwidget.h>
17 #include <qframe.h>
18 #include <qrect.h>
19 #include <qpainter.h>
20 #include <qpalette.h>
21 #include <qpaintdevice.h>
22 #include <qpainterpath.h>
23 #include <qpixmap.h>
24 #include <qstyle.h>
25 #include <qtextdocument.h>
26 #include <qabstracttextdocumentlayout.h>
27 #include <qstyleoption.h>
28 #include <qpaintengine.h>
29 #include <qapplication.h>
30 
31 #if QT_VERSION >= 0x060000
32 #include <qscreen.h>
33 #else
34 #include <qdesktopwidget.h>
35 #endif
36 
37 #if QT_VERSION < 0x050000
38 
39 #ifdef Q_WS_X11
40 #include <qx11info_x11.h>
41 #endif
42 
43 #endif
44 
45 #include <cstring>
46 
49 
50 static inline bool qwtIsRasterPaintEngineBuggy()
51 {
52 #if 0
53  static int isBuggy = -1;
54  if ( isBuggy < 0 )
55  {
56  // auto detect bug of the raster paint engine,
57  // fixed with: https://codereview.qt-project.org/#/c/99456/
58 
59  QImage image( 2, 3, QImage::Format_ARGB32 );
60  image.fill( 0u );
61 
62  QPolygonF p;
63  p += QPointF(0, 1);
64  p += QPointF(0, 0);
65  p += QPointF(1, 0 );
66  p += QPointF(1, 2 );
67 
68  QPainter painter( &image );
69  painter.drawPolyline( p );
70  painter.end();
71 
72  isBuggy = ( image.pixel( 1, 1 ) == 0 ) ? 1 : 0;
73  }
74 
75  return isBuggy == 1;
76 #endif
77 
78 #if QT_VERSION < 0x050000
79  return true;
80 #elif QT_VERSION < 0x050100
81  return false;
82 #elif QT_VERSION < 0x050400
83  return true;
84 #else
85  return false;
86 #endif
87 }
88 
89 static inline bool qwtIsClippingNeeded(
90  const QPainter* painter, QRectF& clipRect )
91 {
92  bool doClipping = false;
93  const QPaintEngine* pe = painter->paintEngine();
94  if ( pe && pe->type() == QPaintEngine::SVG )
95  {
96  // The SVG paint engine ignores any clipping,
97 
98  if ( painter->hasClipping() )
99  {
100  doClipping = true;
101  clipRect = painter->clipRegion().boundingRect();
102  }
103  }
104 
105  return doClipping;
106 }
107 
108 template< class T >
109 static inline void qwtDrawPolyline( QPainter* painter,
110  const T* points, int pointCount, bool polylineSplitting )
111 {
112  bool doSplit = false;
113  if ( polylineSplitting && pointCount > 3 )
114  {
115  const QPaintEngine* pe = painter->paintEngine();
116  if ( pe && pe->type() == QPaintEngine::Raster )
117  {
118  if ( painter->pen().width() <= 1 )
119  {
120  // work around a bug with short lines below 2 pixels difference
121  // in height and width
122 
123  doSplit = qwtIsRasterPaintEngineBuggy();
124  }
125  else
126  {
127  /*
128  Raster paint engine is much faster when splitting
129  the polygon, but of course we might see some issues where
130  the pieces are joining
131  */
132  doSplit = true;
133  }
134  }
135  }
136 
137  if ( doSplit )
138  {
139  QPen pen = painter->pen();
140 
141  const int splitSize = 6;
142 
143  if ( pen.width() <= 1 && pen.isSolid() && qwtIsRasterPaintEngineBuggy()
144  && !( painter->renderHints() & QPainter::Antialiasing ) )
145  {
146  int k = 0;
147 
148  for ( int i = k + 1; i < pointCount; i++ )
149  {
150  const QPointF& p1 = points[i - 1];
151  const QPointF& p2 = points[i];
152 
153  const bool isBad = ( qAbs( p2.y() - p1.y() ) <= 1 )
154  && qAbs( p2.x() - p1.x() ) <= 1;
155 
156  if ( isBad || ( i - k >= splitSize ) )
157  {
158  painter->drawPolyline( points + k, i - k + 1 );
159  k = i;
160  }
161  }
162 
163  painter->drawPolyline( points + k, pointCount - k );
164  }
165  else
166  {
167  for ( int i = 0; i < pointCount; i += splitSize )
168  {
169  const int n = qMin( splitSize + 1, pointCount - i );
170  painter->drawPolyline( points + i, n );
171  }
172  }
173  }
174  else
175  {
176  painter->drawPolyline( points, pointCount );
177  }
178 }
179 
180 static inline QSize qwtScreenResolution()
181 {
182  static QSize screenResolution;
183  if ( !screenResolution.isValid() )
184  {
185  /*
186  We might have screens with different resolutions. TODO ...
187  */
188 #if QT_VERSION >= 0x060000
189  QScreen* screen = QGuiApplication::primaryScreen();
190  if ( screen )
191  {
192  screenResolution.setWidth( screen->logicalDotsPerInchX() );
193  screenResolution.setHeight( screen->logicalDotsPerInchY() );
194  }
195 #else
196  QDesktopWidget* desktop = QApplication::desktop();
197  if ( desktop )
198  {
199  screenResolution.setWidth( desktop->logicalDpiX() );
200  screenResolution.setHeight( desktop->logicalDpiY() );
201  }
202 #endif
203  }
204 
205  return screenResolution;
206 }
207 
208 static inline void qwtUnscaleFont( QPainter* painter )
209 {
210  if ( painter->font().pixelSize() >= 0 )
211  return;
212 
213  const QSize screenResolution = qwtScreenResolution();
214 
215  const QPaintDevice* pd = painter->device();
216  if ( pd->logicalDpiX() != screenResolution.width() ||
217  pd->logicalDpiY() != screenResolution.height() )
218  {
219  QFont pixelFont = QwtPainter::scaledFont( painter->font() );
220  pixelFont.setPixelSize( QFontInfo( pixelFont ).pixelSize() );
221 
222  painter->setFont( pixelFont );
223  }
224 }
225 
234 {
235  /*
236  The X11 paint engine has been removed with Qt 5.0, but
237  reintroduced with Qt 5.10. It can be enabled with
238  "export QT_XCB_NATIVE_PAINTING=1".
239  */
240 
241  static int onX11 = -1;
242  if ( onX11 < 0 )
243  {
244  QPixmap pm( 1, 1 );
245  QPainter painter( &pm );
246 
247  onX11 = ( painter.paintEngine()->type() == QPaintEngine::X11 ) ? 1 : 0;
248  }
249 
250  return onX11 == 1;
251 }
252 
267 bool QwtPainter::isAligning( const QPainter* painter )
268 {
269  if ( painter && painter->isActive() )
270  {
271  const QPaintEngine::Type type =
272  painter->paintEngine()->type();
273 
274  if ( type >= QPaintEngine::User )
275  {
276  // we have no idea - better don't align
277  return false;
278  }
279 
280  switch ( type )
281  {
282  case QPaintEngine::Pdf:
283  case QPaintEngine::SVG:
284 #if 0
285  case QPaintEngine::MacPrinter:
286 #endif
287  return false;
288 
289  default:
290  break;
291  }
292 
293  const QTransform& tr = painter->transform();
294  if ( tr.isRotating() || tr.isScaling() )
295  {
296  // we might have to check translations too
297  return false;
298  }
299  }
300 
301  return true;
302 }
303 
316 {
318 }
319 
336 {
338 }
339 
341 void QwtPainter::drawPath( QPainter* painter, const QPainterPath& path )
342 {
343  painter->drawPath( path );
344 }
345 
347 void QwtPainter::drawRect( QPainter* painter, qreal x, qreal y, qreal w, qreal h )
348 {
349  drawRect( painter, QRectF( x, y, w, h ) );
350 }
351 
353 void QwtPainter::drawRect( QPainter* painter, const QRectF& rect )
354 {
355  const QRectF r = rect;
356 
357  QRectF clipRect;
358  const bool deviceClipping = qwtIsClippingNeeded( painter, clipRect );
359 
360  if ( deviceClipping )
361  {
362  if ( !clipRect.intersects( r ) )
363  return;
364 
365  if ( !clipRect.contains( r ) )
366  {
367  fillRect( painter, r & clipRect, painter->brush() );
368 
369  painter->save();
370  painter->setBrush( Qt::NoBrush );
371  drawPolyline( painter, QPolygonF( r ) );
372  painter->restore();
373 
374  return;
375  }
376  }
377 
378  painter->drawRect( r );
379 }
380 
382 void QwtPainter::fillRect( QPainter* painter,
383  const QRectF& rect, const QBrush& brush )
384 {
385  if ( !rect.isValid() )
386  return;
387 
388  QRectF clipRect;
389  const bool deviceClipping = qwtIsClippingNeeded( painter, clipRect );
390 
391  /*
392  Performance of Qt4 is horrible for a non trivial brush. Without
393  clipping expect minutes or hours for repainting large rectangles
394  (might result from zooming)
395  */
396 
397  if ( deviceClipping )
398  clipRect &= painter->window();
399  else
400  clipRect = painter->window();
401 
402  if ( painter->hasClipping() )
403  clipRect &= painter->clipRegion().boundingRect();
404 
405  QRectF r = rect;
406  if ( deviceClipping )
407  r = r.intersected( clipRect );
408 
409  if ( r.isValid() )
410  painter->fillRect( r, brush );
411 }
412 
414 void QwtPainter::drawPie( QPainter* painter, const QRectF& rect,
415  int a, int alen )
416 {
417  QRectF clipRect;
418  const bool deviceClipping = qwtIsClippingNeeded( painter, clipRect );
419  if ( deviceClipping && !clipRect.contains( rect ) )
420  return;
421 
422  painter->drawPie( rect, a, alen );
423 }
424 
426 void QwtPainter::drawEllipse( QPainter* painter, const QRectF& rect )
427 {
428  QRectF clipRect;
429  const bool deviceClipping = qwtIsClippingNeeded( painter, clipRect );
430 
431  if ( deviceClipping && !clipRect.contains( rect ) )
432  return;
433 
434  painter->drawEllipse( rect );
435 }
436 
438 void QwtPainter::drawText( QPainter* painter,
439  qreal x, qreal y, const QString& text )
440 {
441  drawText( painter, QPointF( x, y ), text );
442 }
443 
445 void QwtPainter::drawText( QPainter* painter, const QPointF& pos,
446  const QString& text )
447 {
448  QRectF clipRect;
449  const bool deviceClipping = qwtIsClippingNeeded( painter, clipRect );
450 
451  if ( deviceClipping && !clipRect.contains( pos ) )
452  return;
453 
454 
455  painter->save();
456  qwtUnscaleFont( painter );
457  painter->drawText( pos, text );
458  painter->restore();
459 }
460 
462 void QwtPainter::drawText( QPainter* painter,
463  qreal x, qreal y, qreal w, qreal h,
464  int flags, const QString& text )
465 {
466  drawText( painter, QRectF( x, y, w, h ), flags, text );
467 }
468 
470 void QwtPainter::drawText( QPainter* painter, const QRectF& rect,
471  int flags, const QString& text )
472 {
473  painter->save();
474  qwtUnscaleFont( painter );
475  painter->drawText( rect, flags, text );
476  painter->restore();
477 }
478 
479 #ifndef QT_NO_RICHTEXT
480 
489 void QwtPainter::drawSimpleRichText( QPainter* painter, const QRectF& rect,
490  int flags, const QTextDocument& text )
491 {
492  QTextDocument* txt = text.clone();
493 
494  painter->save();
495 
496  QRectF unscaledRect = rect;
497 
498  if ( painter->font().pixelSize() < 0 )
499  {
500  const QSize res = qwtScreenResolution();
501 
502  const QPaintDevice* pd = painter->device();
503  if ( pd->logicalDpiX() != res.width() ||
504  pd->logicalDpiY() != res.height() )
505  {
506  QTransform transform;
507  transform.scale( res.width() / qreal( pd->logicalDpiX() ),
508  res.height() / qreal( pd->logicalDpiY() ) );
509 
510  painter->setWorldTransform( transform, true );
511  unscaledRect = transform.inverted().mapRect(rect);
512  }
513  }
514 
515  txt->setDefaultFont( painter->font() );
516  txt->setPageSize( QSizeF( unscaledRect.width(), QWIDGETSIZE_MAX ) );
517 
518  QAbstractTextDocumentLayout* layout = txt->documentLayout();
519 
520  const qreal height = layout->documentSize().height();
521  qreal y = unscaledRect.y();
522  if ( flags & Qt::AlignBottom )
523  y += ( unscaledRect.height() - height );
524  else if ( flags & Qt::AlignVCenter )
525  y += ( unscaledRect.height() - height ) / 2;
526 
527  QAbstractTextDocumentLayout::PaintContext context;
528  context.palette.setColor( QPalette::Text, painter->pen().color() );
529 
530  painter->translate( unscaledRect.x(), y );
531  layout->draw( painter, context );
532 
533  painter->restore();
534  delete txt;
535 }
536 
537 #endif // !QT_NO_RICHTEXT
538 
539 
541 void QwtPainter::drawLine( QPainter* painter,
542  const QPointF& p1, const QPointF& p2 )
543 {
544  QRectF clipRect;
545  const bool deviceClipping = qwtIsClippingNeeded( painter, clipRect );
546 
547  if ( deviceClipping &&
548  !( clipRect.contains( p1 ) && clipRect.contains( p2 ) ) )
549  {
550  QPolygonF polygon;
551  polygon += p1;
552  polygon += p2;
553  drawPolyline( painter, polygon );
554  return;
555  }
556 
557  painter->drawLine( p1, p2 );
558 }
559 
561 void QwtPainter::drawPolygon( QPainter* painter, const QPolygonF& polygon )
562 {
563  QRectF clipRect;
564  const bool deviceClipping = qwtIsClippingNeeded( painter, clipRect );
565 
566  if ( deviceClipping )
567  {
568  painter->drawPolygon(
569  QwtClipper::clippedPolygonF( clipRect, polygon, true ) );
570  }
571  else
572  {
573  painter->drawPolygon( polygon );
574  }
575 }
576 
578 void QwtPainter::drawPolyline( QPainter* painter, const QPolygonF& polygon )
579 {
580  QRectF clipRect;
581  const bool deviceClipping = qwtIsClippingNeeded( painter, clipRect );
582 
583  if ( deviceClipping )
584  {
585  const QPolygonF cpa = QwtClipper::clippedPolygonF( clipRect, polygon );
586 
587  qwtDrawPolyline< QPointF >( painter,
588  cpa.constData(), cpa.size(), m_polylineSplitting );
589  }
590  else
591  {
592  qwtDrawPolyline< QPointF >( painter,
593  polygon.constData(), polygon.size(), m_polylineSplitting );
594  }
595 }
596 
598 void QwtPainter::drawPolyline( QPainter* painter,
599  const QPointF* points, int pointCount )
600 {
601  QRectF clipRect;
602  const bool deviceClipping = qwtIsClippingNeeded( painter, clipRect );
603 
604  if ( deviceClipping )
605  {
606  QPolygonF polygon( pointCount );
607  std::memcpy( polygon.data(), points, pointCount * sizeof( QPointF ) );
608 
609  QwtClipper::clipPolygonF( clipRect, polygon );
610  qwtDrawPolyline< QPointF >( painter,
611  polygon.constData(), polygon.size(), m_polylineSplitting );
612  }
613  else
614  {
615  qwtDrawPolyline< QPointF >( painter, points, pointCount, m_polylineSplitting );
616  }
617 }
618 
620 void QwtPainter::drawPolygon( QPainter* painter, const QPolygon& polygon )
621 {
622  QRectF clipRect;
623  const bool deviceClipping = qwtIsClippingNeeded( painter, clipRect );
624 
625  if ( deviceClipping )
626  {
627  painter->drawPolygon(
628  QwtClipper::clippedPolygon( clipRect, polygon, true ) );
629  }
630  else
631  {
632  painter->drawPolygon( polygon );
633  }
634 }
635 
637 void QwtPainter::drawPolyline( QPainter* painter, const QPolygon& polygon )
638 {
639  QRectF clipRect;
640  const bool deviceClipping = qwtIsClippingNeeded( painter, clipRect );
641 
642  if ( deviceClipping )
643  {
644  const QPolygon cpa = QwtClipper::clippedPolygon( clipRect, polygon );
645 
646  qwtDrawPolyline< QPoint >( painter,
647  cpa.constData(), cpa.size(), m_polylineSplitting );
648  }
649  else
650  {
651  qwtDrawPolyline< QPoint >( painter,
652  polygon.constData(), polygon.size(), m_polylineSplitting );
653  }
654 }
655 
657 void QwtPainter::drawPolyline( QPainter* painter,
658  const QPoint* points, int pointCount )
659 {
660  QRectF clipRect;
661  const bool deviceClipping = qwtIsClippingNeeded( painter, clipRect );
662 
663  if ( deviceClipping )
664  {
665  QPolygon polygon( pointCount );
666  std::memcpy( polygon.data(), points, pointCount * sizeof( QPoint ) );
667 
668  QwtClipper::clipPolygon( clipRect, polygon );
669  qwtDrawPolyline< QPoint >( painter,
670  polygon.constData(), polygon.size(), m_polylineSplitting );
671  }
672  else
673  {
674  qwtDrawPolyline< QPoint >( painter, points, pointCount, m_polylineSplitting );
675  }
676 }
677 
679 void QwtPainter::drawPoint( QPainter* painter, const QPointF& pos )
680 {
681  QRectF clipRect;
682  const bool deviceClipping = qwtIsClippingNeeded( painter, clipRect );
683 
684  if ( deviceClipping && !clipRect.contains( pos ) )
685  return;
686 
687  painter->drawPoint( pos );
688 }
689 
691 void QwtPainter::drawPoint( QPainter* painter, const QPoint& pos )
692 {
693  QRectF clipRect;
694  const bool deviceClipping = qwtIsClippingNeeded( painter, clipRect );
695 
696  if ( deviceClipping )
697  {
698  const int minX = qwtCeil( clipRect.left() );
699  const int maxX = qwtFloor( clipRect.right() );
700  const int minY = qwtCeil( clipRect.top() );
701  const int maxY = qwtFloor( clipRect.bottom() );
702 
703  if ( pos.x() < minX || pos.x() > maxX
704  || pos.y() < minY || pos.y() > maxY )
705  {
706  return;
707  }
708  }
709 
710  painter->drawPoint( pos );
711 }
712 
714 void QwtPainter::drawPoints( QPainter* painter,
715  const QPoint* points, int pointCount )
716 {
717  QRectF clipRect;
718  const bool deviceClipping = qwtIsClippingNeeded( painter, clipRect );
719 
720  if ( deviceClipping )
721  {
722  const int minX = qwtCeil( clipRect.left() );
723  const int maxX = qwtFloor( clipRect.right() );
724  const int minY = qwtCeil( clipRect.top() );
725  const int maxY = qwtFloor( clipRect.bottom() );
726 
727  const QRect r( minX, minY, maxX - minX, maxY - minY );
728 
729  QPolygon clippedPolygon( pointCount );
730  QPoint* clippedData = clippedPolygon.data();
731 
732  int numClippedPoints = 0;
733  for ( int i = 0; i < pointCount; i++ )
734  {
735  if ( r.contains( points[i] ) )
736  clippedData[ numClippedPoints++ ] = points[i];
737  }
738  painter->drawPoints( clippedData, numClippedPoints );
739  }
740  else
741  {
742  painter->drawPoints( points, pointCount );
743  }
744 }
745 
747 void QwtPainter::drawPoints( QPainter* painter,
748  const QPointF* points, int pointCount )
749 {
750  QRectF clipRect;
751  const bool deviceClipping = qwtIsClippingNeeded( painter, clipRect );
752 
753  if ( deviceClipping )
754  {
755  QPolygonF clippedPolygon( pointCount );
756  QPointF* clippedData = clippedPolygon.data();
757 
758  int numClippedPoints = 0;
759  for ( int i = 0; i < pointCount; i++ )
760  {
761  if ( clipRect.contains( points[i] ) )
762  clippedData[ numClippedPoints++ ] = points[i];
763  }
764  painter->drawPoints( clippedData, numClippedPoints );
765  }
766  else
767  {
768  painter->drawPoints( points, pointCount );
769  }
770 }
771 
773 void QwtPainter::drawImage( QPainter* painter,
774  const QRectF& rect, const QImage& image )
775 {
776  const QRect alignedRect = rect.toAlignedRect();
777 
778  if ( alignedRect != rect )
779  {
780  const QRectF clipRect = rect.adjusted( 0.0, 0.0, -1.0, -1.0 );
781 
782  painter->save();
783  painter->setClipRect( clipRect, Qt::IntersectClip );
784  painter->drawImage( alignedRect, image );
785  painter->restore();
786  }
787  else
788  {
789  painter->drawImage( alignedRect, image );
790  }
791 }
792 
794 void QwtPainter::drawPixmap( QPainter* painter,
795  const QRectF& rect, const QPixmap& pixmap )
796 {
797  const QRect alignedRect = rect.toAlignedRect();
798 
799  if ( alignedRect != rect )
800  {
801  const QRectF clipRect = rect.adjusted( 0.0, 0.0, -1.0, -1.0 );
802 
803  painter->save();
804  painter->setClipRect( clipRect, Qt::IntersectClip );
805  painter->drawPixmap( alignedRect, pixmap );
806  painter->restore();
807  }
808  else
809  {
810  painter->drawPixmap( alignedRect, pixmap );
811  }
812 }
813 
815 void QwtPainter::drawFocusRect( QPainter* painter, const QWidget* widget )
816 {
817  drawFocusRect( painter, widget, widget->rect() );
818 }
819 
821 void QwtPainter::drawFocusRect( QPainter* painter, const QWidget* widget,
822  const QRect& rect )
823 {
824  QStyleOptionFocusRect opt;
825  opt.initFrom( widget );
826  opt.rect = rect;
827  opt.state |= QStyle::State_HasFocus;
828  opt.backgroundColor = widget->palette().color( widget->backgroundRole() );
829 
830  widget->style()->drawPrimitive(
831  QStyle::PE_FrameFocusRect, &opt, painter, widget );
832 }
833 
845 void QwtPainter::drawRoundFrame( QPainter* painter,
846  const QRectF& rect, const QPalette& palette,
847  int lineWidth, int frameStyle )
848 {
849  enum Style
850  {
851  Plain,
852  Sunken,
853  Raised
854  };
855 
856  Style style = Plain;
857  if ( (frameStyle& QFrame::Sunken) == QFrame::Sunken )
858  style = Sunken;
859  else if ( (frameStyle& QFrame::Raised) == QFrame::Raised )
860  style = Raised;
861 
862  const qreal lw2 = 0.5 * lineWidth;
863  QRectF r = rect.adjusted( lw2, lw2, -lw2, -lw2 );
864 
865  QBrush brush;
866 
867  if ( style != Plain )
868  {
869  QColor c1 = palette.color( QPalette::Light );
870  QColor c2 = palette.color( QPalette::Dark );
871 
872  if ( style == Sunken )
873  qSwap( c1, c2 );
874 
875  QLinearGradient gradient( r.topLeft(), r.bottomRight() );
876  gradient.setColorAt( 0.0, c1 );
877 #if 0
878  gradient.setColorAt( 0.3, c1 );
879  gradient.setColorAt( 0.7, c2 );
880 #endif
881  gradient.setColorAt( 1.0, c2 );
882 
883  brush = QBrush( gradient );
884  }
885  else // Plain
886  {
887  brush = palette.brush( QPalette::WindowText );
888  }
889 
890  painter->save();
891 
892  painter->setPen( QPen( brush, lineWidth ) );
893  painter->setBrush( Qt::NoBrush );
894 
895  painter->drawEllipse( r );
896 
897  painter->restore();
898 }
899 
911 void QwtPainter::drawFrame( QPainter* painter, const QRectF& rect,
912  const QPalette& palette, QPalette::ColorRole foregroundRole,
913  int frameWidth, int midLineWidth, int frameStyle )
914 {
915  if ( frameWidth <= 0 || rect.isEmpty() )
916  return;
917 
918  const int shadow = frameStyle & QFrame::Shadow_Mask;
919 
920  painter->save();
921 
922  if ( shadow == QFrame::Plain )
923  {
924  const QRectF outerRect = rect.adjusted( 0.0, 0.0, -1.0, -1.0 );
925  const QRectF innerRect = outerRect.adjusted(
926  frameWidth, frameWidth, -frameWidth, -frameWidth );
927 
928  QPainterPath path;
929  path.addRect( outerRect );
930  path.addRect( innerRect );
931 
932  painter->setPen( Qt::NoPen );
933  painter->setBrush( palette.color( foregroundRole ) );
934 
935  painter->drawPath( path );
936  }
937  else
938  {
939  const int shape = frameStyle & QFrame::Shape_Mask;
940 
941  if ( shape == QFrame::Box )
942  {
943  const QRectF outerRect = rect.adjusted( 0.0, 0.0, -1.0, -1.0 );
944  const QRectF midRect1 = outerRect.adjusted(
945  frameWidth, frameWidth, -frameWidth, -frameWidth );
946  const QRectF midRect2 = midRect1.adjusted(
947  midLineWidth, midLineWidth, -midLineWidth, -midLineWidth );
948 
949  const QRectF innerRect = midRect2.adjusted(
950  frameWidth, frameWidth, -frameWidth, -frameWidth );
951 
952  QPainterPath path1;
953  path1.moveTo( outerRect.bottomLeft() );
954  path1.lineTo( outerRect.topLeft() );
955  path1.lineTo( outerRect.topRight() );
956  path1.lineTo( midRect1.topRight() );
957  path1.lineTo( midRect1.topLeft() );
958  path1.lineTo( midRect1.bottomLeft() );
959 
960  QPainterPath path2;
961  path2.moveTo( outerRect.bottomLeft() );
962  path2.lineTo( outerRect.bottomRight() );
963  path2.lineTo( outerRect.topRight() );
964  path2.lineTo( midRect1.topRight() );
965  path2.lineTo( midRect1.bottomRight() );
966  path2.lineTo( midRect1.bottomLeft() );
967 
968  QPainterPath path3;
969  path3.moveTo( midRect2.bottomLeft() );
970  path3.lineTo( midRect2.topLeft() );
971  path3.lineTo( midRect2.topRight() );
972  path3.lineTo( innerRect.topRight() );
973  path3.lineTo( innerRect.topLeft() );
974  path3.lineTo( innerRect.bottomLeft() );
975 
976  QPainterPath path4;
977  path4.moveTo( midRect2.bottomLeft() );
978  path4.lineTo( midRect2.bottomRight() );
979  path4.lineTo( midRect2.topRight() );
980  path4.lineTo( innerRect.topRight() );
981  path4.lineTo( innerRect.bottomRight() );
982  path4.lineTo( innerRect.bottomLeft() );
983 
984  QPainterPath path5;
985  path5.addRect( midRect1 );
986  path5.addRect( midRect2 );
987 
988  painter->setPen( Qt::NoPen );
989 
990  QBrush brush1 = palette.dark().color();
991  QBrush brush2 = palette.light().color();
992 
993  if ( shadow == QFrame::Raised )
994  qSwap( brush1, brush2 );
995 
996  painter->setBrush( brush1 );
997  painter->drawPath( path1 );
998  painter->drawPath( path4 );
999 
1000  painter->setBrush( brush2 );
1001  painter->drawPath( path2 );
1002  painter->drawPath( path3 );
1003 
1004  painter->setBrush( palette.mid() );
1005  painter->drawPath( path5 );
1006  }
1007  else
1008  {
1009  const QRectF outerRect = rect.adjusted( 0.0, 0.0, -1.0, -1.0 );
1010  const QRectF innerRect = outerRect.adjusted(
1011  frameWidth - 1.0, frameWidth - 1.0,
1012  -( frameWidth - 1.0 ), -( frameWidth - 1.0 ) );
1013 
1014  QPainterPath path1;
1015  path1.moveTo( outerRect.bottomLeft() );
1016  path1.lineTo( outerRect.topLeft() );
1017  path1.lineTo( outerRect.topRight() );
1018  path1.lineTo( innerRect.topRight() );
1019  path1.lineTo( innerRect.topLeft() );
1020  path1.lineTo( innerRect.bottomLeft() );
1021 
1022 
1023  QPainterPath path2;
1024  path2.moveTo( outerRect.bottomLeft() );
1025  path2.lineTo( outerRect.bottomRight() );
1026  path2.lineTo( outerRect.topRight() );
1027  path2.lineTo( innerRect.topRight() );
1028  path2.lineTo( innerRect.bottomRight() );
1029  path2.lineTo( innerRect.bottomLeft() );
1030 
1031  painter->setPen( Qt::NoPen );
1032 
1033  QBrush brush1 = palette.dark().color();
1034  QBrush brush2 = palette.light().color();
1035 
1036  if ( shadow == QFrame::Raised )
1037  qSwap( brush1, brush2 );
1038 
1039  painter->setBrush( brush1 );
1040  painter->drawPath( path1 );
1041 
1042  painter->setBrush( brush2 );
1043  painter->drawPath( path2 );
1044  }
1045 
1046  }
1047 
1048  painter->restore();
1049 }
1050 
1065 void QwtPainter::drawRoundedFrame( QPainter* painter,
1066  const QRectF& rect, qreal xRadius, qreal yRadius,
1067  const QPalette& palette, int lineWidth, int frameStyle )
1068 {
1069  painter->save();
1070  painter->setRenderHint( QPainter::Antialiasing, true );
1071  painter->setBrush( Qt::NoBrush );
1072 
1073  qreal lw2 = lineWidth * 0.5;
1074  QRectF innerRect = rect.adjusted( lw2, lw2, -lw2, -lw2 );
1075 
1076  QPainterPath path;
1077  path.addRoundedRect( innerRect, xRadius, yRadius );
1078 
1079  enum Style
1080  {
1081  Plain,
1082  Sunken,
1083  Raised
1084  };
1085 
1086  Style style = Plain;
1087  if ( (frameStyle& QFrame::Sunken) == QFrame::Sunken )
1088  style = Sunken;
1089  else if ( (frameStyle& QFrame::Raised) == QFrame::Raised )
1090  style = Raised;
1091 
1092  if ( style != Plain && path.elementCount() == 17 )
1093  {
1094  // move + 4 * ( cubicTo + lineTo )
1095  QPainterPath pathList[8];
1096 
1097  for ( int i = 0; i < 4; i++ )
1098  {
1099  const int j = i * 4 + 1;
1100 
1101  pathList[ 2 * i ].moveTo(
1102  path.elementAt(j - 1).x, path.elementAt( j - 1 ).y
1103  );
1104 
1105  pathList[ 2 * i ].cubicTo(
1106  path.elementAt(j + 0).x, path.elementAt(j + 0).y,
1107  path.elementAt(j + 1).x, path.elementAt(j + 1).y,
1108  path.elementAt(j + 2).x, path.elementAt(j + 2).y );
1109 
1110  pathList[ 2 * i + 1 ].moveTo(
1111  path.elementAt(j + 2).x, path.elementAt(j + 2).y
1112  );
1113  pathList[ 2 * i + 1 ].lineTo(
1114  path.elementAt(j + 3).x, path.elementAt(j + 3).y
1115  );
1116  }
1117 
1118  QColor c1( palette.color( QPalette::Dark ) );
1119  QColor c2( palette.color( QPalette::Light ) );
1120 
1121  if ( style == Raised )
1122  qSwap( c1, c2 );
1123 
1124  for ( int i = 0; i < 4; i++ )
1125  {
1126  const QRectF r = pathList[2 * i].controlPointRect();
1127 
1128  QPen arcPen;
1129  arcPen.setCapStyle( Qt::FlatCap );
1130  arcPen.setWidth( lineWidth );
1131 
1132  QPen linePen;
1133  linePen.setCapStyle( Qt::FlatCap );
1134  linePen.setWidth( lineWidth );
1135 
1136  switch( i )
1137  {
1138  case 0:
1139  {
1140  arcPen.setColor( c1 );
1141  linePen.setColor( c1 );
1142  break;
1143  }
1144  case 1:
1145  {
1146  QLinearGradient gradient;
1147  gradient.setStart( r.topLeft() );
1148  gradient.setFinalStop( r.bottomRight() );
1149  gradient.setColorAt( 0.0, c1 );
1150  gradient.setColorAt( 1.0, c2 );
1151 
1152  arcPen.setBrush( gradient );
1153  linePen.setColor( c2 );
1154  break;
1155  }
1156  case 2:
1157  {
1158  arcPen.setColor( c2 );
1159  linePen.setColor( c2 );
1160  break;
1161  }
1162  case 3:
1163  {
1164  QLinearGradient gradient;
1165 
1166  gradient.setStart( r.bottomRight() );
1167  gradient.setFinalStop( r.topLeft() );
1168  gradient.setColorAt( 0.0, c2 );
1169  gradient.setColorAt( 1.0, c1 );
1170 
1171  arcPen.setBrush( gradient );
1172  linePen.setColor( c1 );
1173  break;
1174  }
1175  }
1176 
1177 
1178  painter->setPen( arcPen );
1179  painter->drawPath( pathList[ 2 * i] );
1180 
1181  painter->setPen( linePen );
1182  painter->drawPath( pathList[ 2 * i + 1] );
1183  }
1184  }
1185  else
1186  {
1187  QPen pen( palette.color( QPalette::WindowText ), lineWidth );
1188  painter->setPen( pen );
1189  painter->drawPath( path );
1190  }
1191 
1192  painter->restore();
1193 }
1194 
1205 void QwtPainter::drawColorBar( QPainter* painter,
1206  const QwtColorMap& colorMap, const QwtInterval& interval,
1207  const QwtScaleMap& scaleMap, Qt::Orientation orientation,
1208  const QRectF& rect )
1209 {
1210  QVector< QRgb > colorTable;
1211  if ( colorMap.format() == QwtColorMap::Indexed )
1212  colorTable = colorMap.colorTable256();
1213 
1214  QColor c;
1215 
1216  const QRect devRect = rect.toAlignedRect();
1217 
1218  /*
1219  We paint to a pixmap first to have something scalable for printing
1220  ( f.e. in a Pdf document )
1221  */
1222 
1223  QPixmap pixmap( devRect.size() );
1224  pixmap.fill( Qt::transparent );
1225 
1226  QPainter pmPainter( &pixmap );
1227  pmPainter.translate( -devRect.x(), -devRect.y() );
1228 
1229  if ( orientation == Qt::Horizontal )
1230  {
1231  QwtScaleMap sMap = scaleMap;
1232  sMap.setPaintInterval( rect.left(), rect.right() );
1233 
1234  for ( int x = devRect.left(); x <= devRect.right(); x++ )
1235  {
1236  const double value = sMap.invTransform( x );
1237 
1238  if ( colorMap.format() == QwtColorMap::RGB )
1239  c.setRgba( colorMap.rgb( interval, value ) );
1240  else
1241  c = colorTable[colorMap.colorIndex( 256, interval, value )];
1242 
1243  pmPainter.setPen( c );
1244  pmPainter.drawLine( x, devRect.top(), x, devRect.bottom() );
1245  }
1246  }
1247  else // Vertical
1248  {
1249  QwtScaleMap sMap = scaleMap;
1250  sMap.setPaintInterval( rect.bottom(), rect.top() );
1251 
1252  for ( int y = devRect.top(); y <= devRect.bottom(); y++ )
1253  {
1254  const double value = sMap.invTransform( y );
1255 
1256  if ( colorMap.format() == QwtColorMap::RGB )
1257  c.setRgba( colorMap.rgb( interval, value ) );
1258  else
1259  c = colorTable[colorMap.colorIndex( 256, interval, value )];
1260 
1261  pmPainter.setPen( c );
1262  pmPainter.drawLine( devRect.left(), y, devRect.right(), y );
1263  }
1264  }
1265  pmPainter.end();
1266 
1267  drawPixmap( painter, rect, pixmap );
1268 }
1269 
1270 static inline void qwtFillRect( const QWidget* widget, QPainter* painter,
1271  const QRect& rect, const QBrush& brush)
1272 {
1273  if ( brush.style() == Qt::TexturePattern )
1274  {
1275  painter->save();
1276 
1277  painter->setClipRect( rect );
1278  painter->drawTiledPixmap(rect, brush.texture(), rect.topLeft() );
1279 
1280  painter->restore();
1281  }
1282  else if ( brush.gradient() )
1283  {
1284  painter->save();
1285 
1286  painter->setClipRect( rect );
1287  painter->fillRect(0, 0, widget->width(),
1288  widget->height(), brush);
1289 
1290  painter->restore();
1291  }
1292  else
1293  {
1294  painter->fillRect(rect, brush);
1295  }
1296 }
1297 
1311 void QwtPainter::fillPixmap( const QWidget* widget,
1312  QPixmap& pixmap, const QPoint& offset )
1313 {
1314  const QRect rect( offset, pixmap.size() );
1315 
1316  QPainter painter( &pixmap );
1317  painter.translate( -offset );
1318 
1319  const QBrush autoFillBrush =
1320  widget->palette().brush( widget->backgroundRole() );
1321 
1322  if ( !( widget->autoFillBackground() && autoFillBrush.isOpaque() ) )
1323  {
1324  const QBrush bg = widget->palette().brush( QPalette::Window );
1325  qwtFillRect( widget, &painter, rect, bg);
1326  }
1327 
1328  if ( widget->autoFillBackground() )
1329  qwtFillRect( widget, &painter, rect, autoFillBrush);
1330 
1331  if ( widget->testAttribute(Qt::WA_StyledBackground) )
1332  {
1333  painter.setClipRegion( rect );
1334 
1335  QStyleOption opt;
1336  opt.initFrom( widget );
1337  widget->style()->drawPrimitive( QStyle::PE_Widget,
1338  &opt, &painter, widget );
1339  }
1340 }
1341 
1351 void QwtPainter::drawBackgound( QPainter* painter,
1352  const QRectF& rect, const QWidget* widget )
1353 {
1354  if ( widget->testAttribute( Qt::WA_StyledBackground ) )
1355  {
1356  QStyleOption opt;
1357  opt.initFrom( widget );
1358  opt.rect = rect.toAlignedRect();
1359 
1360  widget->style()->drawPrimitive(
1361  QStyle::PE_Widget, &opt, painter, widget);
1362  }
1363  else
1364  {
1365  const QBrush brush =
1366  widget->palette().brush( widget->backgroundRole() );
1367 
1368  painter->fillRect( rect, brush );
1369  }
1370 }
1371 
1380  const QFontMetrics& fontMetrics, const QString& text )
1381 {
1382 #if QT_VERSION >= 0x050b00
1383  return fontMetrics.horizontalAdvance( text );
1384 #else
1385  return fontMetrics.width( text );
1386 #endif
1387 
1388 }
1389 
1398  const QFontMetricsF& fontMetrics, const QString& text )
1399 {
1400 #if QT_VERSION >= 0x050b00
1401  return fontMetrics.horizontalAdvance( text );
1402 #else
1403  return fontMetrics.width( text );
1404 #endif
1405 }
1406 
1415  const QFontMetrics& fontMetrics, QChar ch )
1416 {
1417 #if QT_VERSION >= 0x050b00
1418  return fontMetrics.horizontalAdvance( ch );
1419 #else
1420  return fontMetrics.width( ch );
1421 #endif
1422 }
1423 
1432  const QFontMetricsF& fontMetrics, QChar ch )
1433 {
1434 #if QT_VERSION >= 0x050b00
1435  return fontMetrics.horizontalAdvance( ch );
1436 #else
1437  return fontMetrics.width( ch );
1438 #endif
1439 }
1440 
1450 QFont QwtPainter::scaledFont( const QFont& font, const QPaintDevice* paintDevice )
1451 {
1452  if ( paintDevice == nullptr )
1453  {
1454 #if QT_VERSION < 0x060000
1455  paintDevice = QApplication::desktop();
1456 #else
1457  class PaintDevice : public QPaintDevice
1458  {
1459  virtual QPaintEngine* paintEngine() const QWT_OVERRIDE
1460  {
1461  return nullptr;
1462  }
1463 
1464  virtual int metric( PaintDeviceMetric metric ) const QWT_OVERRIDE
1465  {
1466  if ( metric == PdmDpiY )
1467  {
1468  QScreen* screen = QGuiApplication::primaryScreen();
1469  if ( screen )
1470  {
1471  return screen->logicalDotsPerInchY();
1472  }
1473  }
1474 
1475  return QPaintDevice::metric( metric );
1476  }
1477  };
1478 
1479  static PaintDevice dummyPaintDevice;
1480  paintDevice = &dummyPaintDevice;
1481 #endif
1482  }
1483 
1484  return QFont( font, const_cast< QPaintDevice* >( paintDevice ) );
1485 }
1486 
1491 qreal QwtPainter::devicePixelRatio( const QPaintDevice* paintDevice )
1492 {
1493  qreal pixelRatio = 0.0;
1494 
1495 #if QT_VERSION >= 0x050100
1496  if ( paintDevice )
1497  {
1498 #if QT_VERSION >= 0x050600
1499  pixelRatio = paintDevice->devicePixelRatioF();
1500 #else
1501  pixelRatio = paintDevice->devicePixelRatio();
1502 #endif
1503  }
1504 #else
1505  Q_UNUSED( paintDevice )
1506 #endif
1507 
1508 #if QT_VERSION >= 0x050000
1509  if ( pixelRatio == 0.0 && qApp )
1510  pixelRatio = qApp->devicePixelRatio();
1511 #endif
1512 
1513  if ( pixelRatio == 0.0 )
1514  pixelRatio = 1.0;
1515 
1516  return pixelRatio;
1517 }
1518 
1525 QPixmap QwtPainter::backingStore( QWidget* widget, const QSize& size )
1526 {
1527  QPixmap pm;
1528 
1529 #if QT_VERSION >= 0x050000
1530  const qreal pixelRatio = QwtPainter::devicePixelRatio( widget );
1531 
1532  pm = QPixmap( size * pixelRatio );
1533  pm.setDevicePixelRatio( pixelRatio );
1534 #else
1535  pm = QPixmap( size );
1536 #endif
1537 
1538 #ifdef Q_WS_X11
1539  if ( widget && isX11GraphicsSystem() )
1540  {
1541  if ( pm.x11Info().screen() != widget->x11Info().screen() )
1542  pm.x11SetScreen( widget->x11Info().screen() );
1543  }
1544 #else
1545  Q_UNUSED( widget )
1546 #endif
1547 
1548  return pm;
1549 }
QwtPainter::drawBackgound
static void drawBackgound(QPainter *, const QRectF &, const QWidget *)
Definition: qwt_painter.cpp:1351
qwtIsRasterPaintEngineBuggy
static bool qwtIsRasterPaintEngineBuggy()
Definition: qwt_painter.cpp:50
QwtPainter::drawRect
static void drawRect(QPainter *, qreal x, qreal y, qreal w, qreal h)
Wrapper for QPainter::drawRect()
Definition: qwt_painter.cpp:347
QwtPainter::drawFrame
static void drawFrame(QPainter *, const QRectF &rect, const QPalette &palette, QPalette::ColorRole foregroundRole, int lineWidth, int midLineWidth, int frameStyle)
Definition: qwt_painter.cpp:911
QwtScaleMap::invTransform
double invTransform(double p) const
Definition: qwt_scale_map.h:154
QwtPainter::drawText
static void drawText(QPainter *, qreal x, qreal y, const QString &)
Wrapper for QPainter::drawText()
Definition: qwt_painter.cpp:438
qwtFillRect
static void qwtFillRect(const QWidget *widget, QPainter *painter, const QRect &rect, const QBrush &brush)
Definition: qwt_painter.cpp:1270
backward::ColorMode::type
type
Definition: backward.hpp:3600
qwtUnscaleFont
static void qwtUnscaleFont(QPainter *painter)
Definition: qwt_painter.cpp:208
QwtPainter::drawPolyline
static void drawPolyline(QPainter *, const QPolygonF &)
Wrapper for QPainter::drawPolyline()
Definition: qwt_painter.cpp:578
bg
FMT_CONSTEXPR auto bg(detail::color_type background) noexcept -> text_style
Definition: color.h:320
QwtPainter::horizontalAdvance
static int horizontalAdvance(const QFontMetrics &, const QString &)
Definition: qwt_painter.cpp:1379
qwtIsClippingNeeded
static bool qwtIsClippingNeeded(const QPainter *painter, QRectF &clipRect)
Definition: qwt_painter.cpp:89
QwtColorMap::colorTable256
virtual QVector< QRgb > colorTable256() const
Definition: qwt_color_map.cpp:304
QVector< QRgb >
QwtColorMap::Indexed
@ Indexed
Definition: qwt_color_map.h:60
mqtt_test_proto.x
x
Definition: mqtt_test_proto.py:34
QwtPainter::drawPie
static void drawPie(QPainter *, const QRectF &r, int a, int alen)
Wrapper for QPainter::drawPie()
Definition: qwt_painter.cpp:414
qwt_math.h
QwtPainter::scaledFont
static QFont scaledFont(const QFont &, const QPaintDevice *=nullptr)
Definition: qwt_painter.cpp:1450
mqtt_test_proto.y
y
Definition: mqtt_test_proto.py:35
QwtColorMap::colorIndex
virtual uint colorIndex(int numColors, const QwtInterval &interval, double value) const
Map a value of a given interval into a color index.
Definition: qwt_color_map.cpp:278
QwtColorMap::RGB
@ RGB
The map is intended to map into RGB values.
Definition: qwt_color_map.h:48
QwtPainter::fillPixmap
static void fillPixmap(const QWidget *, QPixmap &, const QPoint &offset=QPoint())
Definition: qwt_painter.cpp:1311
QwtPainter::drawPoint
static void drawPoint(QPainter *, const QPoint &)
Wrapper for QPainter::drawPoint()
Definition: qwt_painter.cpp:691
nonstd::span_lite::size
span_constexpr std::size_t size(span< T, Extent > const &spn)
Definition: span.hpp:1554
qwt_clipper.h
QwtInterval
A class representing an interval.
Definition: qwt_interval.h:22
QwtPainter::fillRect
static void fillRect(QPainter *, const QRectF &, const QBrush &)
Wrapper for QPainter::fillRect()
Definition: qwt_painter.cpp:382
qwt_scale_map.h
qwtScreenResolution
static QSize qwtScreenResolution()
Definition: qwt_painter.cpp:180
QwtTriangle::Type
Type
Definition: qwt_symbol.cpp:32
QwtPainter::backingStore
static QPixmap backingStore(QWidget *, const QSize &)
Definition: qwt_painter.cpp:1525
QwtScaleMap::setPaintInterval
void setPaintInterval(double p1, double p2)
Specify the borders of the paint device interval.
Definition: qwt_scale_map.cpp:119
QwtPainter::drawLine
static void drawLine(QPainter *, qreal x1, qreal y1, qreal x2, qreal y2)
Wrapper for QPainter::drawLine()
Definition: qwt_painter.h:154
qwt_color_map.h
qwtDrawPolyline
static void qwtDrawPolyline(QPainter *painter, const T *points, int pointCount, bool polylineSplitting)
Definition: qwt_painter.cpp:109
QwtClipper::clipPolygonF
QWT_EXPORT void clipPolygonF(const QRectF &, QPolygonF &, bool closePolygon=false)
Definition: qwt_clipper.cpp:404
sol::meta::enable
std::enable_if_t< all< Args... >::value, enable_t > enable
Definition: sol.hpp:2244
QwtPainter::drawSimpleRichText
static void drawSimpleRichText(QPainter *, const QRectF &, int flags, const QTextDocument &)
Definition: qwt_painter.cpp:489
QwtPainter::drawPath
static void drawPath(QPainter *, const QPainterPath &)
Wrapper for QPainter::drawPath()
Definition: qwt_painter.cpp:341
QwtColorMap::format
Format format() const
Definition: qwt_color_map.h:257
QwtPainter::isX11GraphicsSystem
static bool isX11GraphicsSystem()
Definition: qwt_painter.cpp:233
QwtScaleMap
A scale map.
Definition: qwt_scale_map.h:26
QwtPainter::drawImage
static void drawImage(QPainter *, const QRectF &, const QImage &)
Wrapper for QPainter::drawImage()
Definition: qwt_painter.cpp:773
QwtPainter::setRoundingAlignment
static void setRoundingAlignment(bool)
Definition: qwt_painter.cpp:315
QwtPainter::drawRoundFrame
static void drawRoundFrame(QPainter *, const QRectF &, const QPalette &, int lineWidth, int frameStyle)
Definition: qwt_painter.cpp:845
QwtClipper::clipPolygon
QWT_EXPORT void clipPolygon(const QRect &, QPolygon &, bool closePolygon=false)
Definition: qwt_clipper.cpp:390
QwtPainter::m_roundingAlignment
static bool m_roundingAlignment
Definition: qwt_painter.h:132
qwt_painter.h
QwtColorMap::rgb
virtual QRgb rgb(const QwtInterval &interval, double value) const =0
QwtPainter::isAligning
static bool isAligning(const QPainter *)
Definition: qwt_painter.cpp:267
QwtPainter::drawFocusRect
static void drawFocusRect(QPainter *, const QWidget *)
Draw a focus rectangle on a widget using its style.
Definition: qwt_painter.cpp:815
QwtClipper::clippedPolygonF
QWT_EXPORT QPolygonF clippedPolygonF(const QRectF &, const QPolygonF &, bool closePolygon=false)
Definition: qwt_clipper.cpp:455
QwtPainter::m_polylineSplitting
static bool m_polylineSplitting
Definition: qwt_painter.h:131
qwtFloor
int qwtFloor(qreal value)
Definition: qwt_math.h:275
QwtPainter::drawPoints
static void drawPoints(QPainter *, const QPolygon &)
Wrapper for QPainter::drawPoints()
Definition: qwt_painter.h:142
QWT_OVERRIDE
#define QWT_OVERRIDE
Definition: qwt_global.h:53
qwtCeil
int qwtCeil(qreal value)
Definition: qwt_math.h:266
QwtPainter::drawPolygon
static void drawPolygon(QPainter *, const QPolygonF &)
Wrapper for QPainter::drawPolygon()
Definition: qwt_painter.cpp:561
QwtPainter::drawPixmap
static void drawPixmap(QPainter *, const QRectF &, const QPixmap &)
Wrapper for QPainter::drawPixmap()
Definition: qwt_painter.cpp:794
QwtColorMap
QwtColorMap is used to map values into colors.
Definition: qwt_color_map.h:37
QwtPainter::drawColorBar
static void drawColorBar(QPainter *, const QwtColorMap &, const QwtInterval &, const QwtScaleMap &, Qt::Orientation, const QRectF &)
Definition: qwt_painter.cpp:1205
QwtPainter::devicePixelRatio
static qreal devicePixelRatio(const QPaintDevice *)
Definition: qwt_painter.cpp:1491
QwtPainter::drawRoundedFrame
static void drawRoundedFrame(QPainter *, const QRectF &, qreal xRadius, qreal yRadius, const QPalette &, int lineWidth, int frameStyle)
Definition: qwt_painter.cpp:1065
QwtPainter::setPolylineSplitting
static void setPolylineSplitting(bool)
En/Disable line splitting for the raster paint engine.
Definition: qwt_painter.cpp:335
QwtClipper::clippedPolygon
QWT_EXPORT QPolygon clippedPolygon(const QRect &, const QPolygon &, bool closePolygon=false)
Definition: qwt_clipper.cpp:437
QwtPainter::drawEllipse
static void drawEllipse(QPainter *, const QRectF &)
Wrapper for QPainter::drawEllipse()
Definition: qwt_painter.cpp:426


plotjuggler
Author(s): Davide Faconti
autogenerated on Sun Aug 11 2024 02:24:24