Qwt User's Guide 6.3.0

Loading...
Searching...
No Matches
qwt_scale_widget.cpp
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_scale_widget.h"
11#include "qwt_painter.h"
12#include "qwt_color_map.h"
13#include "qwt_scale_map.h"
14#include "qwt_math.h"
15#include "qwt_scale_div.h"
16#include "qwt_text.h"
17#include "qwt_interval.h"
18#include "qwt_scale_engine.h"
19
20#include <qpainter.h>
21#include <qevent.h>
22#include <qstyle.h>
23#include <qstyleoption.h>
24#include <qapplication.h>
25#include <qmargins.h>
26
27 class QwtScaleWidget::PrivateData
28{
29 public:
30 PrivateData()
31 : scaleDraw( NULL )
32 {
33 colorBar.colorMap = NULL;
34 }
35
36 ~PrivateData()
37 {
38 delete scaleDraw;
39 delete colorBar.colorMap;
40 }
41
42 QwtScaleDraw* scaleDraw;
43
44 int borderDist[2];
45 int minBorderDist[2];
46 int scaleLength;
47 int margin;
48
49 int titleOffset;
50 int spacing;
51 QwtText title;
52
53 QwtScaleWidget::LayoutFlags layoutFlags;
54
55 struct t_colorBar
56 {
57 bool isEnabled;
58 int width;
59 QwtInterval interval;
60 QwtColorMap* colorMap;
61 } colorBar;
62};
63
68 QwtScaleWidget::QwtScaleWidget( QWidget* parent )
69 : QWidget( parent )
70{
71 initScale( QwtScaleDraw::LeftScale );
72}
73
79 QwtScaleWidget::QwtScaleWidget( QwtScaleDraw::Alignment align, QWidget* parent )
80 : QWidget( parent )
81{
82 initScale( align );
83}
84
86 QwtScaleWidget::~QwtScaleWidget()
87{
88 delete m_data;
89}
90
92 void QwtScaleWidget::initScale( QwtScaleDraw::Alignment align )
93{
94 m_data = new PrivateData;
95
96 if ( align == QwtScaleDraw::RightScale )
97 m_data->layoutFlags |= TitleInverted;
98
99 m_data->borderDist[0] = 0;
100 m_data->borderDist[1] = 0;
101 m_data->minBorderDist[0] = 0;
102 m_data->minBorderDist[1] = 0;
103 m_data->margin = 4;
104 m_data->titleOffset = 0;
105 m_data->spacing = 2;
106
107 m_data->scaleDraw = new QwtScaleDraw;
108 m_data->scaleDraw->setAlignment( align );
109 m_data->scaleDraw->setLength( 10 );
110
111 m_data->scaleDraw->setScaleDiv(
112 QwtLinearScaleEngine().divideScale( 0.0, 100.0, 10, 5 ) );
113
114 m_data->colorBar.colorMap = new QwtLinearColorMap();
115 m_data->colorBar.isEnabled = false;
116 m_data->colorBar.width = 10;
117
118 const int flags = Qt::AlignHCenter
119 | Qt::TextExpandTabs | Qt::TextWordWrap;
120 m_data->title.setRenderFlags( flags );
121 m_data->title.setFont( font() );
122
123 QSizePolicy policy( QSizePolicy::MinimumExpanding,
124 QSizePolicy::Fixed );
125 if ( m_data->scaleDraw->orientation() == Qt::Vertical )
126 policy.transpose();
127
128 setSizePolicy( policy );
129
130 setAttribute( Qt::WA_WState_OwnSizePolicy, false );
131}
132
141 void QwtScaleWidget::setLayoutFlag( LayoutFlag flag, bool on )
142{
143 if ( ( ( m_data->layoutFlags & flag ) != 0 ) != on )
144 {
145 if ( on )
146 m_data->layoutFlags |= flag;
147 else
148 m_data->layoutFlags &= ~flag;
149
150 update();
151 }
152}
153
161 bool QwtScaleWidget::testLayoutFlag( LayoutFlag flag ) const
162{
163 return ( m_data->layoutFlags & flag );
164}
165
172 void QwtScaleWidget::setTitle( const QString& title )
173{
174 if ( m_data->title.text() != title )
175 {
176 m_data->title.setText( title );
177 layoutScale();
178 }
179}
180
190 void QwtScaleWidget::setTitle( const QwtText& title )
191{
192 QwtText t = title;
193 const int flags = title.renderFlags() & ~( Qt::AlignTop | Qt::AlignBottom );
194 t.setRenderFlags( flags );
195
196 if ( t != m_data->title )
197 {
198 m_data->title = t;
199 layoutScale();
200 }
201}
202
209 void QwtScaleWidget::setAlignment( QwtScaleDraw::Alignment alignment )
210{
211 if ( m_data->scaleDraw == NULL )
212 return;
213
214 m_data->scaleDraw->setAlignment( alignment );
215
216 if ( !testAttribute( Qt::WA_WState_OwnSizePolicy ) )
217 {
218 QSizePolicy policy( QSizePolicy::MinimumExpanding, QSizePolicy::Fixed );
219 if ( m_data->scaleDraw->orientation() == Qt::Vertical )
220 policy.transpose();
221
222 setSizePolicy( policy );
223
224 setAttribute( Qt::WA_WState_OwnSizePolicy, false );
225 }
226
227 layoutScale();
228}
229
230
235 QwtScaleDraw::Alignment QwtScaleWidget::alignment() const
236{
237 if ( !scaleDraw() )
238 return QwtScaleDraw::LeftScale;
239
240 return scaleDraw()->alignment();
241}
242
251 void QwtScaleWidget::setBorderDist( int dist1, int dist2 )
252{
253 if ( dist1 != m_data->borderDist[0] || dist2 != m_data->borderDist[1] )
254 {
255 m_data->borderDist[0] = dist1;
256 m_data->borderDist[1] = dist2;
257 layoutScale();
258 }
259}
260
266 void QwtScaleWidget::setMargin( int margin )
267{
268 margin = qMax( 0, margin );
269 if ( margin != m_data->margin )
270 {
271 m_data->margin = margin;
272 layoutScale();
273 }
274}
275
281 void QwtScaleWidget::setSpacing( int spacing )
282{
283 spacing = qMax( 0, spacing );
284 if ( spacing != m_data->spacing )
285 {
286 m_data->spacing = spacing;
287 layoutScale();
288 }
289}
290
296 void QwtScaleWidget::setLabelAlignment( Qt::Alignment alignment )
297{
298 m_data->scaleDraw->setLabelAlignment( alignment );
299 layoutScale();
300}
301
309 void QwtScaleWidget::setLabelRotation( double rotation )
310{
311 m_data->scaleDraw->setLabelRotation( rotation );
312 layoutScale();
313}
314
326 void QwtScaleWidget::setScaleDraw( QwtScaleDraw* scaleDraw )
327{
328 if ( ( scaleDraw == NULL ) || ( scaleDraw == m_data->scaleDraw ) )
329 return;
330
331 const QwtScaleDraw* sd = m_data->scaleDraw;
332 if ( sd )
333 {
334 scaleDraw->setAlignment( sd->alignment() );
335 scaleDraw->setScaleDiv( sd->scaleDiv() );
336
337 QwtTransform* transform = NULL;
338 if ( sd->scaleMap().transformation() )
339 transform = sd->scaleMap().transformation()->copy();
340
341 scaleDraw->setTransformation( transform );
342 }
343
344 delete m_data->scaleDraw;
345 m_data->scaleDraw = scaleDraw;
346
347 layoutScale();
348}
349
354 const QwtScaleDraw* QwtScaleWidget::scaleDraw() const
355{
356 return m_data->scaleDraw;
357}
358
363 QwtScaleDraw* QwtScaleWidget::scaleDraw()
364{
365 return m_data->scaleDraw;
366}
367
372 QwtText QwtScaleWidget::title() const
373{
374 return m_data->title;
375}
376
381 int QwtScaleWidget::startBorderDist() const
382{
383 return m_data->borderDist[0];
384}
385
390 int QwtScaleWidget::endBorderDist() const
391{
392 return m_data->borderDist[1];
393}
394
399 int QwtScaleWidget::margin() const
400{
401 return m_data->margin;
402}
403
408 int QwtScaleWidget::spacing() const
409{
410 return m_data->spacing;
411}
412
416 void QwtScaleWidget::paintEvent( QPaintEvent* event )
417{
418 QPainter painter( this );
419 painter.setClipRegion( event->region() );
420
421 QStyleOption opt;
422 opt.initFrom(this);
423 style()->drawPrimitive(QStyle::PE_Widget, &opt, &painter, this);
424
425 draw( &painter );
426}
427
431 void QwtScaleWidget::draw( QPainter* painter ) const
432{
433 m_data->scaleDraw->draw( painter, palette() );
434
435 if ( m_data->colorBar.isEnabled && m_data->colorBar.width > 0 &&
436 m_data->colorBar.interval.isValid() )
437 {
438 drawColorBar( painter, colorBarRect( contentsRect() ) );
439 }
440
441 QRect r = contentsRect();
442 if ( m_data->scaleDraw->orientation() == Qt::Horizontal )
443 {
444 r.setLeft( r.left() + m_data->borderDist[0] );
445 r.setWidth( r.width() - m_data->borderDist[1] );
446 }
447 else
448 {
449 r.setTop( r.top() + m_data->borderDist[0] );
450 r.setHeight( r.height() - m_data->borderDist[1] );
451 }
452
453 if ( !m_data->title.isEmpty() )
454 drawTitle( painter, m_data->scaleDraw->alignment(), r );
455}
456
463QRectF QwtScaleWidget::colorBarRect( const QRectF& rect ) const
464{
465 QRectF cr = rect;
466
467 if ( m_data->scaleDraw->orientation() == Qt::Horizontal )
468 {
469 cr.setLeft( cr.left() + m_data->borderDist[0] );
470 cr.setWidth( cr.width() - m_data->borderDist[1] + 1 );
471 }
472 else
473 {
474 cr.setTop( cr.top() + m_data->borderDist[0] );
475 cr.setHeight( cr.height() - m_data->borderDist[1] + 1 );
476 }
477
478 switch ( m_data->scaleDraw->alignment() )
479 {
480 case QwtScaleDraw::LeftScale:
481 {
482 cr.setLeft( cr.right() - m_data->margin
483 - m_data->colorBar.width );
484 cr.setWidth( m_data->colorBar.width );
485 break;
486 }
487
488 case QwtScaleDraw::RightScale:
489 {
490 cr.setLeft( cr.left() + m_data->margin );
491 cr.setWidth( m_data->colorBar.width );
492 break;
493 }
494
495 case QwtScaleDraw::BottomScale:
496 {
497 cr.setTop( cr.top() + m_data->margin );
498 cr.setHeight( m_data->colorBar.width );
499 break;
500 }
501
502 case QwtScaleDraw::TopScale:
503 {
504 cr.setTop( cr.bottom() - m_data->margin
505 - m_data->colorBar.width );
506 cr.setHeight( m_data->colorBar.width );
507 break;
508 }
509 }
510
511 return cr;
512}
513
520 void QwtScaleWidget::changeEvent( QEvent* event )
521{
522 if ( event->type() == QEvent::LocaleChange )
523 {
524 m_data->scaleDraw->invalidateCache();
525 }
526
527 QWidget::changeEvent( event );
528}
529
534 void QwtScaleWidget::resizeEvent( QResizeEvent* event )
535{
536 Q_UNUSED( event );
537 layoutScale( false );
538}
539
548 void QwtScaleWidget::layoutScale( bool update_geometry )
549{
550 int bd0, bd1;
551 getBorderDistHint( bd0, bd1 );
552 if ( m_data->borderDist[0] > bd0 )
553 bd0 = m_data->borderDist[0];
554 if ( m_data->borderDist[1] > bd1 )
555 bd1 = m_data->borderDist[1];
556
557 int colorBarWidth = 0;
558 if ( m_data->colorBar.isEnabled && m_data->colorBar.interval.isValid() )
559 colorBarWidth = m_data->colorBar.width + m_data->spacing;
560
561 const QRectF r = contentsRect();
562 double x, y, length;
563
564 if ( m_data->scaleDraw->orientation() == Qt::Vertical )
565 {
566 y = r.top() + bd0;
567 length = r.height() - ( bd0 + bd1 );
568
569 if ( m_data->scaleDraw->alignment() == QwtScaleDraw::LeftScale )
570 x = r.right() - 1.0 - m_data->margin - colorBarWidth;
571 else
572 x = r.left() + m_data->margin + colorBarWidth;
573 }
574 else
575 {
576 x = r.left() + bd0;
577 length = r.width() - ( bd0 + bd1 );
578
579 if ( m_data->scaleDraw->alignment() == QwtScaleDraw::BottomScale )
580 y = r.top() + m_data->margin + colorBarWidth;
581 else
582 y = r.bottom() - 1.0 - m_data->margin - colorBarWidth;
583 }
584
585 m_data->scaleDraw->move( x, y );
586 m_data->scaleDraw->setLength( length );
587
588 const int extent = qwtCeil( m_data->scaleDraw->extent( font() ) );
589
590 m_data->titleOffset =
591 m_data->margin + m_data->spacing + colorBarWidth + extent;
592
593 if ( update_geometry )
594 {
595 updateGeometry();
596
597#if 1
598 /*
599 for some reason updateGeometry does not send a LayoutRequest event
600 when the parent is not visible and has no layout
601 */
602
603 if ( QWidget* w = parentWidget() )
604 {
605 if ( !w->isVisible() && w->layout() == NULL )
606 {
607 if ( w->testAttribute( Qt::WA_WState_Polished ) )
608 QApplication::postEvent( w, new QEvent( QEvent::LayoutRequest ) );
609 }
610 }
611#endif
612
613 update();
614 }
615}
616
625 void QwtScaleWidget::drawColorBar( QPainter* painter, const QRectF& rect ) const
626{
627 if ( !m_data->colorBar.interval.isValid() )
628 return;
629
630 const QwtScaleDraw* sd = m_data->scaleDraw;
631
632 QwtPainter::drawColorBar( painter, *m_data->colorBar.colorMap,
633 m_data->colorBar.interval.normalized(), sd->scaleMap(),
634 sd->orientation(), rect );
635}
636
645 void QwtScaleWidget::drawTitle( QPainter* painter,
646 QwtScaleDraw::Alignment align, const QRectF& rect ) const
647{
648 QRectF r = rect;
649 double angle;
650 int flags = m_data->title.renderFlags() &
651 ~( Qt::AlignTop | Qt::AlignBottom | Qt::AlignVCenter );
652
653 switch ( align )
654 {
655 case QwtScaleDraw::LeftScale:
656 angle = -90.0;
657 flags |= Qt::AlignTop;
658 r.setRect( r.left(), r.bottom(),
659 r.height(), r.width() - m_data->titleOffset );
660 break;
661
662 case QwtScaleDraw::RightScale:
663 angle = -90.0;
664 flags |= Qt::AlignTop;
665 r.setRect( r.left() + m_data->titleOffset, r.bottom(),
666 r.height(), r.width() - m_data->titleOffset );
667 break;
668
669 case QwtScaleDraw::BottomScale:
670 angle = 0.0;
671 flags |= Qt::AlignBottom;
672 r.setTop( r.top() + m_data->titleOffset );
673 break;
674
675 case QwtScaleDraw::TopScale:
676 default:
677 angle = 0.0;
678 flags |= Qt::AlignTop;
679 r.setBottom( r.bottom() - m_data->titleOffset );
680 break;
681 }
682
683 if ( m_data->layoutFlags & TitleInverted )
684 {
685 if ( align == QwtScaleDraw::LeftScale
686 || align == QwtScaleDraw::RightScale )
687 {
688 angle = -angle;
689 r.setRect( r.x() + r.height(), r.y() - r.width(),
690 r.width(), r.height() );
691 }
692 }
693
694 painter->save();
695 painter->setFont( font() );
696 painter->setPen( palette().color( QPalette::Text ) );
697
698 painter->translate( r.x(), r.y() );
699 if ( angle != 0.0 )
700 painter->rotate( angle );
701
702 QwtText title = m_data->title;
703 title.setRenderFlags( flags );
704 title.draw( painter, QRectF( 0.0, 0.0, r.width(), r.height() ) );
705
706 painter->restore();
707}
708
717 void QwtScaleWidget::scaleChange()
718{
719 layoutScale();
720}
721
725QSize QwtScaleWidget::sizeHint() const
726{
727 return minimumSizeHint();
728}
729
733QSize QwtScaleWidget::minimumSizeHint() const
734{
735 const Qt::Orientation o = m_data->scaleDraw->orientation();
736
737 // Border Distance cannot be less than the scale borderDistHint
738 // Note, the borderDistHint is already included in minHeight/minWidth
739 int length = 0;
740 int mbd1, mbd2;
741 getBorderDistHint( mbd1, mbd2 );
742 length += qMax( 0, m_data->borderDist[0] - mbd1 );
743 length += qMax( 0, m_data->borderDist[1] - mbd2 );
744 length += m_data->scaleDraw->minLength( font() );
745
746 int dim = dimForLength( length, font() );
747 if ( length < dim )
748 {
749 // compensate for long titles
750 length = dim;
751 dim = dimForLength( length, font() );
752 }
753
754 QSize size( length + 2, dim );
755 if ( o == Qt::Vertical )
756 size.transpose();
757
758 const QMargins m = contentsMargins();
759 return size + QSize( m.left() + m.right(), m.top() + m.bottom() );
760}
761
768 int QwtScaleWidget::titleHeightForWidth( int width ) const
769{
770 return qwtCeil( m_data->title.heightForWidth( width, font() ) );
771}
772
782 int QwtScaleWidget::dimForLength( int length, const QFont& scaleFont ) const
783{
784 const int extent = qwtCeil( m_data->scaleDraw->extent( scaleFont ) );
785
786 int dim = m_data->margin + extent + 1;
787
788 if ( !m_data->title.isEmpty() )
789 dim += titleHeightForWidth( length ) + m_data->spacing;
790
791 if ( m_data->colorBar.isEnabled && m_data->colorBar.interval.isValid() )
792 dim += m_data->colorBar.width + m_data->spacing;
793
794 return dim;
795}
796
815 void QwtScaleWidget::getBorderDistHint( int& start, int& end ) const
816{
817 m_data->scaleDraw->getBorderDistHint( font(), start, end );
818
819 if ( start < m_data->minBorderDist[0] )
820 start = m_data->minBorderDist[0];
821
822 if ( end < m_data->minBorderDist[1] )
823 end = m_data->minBorderDist[1];
824}
825
836 void QwtScaleWidget::setMinBorderDist( int start, int end )
837{
838 m_data->minBorderDist[0] = start;
839 m_data->minBorderDist[1] = end;
840}
841
853 void QwtScaleWidget::getMinBorderDist( int& start, int& end ) const
854{
855 start = m_data->minBorderDist[0];
856 end = m_data->minBorderDist[1];
857}
858
867 void QwtScaleWidget::setScaleDiv( const QwtScaleDiv& scaleDiv )
868{
869 QwtScaleDraw* sd = m_data->scaleDraw;
870 if ( sd->scaleDiv() != scaleDiv )
871 {
872 sd->setScaleDiv( scaleDiv );
873 layoutScale();
874
875 Q_EMIT scaleDivChanged();
876 }
877}
878
885 void QwtScaleWidget::setTransformation( QwtTransform* transformation )
886{
887 m_data->scaleDraw->setTransformation( transformation );
888 layoutScale();
889}
890
895 void QwtScaleWidget::setColorBarEnabled( bool on )
896{
897 if ( on != m_data->colorBar.isEnabled )
898 {
899 m_data->colorBar.isEnabled = on;
900 layoutScale();
901 }
902}
903
908 bool QwtScaleWidget::isColorBarEnabled() const
909{
910 return m_data->colorBar.isEnabled;
911}
912
919 void QwtScaleWidget::setColorBarWidth( int width )
920{
921 if ( width != m_data->colorBar.width )
922 {
923 m_data->colorBar.width = width;
924 if ( isColorBarEnabled() )
925 layoutScale();
926 }
927}
928
933 int QwtScaleWidget::colorBarWidth() const
934{
935 return m_data->colorBar.width;
936}
937
942 QwtInterval QwtScaleWidget::colorBarInterval() const
943{
944 return m_data->colorBar.interval;
945}
946
956 void QwtScaleWidget::setColorMap(
957 const QwtInterval& interval, QwtColorMap* colorMap )
958{
959 m_data->colorBar.interval = interval;
960
961 if ( colorMap != m_data->colorBar.colorMap )
962 {
963 delete m_data->colorBar.colorMap;
964 m_data->colorBar.colorMap = colorMap;
965 }
966
967 if ( isColorBarEnabled() )
968 layoutScale();
969}
970
975 const QwtColorMap* QwtScaleWidget::colorMap() const
976{
977 return m_data->colorBar.colorMap;
978}
979
980#include "moc_qwt_scale_widget.cpp"
QwtAbstractScaleDraw::setScaleDiv
void setScaleDiv(const QwtScaleDiv &)
Definition qwt_abstract_scale_draw.cpp:104
QwtAbstractScaleDraw::scaleMap
const QwtScaleMap & scaleMap() const
Definition qwt_abstract_scale_draw.cpp:121
QwtAbstractScaleDraw::invalidateCache
void invalidateCache()
Definition qwt_abstract_scale_draw.cpp:417
QwtAbstractScaleDraw::setTransformation
void setTransformation(QwtTransform *)
Definition qwt_abstract_scale_draw.cpp:115
QwtAbstractScaleDraw::draw
virtual void draw(QPainter *, const QPalette &) const
Draw the scale.
Definition qwt_abstract_scale_draw.cpp:169
QwtAbstractScaleDraw::scaleDiv
const QwtScaleDiv & scaleDiv() const
Definition qwt_abstract_scale_draw.cpp:133
QwtColorMap
QwtColorMap is used to map values into colors.
Definition qwt_color_map.h:38
QwtInterval
A class representing an interval.
Definition qwt_interval.h:23
QwtInterval::normalized
QwtInterval normalized() const
Normalize the limits of the interval.
Definition qwt_interval.cpp:29
QwtInterval::isValid
bool isValid() const
Definition qwt_interval.h:210
QwtLinearColorMap
QwtLinearColorMap builds a color map from color stops.
Definition qwt_color_map.h:99
QwtLinearScaleEngine
A scale engine for linear scales.
Definition qwt_scale_engine.h:152
QwtPainter::drawColorBar
static void drawColorBar(QPainter *, const QwtColorMap &, const QwtInterval &, const QwtScaleMap &, Qt::Orientation, const QRectF &)
Definition qwt_painter.cpp:1195
QwtScaleDiv
A class representing a scale division.
Definition qwt_scale_div.h:34
QwtScaleDraw
A class for drawing scales.
Definition qwt_scale_draw.h:36
QwtScaleDraw::setLength
void setLength(double length)
Definition qwt_scale_draw.cpp:732
QwtScaleDraw::move
void move(double x, double y)
Definition qwt_scale_draw.h:118
QwtScaleDraw::extent
virtual double extent(const QFont &) const override
Definition qwt_scale_draw.cpp:523
QwtScaleDraw::getBorderDistHint
void getBorderDistHint(const QFont &, int &start, int &end) const
Determine the minimum border distance.
Definition qwt_scale_draw.cpp:361
QwtScaleDraw::setLabelAlignment
void setLabelAlignment(Qt::Alignment)
Change the label flags.
Definition qwt_scale_draw.cpp:969
QwtScaleDraw::minLength
int minLength(const QFont &) const
Definition qwt_scale_draw.cpp:560
QwtScaleDraw::setAlignment
void setAlignment(Alignment)
Definition qwt_scale_draw.cpp:322
QwtScaleDraw::alignment
Alignment alignment() const
Definition qwt_scale_draw.cpp:309
QwtScaleDraw::orientation
Qt::Orientation orientation() const
Definition qwt_scale_draw.cpp:337
QwtScaleDraw::setLabelRotation
void setLabelRotation(double rotation)
Definition qwt_scale_draw.cpp:930
QwtScaleDraw::Alignment
Alignment
Definition qwt_scale_draw.h:43
QwtScaleDraw::BottomScale
@ BottomScale
The scale is below.
Definition qwt_scale_draw.h:45
QwtScaleDraw::TopScale
@ TopScale
The scale is above.
Definition qwt_scale_draw.h:48
QwtScaleDraw::RightScale
@ RightScale
The scale is right.
Definition qwt_scale_draw.h:54
QwtScaleDraw::LeftScale
@ LeftScale
The scale is left.
Definition qwt_scale_draw.h:51
QwtScaleMap::transformation
const QwtTransform * transformation() const
Get the transformation.
Definition qwt_scale_map.cpp:88
QwtScaleWidget::startBorderDist
int startBorderDist() const
Definition qwt_scale_widget.cpp:381
QwtScaleWidget::drawColorBar
void drawColorBar(QPainter *, const QRectF &) const
Definition qwt_scale_widget.cpp:625
QwtScaleWidget::alignment
QwtScaleDraw::Alignment alignment() const
Definition qwt_scale_widget.cpp:235
QwtScaleWidget::LayoutFlags
QFlags< LayoutFlag > LayoutFlags
Definition qwt_scale_widget.h:49
QwtScaleWidget::title
QwtText title() const
Definition qwt_scale_widget.cpp:372
QwtScaleWidget::colorMap
const QwtColorMap * colorMap() const
Definition qwt_scale_widget.cpp:975
QwtScaleWidget::setTitle
void setTitle(const QString &title)
Definition qwt_scale_widget.cpp:172
QwtScaleWidget::scaleDraw
const QwtScaleDraw * scaleDraw() const
Definition qwt_scale_widget.cpp:354
QwtScaleWidget::setMargin
void setMargin(int)
Specify the margin to the colorBar/base line.
Definition qwt_scale_widget.cpp:266
QwtScaleWidget::setColorMap
void setColorMap(const QwtInterval &, QwtColorMap *)
Definition qwt_scale_widget.cpp:956
QwtScaleWidget::draw
void draw(QPainter *) const
draw the scale
Definition qwt_scale_widget.cpp:431
QwtScaleWidget::setMinBorderDist
void setMinBorderDist(int start, int end)
Definition qwt_scale_widget.cpp:836
QwtScaleWidget::sizeHint
virtual QSize sizeHint() const override
Definition qwt_scale_widget.cpp:725
QwtScaleWidget::changeEvent
virtual void changeEvent(QEvent *) override
Definition qwt_scale_widget.cpp:520
QwtScaleWidget::scaleDivChanged
void scaleDivChanged()
Signal emitted, whenever the scale division changes.
QwtScaleWidget::isColorBarEnabled
bool isColorBarEnabled() const
Definition qwt_scale_widget.cpp:908
QwtScaleWidget::testLayoutFlag
bool testLayoutFlag(LayoutFlag) const
Definition qwt_scale_widget.cpp:161
QwtScaleWidget::drawTitle
void drawTitle(QPainter *, QwtScaleDraw::Alignment, const QRectF &rect) const
Definition qwt_scale_widget.cpp:645
QwtScaleWidget::setLayoutFlag
void setLayoutFlag(LayoutFlag, bool on)
Definition qwt_scale_widget.cpp:141
QwtScaleWidget::setTransformation
void setTransformation(QwtTransform *)
Definition qwt_scale_widget.cpp:885
QwtScaleWidget::endBorderDist
int endBorderDist() const
Definition qwt_scale_widget.cpp:390
QwtScaleWidget::setColorBarWidth
void setColorBarWidth(int)
Definition qwt_scale_widget.cpp:919
QwtScaleWidget::~QwtScaleWidget
virtual ~QwtScaleWidget()
Destructor.
Definition qwt_scale_widget.cpp:86
QwtScaleWidget::setLabelAlignment
void setLabelAlignment(Qt::Alignment)
Change the alignment for the labels.
Definition qwt_scale_widget.cpp:296
QwtScaleWidget::layoutScale
void layoutScale(bool update_geometry=true)
Definition qwt_scale_widget.cpp:548
QwtScaleWidget::LayoutFlag
LayoutFlag
Layout flags of the title.
Definition qwt_scale_widget.h:41
QwtScaleWidget::TitleInverted
@ TitleInverted
Definition qwt_scale_widget.h:46
QwtScaleWidget::spacing
int spacing() const
Definition qwt_scale_widget.cpp:408
QwtScaleWidget::paintEvent
virtual void paintEvent(QPaintEvent *) override
paintEvent
Definition qwt_scale_widget.cpp:416
QwtScaleWidget::getBorderDistHint
void getBorderDistHint(int &start, int &end) const
Calculate a hint for the border distances.
Definition qwt_scale_widget.cpp:815
QwtScaleWidget::colorBarRect
QRectF colorBarRect(const QRectF &) const
Definition qwt_scale_widget.cpp:463
QwtScaleWidget::setAlignment
void setAlignment(QwtScaleDraw::Alignment)
Definition qwt_scale_widget.cpp:209
QwtScaleWidget::dimForLength
int dimForLength(int length, const QFont &scaleFont) const
Find the minimum dimension for a given length. dim is the height, length the width seen in direction ...
Definition qwt_scale_widget.cpp:782
QwtScaleWidget::setBorderDist
void setBorderDist(int dist1, int dist2)
Definition qwt_scale_widget.cpp:251
QwtScaleWidget::margin
int margin() const
Definition qwt_scale_widget.cpp:399
QwtScaleWidget::colorBarWidth
int colorBarWidth() const
Definition qwt_scale_widget.cpp:933
QwtScaleWidget::getMinBorderDist
void getMinBorderDist(int &start, int &end) const
Definition qwt_scale_widget.cpp:853
QwtScaleWidget::minimumSizeHint
virtual QSize minimumSizeHint() const override
Definition qwt_scale_widget.cpp:733
QwtScaleWidget::QwtScaleWidget
QwtScaleWidget(QWidget *parent=NULL)
Create a scale with the position QwtScaleWidget::Left.
Definition qwt_scale_widget.cpp:68
QwtScaleWidget::colorBarInterval
QwtInterval colorBarInterval() const
Definition qwt_scale_widget.cpp:942
QwtScaleWidget::setSpacing
void setSpacing(int)
Specify the distance between color bar, scale and title.
Definition qwt_scale_widget.cpp:281
QwtScaleWidget::setLabelRotation
void setLabelRotation(double rotation)
Change the rotation for the labels. See QwtScaleDraw::setLabelRotation().
Definition qwt_scale_widget.cpp:309
QwtScaleWidget::setScaleDiv
void setScaleDiv(const QwtScaleDiv &)
Assign a scale division.
Definition qwt_scale_widget.cpp:867
QwtScaleWidget::setColorBarEnabled
void setColorBarEnabled(bool)
Definition qwt_scale_widget.cpp:895
QwtScaleWidget::scaleChange
void scaleChange()
Notify a change of the scale.
Definition qwt_scale_widget.cpp:717
QwtScaleWidget::resizeEvent
virtual void resizeEvent(QResizeEvent *) override
Definition qwt_scale_widget.cpp:534
QwtScaleWidget::setScaleDraw
void setScaleDraw(QwtScaleDraw *)
Definition qwt_scale_widget.cpp:326
QwtScaleWidget::titleHeightForWidth
int titleHeightForWidth(int width) const
Find the height of the title for a given width.
Definition qwt_scale_widget.cpp:768
QwtText
A class representing a text.
Definition qwt_text.h:52
QwtText::renderFlags
int renderFlags() const
Definition qwt_text.cpp:317
QwtText::setText
void setText(const QString &, QwtText::TextFormat textFormat=AutoText)
Definition qwt_text.cpp:277
QwtText::isEmpty
bool isEmpty() const
Definition qwt_text.cpp:739
QwtText::setFont
void setFont(const QFont &)
Definition qwt_text.cpp:329
QwtText::draw
void draw(QPainter *painter, const QRectF &rect) const
Definition qwt_text.cpp:615
QwtText::text
QString text() const
Definition qwt_text.cpp:289
QwtText::heightForWidth
double heightForWidth(double width) const
Definition qwt_text.cpp:522
QwtText::setRenderFlags
void setRenderFlags(int)
Change the render flags.
Definition qwt_text.cpp:304
QwtTransform
A transformation between coordinate systems.
Definition qwt_transform.h:36
QwtTransform::copy
virtual QwtTransform * copy() const =0
Virtualized copy operation.