ScalePicker.h
Go to the documentation of this file.
/***************************************************************************
File : ScalePicker.h
Project : QtiPlot
--------------------------------------------------------------------
Copyright : (C) 2007 by Ion Vasilief
Email (use @ for *) : ion_vasilief*yahoo.fr
Description : Scale picker
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, *
* Boston, MA 02110-1301 USA *
* *
***************************************************************************/
#include <QObject>
class QRect;
class QPoint;
class QwtScaleWidget;
class Graph;
class ScalePicker: public QObject
{
Q_OBJECT
public:
ScalePicker(Graph *plot);
QRect scaleRect(const QwtScaleWidget *) const;
QRect scaleTicksRect(const QwtScaleWidget *scale) const;
QRect titleRect(const QwtScaleWidget *scale) const;
void refresh();
Graph *plot() {return (Graph *)parent();};
void deselect();
bool titleSelected(){return d_title_selected;};
void selectTitle(QwtScaleWidget *scale, bool select = true);
bool labelsSelected(){return d_labels_selected;};
void selectLabels(QwtScaleWidget *scale, bool select = true);
QwtScaleWidget* selectedAxis(){return d_selected_axis;};
QwtScaleWidget* currentAxis(){return d_current_axis;};
signals:
void clicked();
void axisRightClicked(int);
void axisTitleRightClicked();
void axisDblClicked(int);
void axisTicksDblClicked(int);
void axisTitleDblClicked();
private:
bool eventFilter(QObject *, QEvent *);
void mouseDblClicked(const QwtScaleWidget *, const QPoint &);
void mouseClicked(const QwtScaleWidget *scale, const QPoint &pos) ;
void mouseRightClicked(const QwtScaleWidget *scale, const QPoint &pos);
bool labelClicked(const QwtScaleWidget *scale, const QPoint &pos);
bool d_title_selected;
bool d_labels_selected;
QwtScaleWidget *d_selected_axis, *d_current_axis;
};
ScalePicker::selectedAxis
QwtScaleWidget * selectedAxis()
Definition: ScalePicker.h:76
ScalePicker::scaleTicksRect
QRect scaleTicksRect(const QwtScaleWidget *scale) const
Returns the bounding rectangle of a scale excluding the title and the tick labels.
Definition: ScalePicker.cpp:189
ScalePicker::mouseDblClicked
void mouseDblClicked(const QwtScaleWidget *, const QPoint &)
Definition: ScalePicker.cpp:125
Graph
A 2D-plotting widget.
Definition: Graph.h:123
ScalePicker::ScalePicker
ScalePicker(Graph *plot)
Definition: ScalePicker.cpp:40
ScalePicker::d_labels_selected
bool d_labels_selected
Definition: ScalePicker.h:113
ScalePicker::selectLabels
void selectLabels(QwtScaleWidget *scale, bool select=true)
Definition: ScalePicker.cpp:269
ScalePicker::axisDblClicked
void axisDblClicked(int)
ScalePicker::scaleRect
QRect scaleRect(const QwtScaleWidget *) const
Returns the bounding rectangle of a scale without the title.
Definition: ScalePicker.cpp:148
ScalePicker::deselect
void deselect()
Definition: ScalePicker.cpp:292
ScalePicker::mouseClicked
void mouseClicked(const QwtScaleWidget *scale, const QPoint &pos)
ScalePicker::titleSelected
bool titleSelected()
Definition: ScalePicker.h:67
ScalePicker::axisTitleDblClicked
void axisTitleDblClicked()
ScalePicker::axisTicksDblClicked
void axisTicksDblClicked(int)
ScalePicker::d_current_axis
QwtScaleWidget * d_current_axis
Definition: ScalePicker.h:114
ScalePicker::axisRightClicked
void axisRightClicked(int)
ScalePicker::selectTitle
void selectTitle(QwtScaleWidget *scale, bool select=true)
Definition: ScalePicker.cpp:243
ScalePicker::currentAxis
QwtScaleWidget * currentAxis()
Returns a pointer to the active axis in the plot layer.
Definition: ScalePicker.h:78
ScalePicker::clicked
void clicked()
Emitted when the user clicks on one of the monitored axes.
ScalePicker::eventFilter
bool eventFilter(QObject *, QEvent *)
Definition: ScalePicker.cpp:50
ScalePicker::d_selected_axis
QwtScaleWidget * d_selected_axis
Definition: ScalePicker.h:114
ScalePicker::titleRect
QRect titleRect(const QwtScaleWidget *scale) const
Returns the bounding rectangle of a scale&#39;s title.
Definition: ScalePicker.cpp:210
ScalePicker::d_title_selected
bool d_title_selected
Definition: ScalePicker.h:112
ScalePicker
Handles user interaction with a QwtScaleWidget.
Definition: ScalePicker.h:41
ScalePicker::labelsSelected
bool labelsSelected()
Definition: ScalePicker.h:70
ScalePicker::refresh
void refresh()
Definition: ScalePicker.cpp:180
ScalePicker::labelClicked
bool labelClicked(const QwtScaleWidget *scale, const QPoint &pos)
Definition: ScalePicker.cpp:87
ScalePicker::axisTitleRightClicked
void axisTitleRightClicked()
Emitted when the user right-clicks on the title of an axis.
ScalePicker::mouseRightClicked
void mouseRightClicked(const QwtScaleWidget *scale, const QPoint &pos)
Definition: ScalePicker.cpp:137
ScalePicker::plot
Graph * plot()
Return my parent casted to Graph.
Definition: ScalePicker.h:63