krita/ui

KisCurveWidget Class Reference

KisCurveWidget is a widget that shows a single curve that can be edited by the user. More...

#include <kis_curve_widget.h>

Inheritance diagram for KisCurveWidget:

List of all members.

Signals

void modified (void)

Public Member Functions

 KisCurveWidget (QWidget *parent=0, Qt::WFlags f=0)
virtual ~KisCurveWidget ()
void addPointInTheMiddle ()
void dropInOutControls ()
QList< QPointFgetCurve ()
double getCurveValue (double x)
void reset (void)
void setCurve (QList< QPointF > inlist)
void setCurveGuide (const QColor &color)
void setPixmap (const QPixmap &pix)
void setupInOutControls (QSpinBox *in, QSpinBox *out, int min, int max)

Static Public Member Functions

static double getCurveValue (const QList< QPointF > &curve, double x)

Protected Slots

void inOutChanged (int)

Protected Member Functions

void keyPressEvent (QKeyEvent *)
void leaveEvent (QEvent *)
void mouseMoveEvent (QMouseEvent *e)
void mousePressEvent (QMouseEvent *e)
void mouseReleaseEvent (QMouseEvent *e)
void paintEvent (QPaintEvent *)
void resizeEvent (QResizeEvent *e)

Detailed Description

KisCurveWidget is a widget that shows a single curve that can be edited by the user.

The user can grab the curve and move it; this creates a new control point. Control points can be deleted by selecting a point and pressing the delete key.

(From: http://techbase.kde.org/Projects/Widgets_and_Classes#KisCurveWidget) KisCurveWidget allows editing of spline based y=f(x) curves. Handy for cases where you want the user to control such things as tablet pressure response, color transformations, acceleration by time, aeroplane lift by angle of attack.

Definition at line 50 of file kis_curve_widget.h.


Constructor & Destructor Documentation

KisCurveWidget::KisCurveWidget ( QWidget parent = 0,
Qt::WFlags  f = 0 
)

Create a new curve widget with a default curve, that is a straight line from bottom-left to top-right.

Definition at line 66 of file kis_curve_widget.cpp.

KisCurveWidget::~KisCurveWidget (  )  [virtual]

Definition at line 96 of file kis_curve_widget.cpp.


Member Function Documentation

void KisCurveWidget::addPointInTheMiddle (  ) 

Handy function that creates new point in the middle of the curve and sets focus on the m_intIn field, so the user can move this point anywhere in a moment.

Definition at line 224 of file kis_curve_widget.cpp.

void KisCurveWidget::dropInOutControls (  ) 

Definition at line 123 of file kis_curve_widget.cpp.

QList< QPointF > KisCurveWidget::getCurve (  ) 
Returns:
get a list with all defined points. If you want to know what the y value for a given x is on the curve defined by these points, use getCurveValue().
See also:
getCurveValue

Definition at line 478 of file kis_curve_widget.cpp.

double KisCurveWidget::getCurveValue ( double  x  ) 
Returns:
the y value corresponding the specified x value of the current curve.

Definition at line 463 of file kis_curve_widget.cpp.

double KisCurveWidget::getCurveValue ( const QList< QPointF > &  curve,
double  x 
) [static]
Returns:
the y value on the specified curve corresponding to the specified x value.

Definition at line 472 of file kis_curve_widget.cpp.

void KisCurveWidget::inOutChanged ( int   )  [protected, slot]

Definition at line 135 of file kis_curve_widget.cpp.

void KisCurveWidget::keyPressEvent ( QKeyEvent e  )  [protected]

Reimplemented from QWidget.

Definition at line 187 of file kis_curve_widget.cpp.

void KisCurveWidget::leaveEvent ( QEvent  )  [protected]

Reimplemented from QWidget.

Definition at line 490 of file kis_curve_widget.cpp.

void KisCurveWidget::modified ( void   )  [signal]

Emitted whenever a control point has changed position.

void KisCurveWidget::mouseMoveEvent ( QMouseEvent e  )  [protected]

Reimplemented from QWidget.

Definition at line 385 of file kis_curve_widget.cpp.

void KisCurveWidget::mousePressEvent ( QMouseEvent e  )  [protected]

Reimplemented from QWidget.

Definition at line 332 of file kis_curve_widget.cpp.

void KisCurveWidget::mouseReleaseEvent ( QMouseEvent e  )  [protected]

Reimplemented from QWidget.

Definition at line 371 of file kis_curve_widget.cpp.

void KisCurveWidget::paintEvent ( QPaintEvent  )  [protected]

Keep in mind that QLineF rounds doubles to ints matematically, not just rounds down like in C

Reimplemented from QWidget.

Definition at line 248 of file kis_curve_widget.cpp.

void KisCurveWidget::reset ( void   ) 

Reset the curve to the default shape.

Definition at line 165 of file kis_curve_widget.cpp.

void KisCurveWidget::resizeEvent ( QResizeEvent e  )  [protected]

Reimplemented from QWidget.

Definition at line 242 of file kis_curve_widget.cpp.

void KisCurveWidget::setCurve ( QList< QPointF inlist  ) 

Replace the current curve with a curve specified by the curve defined by the control points in.

Parameters:
inlist. 

Definition at line 483 of file kis_curve_widget.cpp.

void KisCurveWidget::setCurveGuide ( const QColor color  ) 

Enable the guide and set the guide color to the specified color.

XXX: it seems that the guide feature isn't actually implemented yet?

Definition at line 173 of file kis_curve_widget.cpp.

void KisCurveWidget::setPixmap ( const QPixmap pix  ) 

Set a background pixmap.

The background pixmap will be drawn under the grid and the curve.

XXX: or is the pixmap what is drawn to the left and bottom of the curve itself?

Definition at line 180 of file kis_curve_widget.cpp.

void KisCurveWidget::setupInOutControls ( QSpinBox in,
QSpinBox out,
int  min,
int  max 
)

Connect/disconnect external spinboxes to the curve / - is the range for their values.

Definition at line 103 of file kis_curve_widget.cpp.


The documentation for this class was generated from the following files: