qwt_slider.h
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
* Qwt Widget Library
* Copyright (C) 1997 Josef Wilgen
* Copyright (C) 2002 Uwe Rathmann
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the Qwt License, Version 1.0
*****************************************************************************/
#ifndef QWT_SLIDER_H
#define QWT_SLIDER_H
#include "qwt_global.h"
#include "qwt_abstract_slider.h"
class QwtScaleDraw;
class QWT_EXPORT QwtSlider: public QwtAbstractSlider
{
Q_OBJECT
Q_ENUMS( ScalePosition BackgroundStyle )
Q_PROPERTY( Qt::Orientation orientation
READ orientation WRITE setOrientation )
Q_PROPERTY( ScalePosition scalePosition READ scalePosition
WRITE setScalePosition )
Q_PROPERTY( bool trough READ hasTrough WRITE setTrough )
Q_PROPERTY( bool groove READ hasGroove WRITE setGroove )
Q_PROPERTY( QSize handleSize READ handleSize WRITE setHandleSize )
Q_PROPERTY( int borderWidth READ borderWidth WRITE setBorderWidth )
Q_PROPERTY( int spacing READ spacing WRITE setSpacing )
public:
enum ScalePosition
{
NoScale,
LeadingScale,
TrailingScale
};
explicit QwtSlider( QWidget *parent = NULL );
explicit QwtSlider( Qt::Orientation, QWidget *parent = NULL );
virtual ~QwtSlider();
void setOrientation( Qt::Orientation );
Qt::Orientation orientation() const;
void setScalePosition( ScalePosition );
ScalePosition scalePosition() const;
void setTrough( bool );
bool hasTrough() const;
void setGroove( bool );
bool hasGroove() const;
void setHandleSize( const QSize & );
QSize handleSize() const;
void setBorderWidth( int );
int borderWidth() const;
void setSpacing( int );
int spacing() const;
virtual QSize sizeHint() const;
virtual QSize minimumSizeHint() const;
void setScaleDraw( QwtScaleDraw * );
const QwtScaleDraw *scaleDraw() const;
void setUpdateInterval( int );
int updateInterval() const;
protected:
virtual double scrolledTo( const QPoint & ) const;
virtual bool isScrollPosition( const QPoint & ) const;
virtual void drawSlider ( QPainter *, const QRect & ) const;
virtual void drawHandle( QPainter *, const QRect &, int pos ) const;
virtual void mousePressEvent( QMouseEvent * );
virtual void mouseReleaseEvent( QMouseEvent * );
virtual void resizeEvent( QResizeEvent * );
virtual void paintEvent ( QPaintEvent * );
virtual void changeEvent( QEvent * );
virtual void timerEvent( QTimerEvent * );
virtual void scaleChange();
QRect sliderRect() const;
QRect handleRect() const;
private:
QwtScaleDraw *scaleDraw();
void layoutSlider( bool );
void initSlider( Qt::Orientation );
class PrivateData;
PrivateData *d_data;
};
#endif
QwtAbstractSlider::mousePressEvent
virtual void mousePressEvent(QMouseEvent *)
Definition: qwt_abstract_slider.cpp:198
QwtAbstractSlider::isScrollPosition
virtual bool isScrollPosition(const QPoint &pos) const =0
Determine what to do when the user presses a mouse button.
QwtAbstractSlider::mouseReleaseEvent
virtual void mouseReleaseEvent(QMouseEvent *)
Definition: qwt_abstract_slider.cpp:268
QwtAbstractSlider
An abstract base class for slider widgets with a scale.
Definition: qwt_abstract_slider.h:33
QwtSlider::NoScale
@ NoScale
The slider has no scale.
Definition: qwt_slider.h:57
QwtScaleDraw
A class for drawing scales.
Definition: qwt_scale_draw.h:32
QwtSlider
The Slider Widget.
Definition: qwt_slider.h:31
QwtSlider::LeadingScale
@ LeadingScale
The scale is right of a vertical or below a horizontal slider.
Definition: qwt_slider.h:60
QwtSlider::ScalePosition
ScalePosition
Definition: qwt_slider.h:55
QwtAbstractSlider::scrolledTo
virtual double scrolledTo(const QPoint &pos) const =0
Determine the value for a new position of the movable part of the slider.
QwtAbstractSlider::scaleChange
virtual void scaleChange()
Definition: qwt_abstract_slider.cpp:801