23 #include <qstyleoption.h> 24 #include <qapplication.h> 119 const int flags = Qt::AlignHCenter
120 | Qt::TextExpandTabs | Qt::TextWordWrap;
124 QSizePolicy policy( QSizePolicy::MinimumExpanding,
125 QSizePolicy::Fixed );
129 setSizePolicy( policy );
131 setAttribute( Qt::WA_WState_OwnSizePolicy,
false );
194 const int flags = title.
renderFlags() & ~( Qt::AlignTop | Qt::AlignBottom );
215 if ( !testAttribute( Qt::WA_WState_OwnSizePolicy ) )
217 QSizePolicy policy( QSizePolicy::MinimumExpanding,
218 QSizePolicy::Fixed );
222 setSizePolicy( policy );
224 setAttribute( Qt::WA_WState_OwnSizePolicy,
false );
268 margin = qMax( 0, margin );
283 spacing = qMax( 0, spacing );
418 QPainter painter(
this );
419 painter.setClipRegion( event->region() );
423 style()->drawPrimitive(QStyle::PE_Widget, &opt, &painter,
this);
441 QRect r = contentsRect();
522 if ( event->type() == QEvent::LocaleChange )
527 QWidget::changeEvent( event );
561 const QRectF r = contentsRect();
567 length = r.height() - ( bd0 + bd1 );
577 length = r.width() - ( bd0 + bd1 );
593 if ( update_geometry )
603 if ( QWidget* w = parentWidget() )
605 if ( !w->isVisible() && w->layout() == NULL )
607 if ( w->testAttribute( Qt::WA_WState_Polished ) )
608 QApplication::postEvent( w,
new QEvent( QEvent::LayoutRequest ) );
651 ~( Qt::AlignTop | Qt::AlignBottom | Qt::AlignVCenter );
657 flags |= Qt::AlignTop;
658 r.setRect( r.left(), r.bottom(),
664 flags |= Qt::AlignTop;
671 flags |= Qt::AlignBottom;
678 flags |= Qt::AlignTop;
689 r.setRect( r.x() + r.height(), r.y() - r.width(),
690 r.width(), r.height() );
695 painter->setFont( font() );
696 painter->setPen( palette().color( QPalette::Text ) );
698 painter->translate( r.x(), r.y() );
700 painter->rotate( angle );
704 title.
draw( painter, QRectF( 0.0, 0.0, r.width(), r.height() ) );
754 QSize size( length + 2, dim );
755 if ( o == Qt::Vertical )
758 const QMargins m = contentsMargins();
759 return size + QSize( m.left() + m.right(), m.top() + m.bottom() );
819 if ( start < d_data->minBorderDist[0] )
822 if ( end < d_data->minBorderDist[1] )
981 #include "moc_qwt_scale_widget.cpp"
QwtInterval normalized() const
Normalize the limits of the interval.
void setAlignment(Alignment)
void setLength(double length)
void setFont(const QFont &)
A class representing an interval.
void setRenderFlags(int)
Change the render flags.
void setText(const QString &, QwtText::TextFormat textFormat=AutoText)
static void drawColorBar(QPainter *, const QwtColorMap &, const QwtInterval &, const QwtScaleMap &, Qt::Orientation, const QRectF &)
void draw(QPainter *painter, const QRectF &rect) const
A class representing a scale division.
const QwtScaleMap & scaleMap() const
void getBorderDistHint(const QFont &, int &start, int &end) const
Determine the minimum border distance.
int minLength(const QFont &) const
double heightForWidth(double width) const
Alignment alignment() const
const QwtScaleDiv & scaleDiv() const
A class representing a text.
QwtColorMap is used to map values into colors.
void setScaleDiv(const QwtScaleDiv &)
void setLabelRotation(double rotation)
const QwtTransform * transformation() const
Get the transformation.
QwtLinearColorMap builds a color map from color stops.
Qt::Orientation orientation() const
virtual void draw(QPainter *, const QPalette &) const
Draw the scale.
virtual double extent(const QFont &) const QWT_OVERRIDE
void setTransformation(QwtTransform *)
A class for drawing scales.
A scale engine for linear scales.
void setLabelAlignment(Qt::Alignment)
Change the label flags.
void move(double x, double y)