Commit 7861bcd0 authored by Thomas Gubler's avatar Thomas Gubler

Merge remote-tracking branch 'upstream/master' into hil_quad

parents 5fc5b2aa 1caf009e
......@@ -21,7 +21,6 @@ tmp
debug
release
/qgroundcontrol
mavlinkgen-build-desktop
qgroundcontrol.xcodeproj/**
doc/html
doc/doxy.log
......
......@@ -123,34 +123,6 @@ INCLUDEPATH += $$MAVLINKPATH
INCLUDEPATH += $$MAVLINKPATH/common
}
#
# [DEPRECATED] MAVLink generator UI. Provides a GUI interface for generating MAVLink dialects.
# Replaced by mavgenerator.py within the MAVLink project.
#
contains(DEFINES, ENABLE_MAVGEN) {
warning("Including support for MAVLink generator GUI (manual override from command line, CAUTION: deprecated)")
} else:infile(user_config.pri, DEFINES, ENABLE_MAVGEN) {
DEFINES += ENABLE_MAVGEN # infile doesn't automatically include everything in the specified file
warning("Including support for MAVLink generator GUI (manual override from user_config.pri, CAUTION: deprecated)")
}
contains(DEFINES, ENABLE_MAVGEN) {
# Rename the macro to be consistent with other QGC feature existance macros.
DEFINES -= ENABLE_MAVGEN
DEFINES += QGC_MAVGEN_ENABLED
DEPENDPATH += \
src/apps/mavlinkgen
INCLUDEPATH += \
src/apps/mavlinkgen \
src/apps/mavlinkgen/ui \
src/apps/mavlinkgen/generator
include(src/apps/mavlinkgen/mavlinkgen.pri)
} else {
message("Skipping support for MAVLink generator GUI (deprecated, see README)")
}
#
# [OPTIONAL] OpenSceneGraph
# Allow the user to override OpenSceneGraph compilation through a DISABLE_OPEN_SCENE_GRAPH
......@@ -348,7 +320,9 @@ INCLUDEPATH += \
#
# [REQUIRED] QWT plotting library dependency. Provides plotting capabilities.
#
include(libs/qwt/qwt.pri)
include(libs/qwt.pri)
DEPENDPATH += libs/qwt
INCLUDEPATH += libs/qwt
#
# [REQUIRED] QSerialPort library. Provides serial port wrapper library.
......
......@@ -37,9 +37,6 @@ The QUpgrade module relies on `libudev` on Linux platforms, so be sure to instal
### Specifying MAVLink dialects
The MAVLink dialect compiled by default by QGC is for the ardupilotmega. This will happen if no other dialects are specified. Setting the `MAVLINK_CONF` variable sets the dialects, with more than one specified in a space-separated list. Note that doing this may result in compilation errors as certain dialects may conflict with each other!
### MAVLink dialect generator
An add-on is available for QGC that provides a UI for generating MAVLink dialects from within QGC. This feature has been deprecated since identical functionality now exists within the MAVLink project itself. Enable this functionality by specifying the `DEFINES` variable `ENABLE_MAVGEN`.
### Opal-RT's RT-LAB simulator
Integration with Opal-RT's RT-LAB simulator can be enabled on Windows by installing RT-LAB 7.2.4. This allows vehicles to be simulated in RT-LAB and communicate directly with QGC on the same computer as if the UAS was actually deployed. This support is enabled by default once the requisite RT-LAB software is installed. Disabling this can be done by adding `DISABLE_RTLAB` to the `DEFINES` variable.
......
......@@ -91,7 +91,7 @@
<damping_coeff_rebound unit="LBS/FT/SEC"> 4.0 </damping_coeff_rebound>
<max_steer unit="DEG">0</max_steer>
<brake_group>NONE</brake_group>
<retractable>FIXED</retractable>
<retractable>0</retractable>
</contact>
<contact type="BOGEY" name="NOSE">
<location unit="M">
......@@ -107,7 +107,7 @@
<damping_coeff_rebound unit="LBS/FT/SEC"> 4.0 </damping_coeff_rebound>
<max_steer unit="DEG">0</max_steer>
<brake_group>NONE</brake_group>
<retractable>FIXED</retractable>
<retractable>0</retractable>
</contact>
<contact type="STRUCTURE" name="TAIL">
......
This folder contains the various required libraries for QGC to compile. They are distributed with the codebase to ease development.
# Qwt
Qt Widgets for Technical Applications
Version: 6.1
Source obtained: `svn checkout svn://svn.code.sf.net/p/qwt/code/branches/qwt-6.1 qwt`
Contents of `/libs/qwt` is the contents of the `/src` directory from the Qwt repository.
qwt.pri file is custom made to compile all necessary Qwt code in with QGC.
This diff is collapsed.
......@@ -61,6 +61,7 @@ namespace core {
Placemark GetPlacemarkFromGeocoder(internals::PointLatLng location);
int Timeout;
private:
int Random(int low, int high);
void GetSecGoogleWords(const core::Point &pos, QString &sec1, QString &sec2);
int GetServerNum(const core::Point &pos,const int &max) const;
void TryCorrectGoogleVersions();
......
......@@ -52,31 +52,37 @@ namespace mapcontrol
}
void MapRipper::finish()
{
if(zoom<maxzoom)
if(zoom<maxzoom)
{
++zoom;
QMessageBox msgBox;
msgBox.setText(tr("Continue Ripping at zoom level %1? (Continuing automatically after 3s)").arg(zoom));
// msgBox.setInformativeText("Do you want to save your changes?");
msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
msgBox.setDefaultButton(QMessageBox::Yes);
QTimer::singleShot(3000, &msgBox, SLOT(accept()));
msgBox.exec();
int ret = msgBox.result();
++zoom;
QMessageBox msgBox;
msgBox.setText(tr("Continue Ripping at zoom level %1? (Continuing automatically after 3s)").arg(zoom));
// msgBox.setInformativeText("Do you want to save your changes?");
msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
msgBox.setDefaultButton(QMessageBox::Yes);
QTimer::singleShot(3000, &msgBox, SLOT(accept()));
msgBox.exec();
int ret = msgBox.result();
if(ret==QMessageBox::Yes || ret == 1)
{
points.clear();
points=core->Projection()->GetAreaTileList(area,zoom,0);
this->start();
}
else
{
progressForm->close();
delete progressForm;
this->deleteLater();
}
}
if(ret==QMessageBox::Yes || ret == 1)
{
points.clear();
points=core->Projection()->GetAreaTileList(area,zoom,0);
this->start();
}
else
{
progressForm->close();
delete progressForm;
this->deleteLater();
}
}
else
{
progressForm->close();
delete progressForm;
this->deleteLater();
}
}
......
######################################################################
# Automatically generated by qmake (2.01a) Wed Feb 10 11:43:43 2010
######################################################################
QWTSRCDIR = libs/qwt
DEPENDPATH += $$QWTSRCDIR
INCLUDEPATH += $$QWTSRCDIR
# Input
HEADERS += $$QWTSRCDIR/qwt.h \
$$QWTSRCDIR/qwt_abstract_legend.h \
$$QWTSRCDIR/qwt_abstract_scale.h \
$$QWTSRCDIR/qwt_abstract_scale_draw.h \
$$QWTSRCDIR/qwt_abstract_slider.h \
$$QWTSRCDIR/qwt_analog_clock.h \
$$QWTSRCDIR/qwt_arrow_button.h \
$$QWTSRCDIR/qwt_clipper.h \
$$QWTSRCDIR/qwt_color_map.h \
$$QWTSRCDIR/qwt_compass.h \
$$QWTSRCDIR/qwt_compass_rose.h \
$$QWTSRCDIR/qwt_counter.h \
$$QWTSRCDIR/qwt_curve_fitter.h \
$$QWTSRCDIR/qwt_dial.h \
$$QWTSRCDIR/qwt_dial_needle.h \
$$QWTSRCDIR/qwt_dyngrid_layout.h \
$$QWTSRCDIR/qwt_event_pattern.h \
$$QWTSRCDIR/qwt_global.h \
$$QWTSRCDIR/qwt_graphic.h \
$$QWTSRCDIR/qwt_interval.h \
$$QWTSRCDIR/qwt_knob.h \
$$QWTSRCDIR/qwt_legend.h \
$$QWTSRCDIR/qwt_legend_data.h \
$$QWTSRCDIR/qwt_legend_label.h \
$$QWTSRCDIR/qwt_magnifier.h \
$$QWTSRCDIR/qwt_math.h \
$$QWTSRCDIR/qwt_null_paintdevice.h \
$$QWTSRCDIR/qwt_painter.h \
$$QWTSRCDIR/qwt_painter_command.h \
$$QWTSRCDIR/qwt_panner.h \
$$QWTSRCDIR/qwt_picker.h \
$$QWTSRCDIR/qwt_picker_machine.h \
$$QWTSRCDIR/qwt_pixel_matrix.h \
$$QWTSRCDIR/qwt_plot.h \
$$QWTSRCDIR/qwt_plot_canvas.h \
$$QWTSRCDIR/qwt_plot_curve.h \
$$QWTSRCDIR/qwt_plot_dict.h \
$$QWTSRCDIR/qwt_plot_grid.h \
$$QWTSRCDIR/qwt_plot_item.h \
$$QWTSRCDIR/qwt_plot_layout.h \
$$QWTSRCDIR/qwt_plot_magnifier.h \
$$QWTSRCDIR/qwt_plot_marker.h \
$$QWTSRCDIR/qwt_plot_panner.h \
$$QWTSRCDIR/qwt_plot_picker.h \
$$QWTSRCDIR/qwt_plot_rasteritem.h \
$$QWTSRCDIR/qwt_plot_scaleitem.h \
$$QWTSRCDIR/qwt_plot_seriesitem.h \
$$QWTSRCDIR/qwt_plot_spectrogram.h \
$$QWTSRCDIR/qwt_plot_svgitem.h \
$$QWTSRCDIR/qwt_plot_zoomer.h \
$$QWTSRCDIR/qwt_point_mapper.h \
$$QWTSRCDIR/qwt_point_data.h \
$$QWTSRCDIR/qwt_raster_data.h \
$$QWTSRCDIR/qwt_round_scale_draw.h \
$$QWTSRCDIR/qwt_scale_div.h \
$$QWTSRCDIR/qwt_scale_draw.h \
$$QWTSRCDIR/qwt_scale_engine.h \
$$QWTSRCDIR/qwt_scale_map.h \
$$QWTSRCDIR/qwt_scale_widget.h \
$$QWTSRCDIR/qwt_series_data.h \
$$QWTSRCDIR/qwt_slider.h \
$$QWTSRCDIR/qwt_spline.h \
$$QWTSRCDIR/qwt_symbol.h \
$$QWTSRCDIR/qwt_text.h \
$$QWTSRCDIR/qwt_text_engine.h \
$$QWTSRCDIR/qwt_text_label.h \
$$QWTSRCDIR/qwt_thermo.h \
$$QWTSRCDIR/qwt_transform.h \
$$QWTSRCDIR/qwt_wheel.h \
$$QWTSRCDIR/qwt_widget_overlay.h
SOURCES += $$QWTSRCDIR/qwt_abstract_legend.cpp \
$$QWTSRCDIR/qwt_abstract_scale.cpp \
$$QWTSRCDIR/qwt_abstract_scale_draw.cpp \
$$QWTSRCDIR/qwt_abstract_slider.cpp \
$$QWTSRCDIR/qwt_analog_clock.cpp \
$$QWTSRCDIR/qwt_arrow_button.cpp \
$$QWTSRCDIR/qwt_clipper.cpp \
$$QWTSRCDIR/qwt_color_map.cpp \
$$QWTSRCDIR/qwt_compass.cpp \
$$QWTSRCDIR/qwt_compass_rose.cpp \
$$QWTSRCDIR/qwt_counter.cpp \
$$QWTSRCDIR/qwt_curve_fitter.cpp \
$$QWTSRCDIR/qwt_dial.cpp \
$$QWTSRCDIR/qwt_dial_needle.cpp \
$$QWTSRCDIR/qwt_dyngrid_layout.cpp \
$$QWTSRCDIR/qwt_event_pattern.cpp \
$$QWTSRCDIR/qwt_graphic.cpp \
$$QWTSRCDIR/qwt_interval.cpp \
$$QWTSRCDIR/qwt_knob.cpp \
$$QWTSRCDIR/qwt_legend.cpp \
$$QWTSRCDIR/qwt_legend_data.cpp \
$$QWTSRCDIR/qwt_legend_label.cpp \
$$QWTSRCDIR/qwt_magnifier.cpp \
$$QWTSRCDIR/qwt_math.cpp \
$$QWTSRCDIR/qwt_null_paintdevice.cpp \
$$QWTSRCDIR/qwt_painter.cpp \
$$QWTSRCDIR/qwt_painter_command.cpp \
$$QWTSRCDIR/qwt_panner.cpp \
$$QWTSRCDIR/qwt_picker.cpp \
$$QWTSRCDIR/qwt_picker_machine.cpp \
$$QWTSRCDIR/qwt_pixel_matrix.cpp \
$$QWTSRCDIR/qwt_plot.cpp \
$$QWTSRCDIR/qwt_plot_axis.cpp \
$$QWTSRCDIR/qwt_plot_canvas.cpp \
$$QWTSRCDIR/qwt_plot_curve.cpp \
$$QWTSRCDIR/qwt_plot_dict.cpp \
$$QWTSRCDIR/qwt_plot_grid.cpp \
$$QWTSRCDIR/qwt_plot_item.cpp \
$$QWTSRCDIR/qwt_plot_layout.cpp \
$$QWTSRCDIR/qwt_plot_magnifier.cpp \
$$QWTSRCDIR/qwt_plot_marker.cpp \
$$QWTSRCDIR/qwt_plot_panner.cpp \
$$QWTSRCDIR/qwt_plot_picker.cpp \
$$QWTSRCDIR/qwt_plot_rasteritem.cpp \
$$QWTSRCDIR/qwt_plot_scaleitem.cpp \
$$QWTSRCDIR/qwt_plot_seriesitem.cpp \
$$QWTSRCDIR/qwt_plot_spectrogram.cpp \
$$QWTSRCDIR/qwt_plot_svgitem.cpp \
$$QWTSRCDIR/qwt_plot_xml.cpp \
$$QWTSRCDIR/qwt_plot_zoomer.cpp \
$$QWTSRCDIR/qwt_point_mapper.cpp \
$$QWTSRCDIR/qwt_point_data.cpp \
$$QWTSRCDIR/qwt_raster_data.cpp \
$$QWTSRCDIR/qwt_round_scale_draw.cpp \
$$QWTSRCDIR/qwt_scale_div.cpp \
$$QWTSRCDIR/qwt_scale_draw.cpp \
$$QWTSRCDIR/qwt_scale_engine.cpp \
$$QWTSRCDIR/qwt_scale_map.cpp \
$$QWTSRCDIR/qwt_scale_widget.cpp \
$$QWTSRCDIR/qwt_series_data.cpp \
$$QWTSRCDIR/qwt_slider.cpp \
$$QWTSRCDIR/qwt_spline.cpp \
$$QWTSRCDIR/qwt_symbol.cpp \
$$QWTSRCDIR/qwt_text.cpp \
$$QWTSRCDIR/qwt_text_engine.cpp \
$$QWTSRCDIR/qwt_text_label.cpp \
$$QWTSRCDIR/qwt_thermo.cpp \
$$QWTSRCDIR/qwt_transform.cpp \
$$QWTSRCDIR/qwt_wheel.cpp \
$$QWTSRCDIR/qwt_widget_overlay.cpp
/* -*- 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
*****************************************************************************/
#include "qwt_abstract_legend.h"
/*!
Constructor
\param parent Parent widget
*/
QwtAbstractLegend::QwtAbstractLegend( QWidget *parent ):
QFrame( parent )
{
}
//! Destructor
QwtAbstractLegend::~QwtAbstractLegend()
{
}
/*!
Return the extent, that is needed for elements to scroll
the legend ( usually scrollbars ),
\param orientation Orientation
\return Extent of the corresponding scroll element
*/
int QwtAbstractLegend::scrollExtent( Qt::Orientation orientation ) const
{
Q_UNUSED( orientation );
return 0;
}
/* -*- 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_ABSTRACT_LEGEND_H
#define QWT_ABSTRACT_LEGEND_H
#include "qwt_global.h"
#include "qwt_legend_data.h"
#include <qframe.h>
#include <qlist.h>
class QVariant;
/*!
\brief Abstract base class for legend widgets
Legends, that need to be under control of the QwtPlot layout system
need to be derived from QwtAbstractLegend.
\note Other type of legends can be implemented by connecting to
the QwtPlot::legendDataChanged() signal. But as these legends
are unknown to the plot layout system the layout code
( on screen and for QwtPlotRenderer ) need to be organized
in application code.
\sa QwtLegend
*/
class QWT_EXPORT QwtAbstractLegend : public QFrame
{
Q_OBJECT
public:
explicit QwtAbstractLegend( QWidget *parent = NULL );
virtual ~QwtAbstractLegend();
/*!
Render the legend into a given rectangle.
\param painter Painter
\param rect Bounding rectangle
\param fillBackground When true, fill rect with the widget background
\sa renderLegend() is used by QwtPlotRenderer
*/
virtual void renderLegend( QPainter *painter,
const QRectF &rect, bool fillBackground ) const = 0;
//! \return True, when no plot item is inserted
virtual bool isEmpty() const = 0;
virtual int scrollExtent( Qt::Orientation ) const;
public Q_SLOTS:
/*!
\brief Update the entries for a plot item
\param itemInfo Info about an item
\param data List of legend entry attributes for the item
*/
virtual void updateLegend( const QVariant &itemInfo,
const QList<QwtLegendData> &data ) = 0;
};
#endif
This diff is collapsed.
......@@ -11,50 +11,85 @@
#define QWT_ABSTRACT_SCALE_H
#include "qwt_global.h"
#include <qwidget.h>
class QwtScaleEngine;
class QwtAbstractScaleDraw;
class QwtScaleDiv;
class QwtScaleMap;
class QwtDoubleInterval;
class QwtInterval;
/*!
\brief An abstract base class for classes containing a scale
\brief An abstract base class for widgets having a scale
QwtAbstractScale is used to provide classes with a QwtScaleDraw,
and a QwtScaleDiv. The QwtScaleDiv might be set explicitely
or calculated by a QwtScaleEngine.
The scale of an QwtAbstractScale is determined by a QwtScaleDiv
definition, that contains the boundaries and the ticks of the scale.
The scale is painted using a QwtScaleDraw object.
The scale division might be assigned explicitly - but usually
it is calculated from the boundaries using a QwtScaleEngine.
The scale engine also decides the type of transformation of the scale
( linear, logarithmic ... ).
*/
class QWT_EXPORT QwtAbstractScale
class QWT_EXPORT QwtAbstractScale: public QWidget
{
Q_OBJECT
Q_PROPERTY( double lowerBound READ lowerBound WRITE setLowerBound )
Q_PROPERTY( double upperBound READ upperBound WRITE setUpperBound )
Q_PROPERTY( int scaleMaxMajor READ scaleMaxMajor WRITE setScaleMaxMajor )
Q_PROPERTY( int scaleMaxMinor READ scaleMaxMinor WRITE setScaleMaxMinor )
Q_PROPERTY( double scaleStepSize READ scaleStepSize WRITE setScaleStepSize )
public:
QwtAbstractScale();
QwtAbstractScale( QWidget *parent = NULL );
virtual ~QwtAbstractScale();
void setScale(double vmin, double vmax, double step = 0.0);
void setScale(const QwtDoubleInterval &, double step = 0.0);
void setScale(const QwtScaleDiv &s);
void setScale( double lowerBound, double upperBound );
void setScale( const QwtInterval & );
void setScale( const QwtScaleDiv & );
const QwtScaleDiv& scaleDiv() const;
void setAutoScale();
bool autoScale() const;
void setLowerBound( double value );
double lowerBound() const;
void setScaleMaxMajor( int ticks);
void setUpperBound( double value );
double upperBound() const;
void setScaleStepSize( double stepSize );
double scaleStepSize() const;
void setScaleMaxMajor( int ticks );
int scaleMaxMinor() const;
void setScaleMaxMinor( int ticks);
void setScaleMaxMinor( int ticks );
int scaleMaxMajor() const;
void setScaleEngine(QwtScaleEngine *);
void setScaleEngine( QwtScaleEngine * );
const QwtScaleEngine *scaleEngine() const;
QwtScaleEngine *scaleEngine();
int transform( double ) const;
double invTransform( int ) const;
bool isInverted() const;
double minimum() const;
double maximum() const;
const QwtScaleMap &scaleMap() const;
protected:
void rescale(double vmin, double vmax, double step = 0.0);
void rescale( double lowerBound,
double upperBound, double stepSize );
void setAbstractScaleDraw( QwtAbstractScaleDraw * );
void setAbstractScaleDraw(QwtAbstractScaleDraw *);
const QwtAbstractScaleDraw *abstractScaleDraw() const;
QwtAbstractScaleDraw *abstractScaleDraw();
......
This diff is collapsed.
......@@ -14,15 +14,10 @@
#include "qwt_scale_div.h"
#include "qwt_text.h"
#if QT_VERSION < 0x040000
class QColorGroup;
#else
class QPalette;
#endif
class QPainter;
class QFont;
class QwtScaleTransformation;
class QwtTransform;
class QwtScaleMap;
/*!
......@@ -31,8 +26,7 @@ class QwtScaleMap;
QwtAbstractScaleDraw can be used to draw linear or logarithmic scales.
After a scale division has been specified as a QwtScaleDiv object
using QwtAbstractScaleDraw::setScaleDiv(const QwtScaleDiv &s),
the scale can be drawn with the QwtAbstractScaleDraw::draw() member.
using setScaleDiv(), the scale can be drawn with the draw() member.
*/
class QWT_EXPORT QwtAbstractScaleDraw
{
......@@ -40,66 +34,66 @@ public:
/*!
Components of a scale
\sa enableComponent(), hasComponent
*/
enum ScaleComponent
{
//! Backbone = the line where the ticks are located
Backbone = 0x01,
- Backbone
- Ticks
- Labels
\sa QwtAbstractScaleDraw::enableComponent,
QwtAbstractScaleDraw::hasComponent
*/
//! Ticks
Ticks = 0x02,
enum ScaleComponent {
Backbone = 1,
Ticks = 2,
Labels = 4
//! Labels
Labels = 0x04
};
//! Scale components
typedef QFlags<ScaleComponent> ScaleComponents;
QwtAbstractScaleDraw();
QwtAbstractScaleDraw( const QwtAbstractScaleDraw & );
virtual ~QwtAbstractScaleDraw();
QwtAbstractScaleDraw &operator=(const QwtAbstractScaleDraw &);
void setScaleDiv(const QwtScaleDiv &s);
void setScaleDiv( const QwtScaleDiv &s );
const QwtScaleDiv& scaleDiv() const;
void setTransformation(QwtScaleTransformation *);
const QwtScaleMap &map() const;
void setTransformation( QwtTransform * );
const QwtScaleMap &scaleMap() const;
QwtScaleMap &scaleMap();
void enableComponent(ScaleComponent, bool enable = true);
bool hasComponent(ScaleComponent) const;
void enableComponent( ScaleComponent, bool enable = true );
bool hasComponent( ScaleComponent ) const;
void setTickLength(QwtScaleDiv::TickType, int length);
int tickLength(QwtScaleDiv::TickType) const;
int majTickLength() const;
void setTickLength( QwtScaleDiv::TickType, double length );
double tickLength( QwtScaleDiv::TickType ) const;
double maxTickLength() const;
void setSpacing(int margin);
int spacing() const;
void setSpacing( double margin );
double spacing() const;
#if QT_VERSION < 0x040000
virtual void draw(QPainter *, const QColorGroup &) const;
#else
virtual void draw(QPainter *, const QPalette &) const;
#endif
void setPenWidth( int width );
int penWidth() const;
virtual void draw( QPainter *, const QPalette & ) const;
virtual QwtText label(double) const;
virtual QwtText label( double ) const;
/*!
Calculate the extent
The extent is the distcance from the baseline to the outermost
The extent is the distance from the baseline to the outermost
pixel of the scale draw in opposite to its orientation.
It is at least minimumExtent() pixels.
\param font Font used for drawing the tick labels
\return Number of pixels
\sa setMinimumExtent(), minimumExtent()
*/
virtual int extent(const QPen &, const QFont &) const = 0;
virtual double extent( const QFont &font ) const = 0;
void setMinimumExtent(int);
int minimumExtent() const;
QwtScaleMap &scaleMap();
void setMinimumExtent( double );
double minimumExtent() const;
protected:
/*!
......@@ -107,11 +101,11 @@ protected:
\param painter Painter
\param value Value of the tick
\param len Lenght of the tick
\param len Length of the tick
\sa drawBackbone(), drawLabel()
*/
virtual void drawTick(QPainter *painter, double value, int len) const = 0;
virtual void drawTick( QPainter *painter, double value, double len ) const = 0;
/*!
Draws the baseline of the scale
......@@ -119,7 +113,7 @@ protected:
\sa drawTick(), drawLabel()
*/
virtual void drawBackbone(QPainter *painter) const = 0;
virtual void drawBackbone( QPainter *painter ) const = 0;
/*!
Draws the label for a major scale tick
......@@ -127,19 +121,21 @@ protected:
\param painter Painter
\param value Value
\sa drawTick, drawBackbone
\sa drawTick(), drawBackbone()
*/
virtual void drawLabel(QPainter *painter, double value) const = 0;
virtual void drawLabel( QPainter *painter, double value ) const = 0;
void invalidateCache();
const QwtText &tickLabel(const QFont &, double value) const;
const QwtText &tickLabel( const QFont &, double value ) const;
private:
int operator==(const QwtAbstractScaleDraw &) const;
int operator!=(const QwtAbstractScaleDraw &) const;
QwtAbstractScaleDraw( const QwtAbstractScaleDraw & );
QwtAbstractScaleDraw &operator=( const QwtAbstractScaleDraw & );
class PrivateData;
PrivateData *d_data;
};
Q_DECLARE_OPERATORS_FOR_FLAGS( QwtAbstractScaleDraw::ScaleComponents )
#endif
This diff is collapsed.
......@@ -10,112 +10,95 @@
#ifndef QWT_ABSTRACT_SLIDER_H
#define QWT_ABSTRACT_SLIDER_H
#include <qwidget.h>
#include "qwt_global.h"
#include "qwt_double_range.h"
#include "qwt_abstract_scale.h"
/*!
\brief An abstract base class for slider widgets
QwtAbstractSlider is a base class for
slider widgets. It handles mouse events
and updates the slider's value accordingly. Derived classes
only have to implement the getValue() and
getScrollMode() members, and should react to a
valueChange(), which normally requires repainting.
\brief An abstract base class for slider widgets with a scale
A slider widget displays a value according to a scale.
The class is designed as a common super class for widgets like
QwtKnob, QwtDial and QwtSlider.
When the slider is nor readOnly() its value can be modified
by keyboard, mouse and wheel inputs.
The range of the slider is divided into a number of steps from
which the value increments according to user inputs depend.
Only for linear scales the number of steps correspond with
a fixed step size.
*/
class QWT_EXPORT QwtAbstractSlider : public QWidget, public QwtDoubleRange
class QWT_EXPORT QwtAbstractSlider: public QwtAbstractScale
{
Q_OBJECT
Q_PROPERTY( double value READ value WRITE setValue )
Q_PROPERTY( uint totalSteps READ totalSteps WRITE setTotalSteps )
Q_PROPERTY( uint singleSteps READ singleSteps WRITE setSingleSteps )
Q_PROPERTY( uint pageSteps READ pageSteps WRITE setPageSteps )
Q_PROPERTY( bool stepAlignment READ stepAlignment WRITE setStepAlignment )
Q_PROPERTY( bool readOnly READ isReadOnly WRITE setReadOnly )
Q_PROPERTY( bool valid READ isValid WRITE setValid )
Q_PROPERTY( double mass READ mass WRITE setMass )
#ifndef Q_MOC_RUN // Qt3 moc
#define QWT_PROPERTY Q_PROPERTY
Q_PROPERTY( Orientation orientation
READ orientation WRITE setOrientation )
#else // Qt4 moc
// MOC_SKIP_BEGIN
Q_PROPERTY( Qt::Orientation orientation
READ orientation WRITE setOrientation )
// MOC_SKIP_END
#endif
Q_PROPERTY( bool tracking READ isTracking WRITE setTracking )
Q_PROPERTY( bool wrapping READ wrapping WRITE setWrapping )
Q_PROPERTY( bool invertedControls READ invertedControls WRITE setInvertedControls )
public:
/*!
Scroll mode
\sa getScrollMode()
*/
enum ScrollMode {
ScrNone,
ScrMouse,
ScrTimer,
ScrDirect,
ScrPage
};
explicit QwtAbstractSlider(Qt::Orientation, QWidget *parent = NULL);
explicit QwtAbstractSlider( QWidget *parent = NULL );
virtual ~QwtAbstractSlider();
void setUpdateTime(int t);
void stopMoving();
void setTracking(bool enable);
void setValid( bool );
bool isValid() const;
virtual void setMass(double val);
virtual double mass() const;
double value() const;
#if QT_VERSION >= 0x040000
virtual void setOrientation(Qt::Orientation o);
Qt::Orientation orientation() const;
#else
virtual void setOrientation(Orientation o);
Orientation orientation() const;
#endif
void setWrapping( bool );
bool wrapping() const;
bool isReadOnly() const;
void setTotalSteps( uint );
uint totalSteps() const;
/*
Wrappers for QwtDblRange::isValid/QwtDblRange::setValid made
to be available as Q_PROPERTY in the designer.
*/
void setSingleSteps( uint );
uint singleSteps() const;
/*!
\sa QwtDblRange::isValid
*/
bool isValid() const {
return QwtDoubleRange::isValid();
}
void setPageSteps( uint );
uint pageSteps() const;
/*!
\sa QwtDblRange::isValid
*/
void setValid(bool valid) {
QwtDoubleRange::setValid(valid);
}
void setStepAlignment( bool );
bool stepAlignment() const;
public slots:
virtual void setValue(double val);
virtual void fitValue(double val);
virtual void incValue(int steps);
void setTracking( bool );
bool isTracking() const;
void setReadOnly( bool );
bool isReadOnly() const;
virtual void setReadOnly(bool);
void setInvertedControls( bool );
bool invertedControls() const;
signals:
public Q_SLOTS:
void setValue( double val );
Q_SIGNALS:
/*!
\brief Notify a change of value.
In the default setting
(tracking enabled), this signal will be emitted every
time the value changes ( see setTracking() ).
\param value new value
When tracking is enabled (default setting),
this signal will be emitted every time the value changes.
\param value New value
\sa setTracking(), sliderMoved()
*/
void valueChanged(double value);
void valueChanged( double value );
/*!
This signal is emitted when the user presses the
movable part of the slider (start ScrMouse Mode).
movable part of the slider.
*/
void sliderPressed();
......@@ -123,70 +106,59 @@ signals:
This signal is emitted when the user releases the
movable part of the slider.
*/
void sliderReleased();
/*!
This signal is emitted when the user moves the
slider with the mouse.
\param value new value
\param value New value
\sa valueChanged()
*/
void sliderMoved(double value);
void sliderMoved( double value );
protected:
virtual void setPosition(const QPoint &);
virtual void valueChange();
virtual void timerEvent(QTimerEvent *e);
virtual void mousePressEvent(QMouseEvent *e);
virtual void mouseReleaseEvent(QMouseEvent *e);
virtual void mouseMoveEvent(QMouseEvent *e);
virtual void keyPressEvent(QKeyEvent *e);
virtual void wheelEvent(QWheelEvent *e);
virtual void mousePressEvent( QMouseEvent * );
virtual void mouseReleaseEvent( QMouseEvent * );
virtual void mouseMoveEvent( QMouseEvent * );
virtual void keyPressEvent( QKeyEvent * );
virtual void wheelEvent( QWheelEvent * );
/*!
\brief Determine the value corresponding to a specified poind
\brief Determine what to do when the user presses a mouse button.
\param pos Mouse position
This is an abstract virtual function which is called when
the user presses or releases a mouse button or moves the
mouse. It has to be implemented by the derived class.
\param p point
\retval True, when pos is a valid scroll position
\sa scrolledTo()
*/
virtual double getValue(const QPoint & p) = 0;
virtual bool isScrollPosition( const QPoint &pos ) const = 0;
/*!
\brief Determine what to do when the user presses a mouse button.
\brief Determine the value for a new position of the
movable part of the slider
This function is abstract and has to be implemented by derived classes.
It is called on a mousePress event. The derived class can determine
what should happen next in dependence of the position where the mouse
was pressed by returning scrolling mode and direction. QwtAbstractSlider
knows the following modes:<dl>
<dt>QwtAbstractSlider::ScrNone
<dd>Scrolling switched off. Don't change the value.
<dt>QwtAbstractSlider::ScrMouse
<dd>Change the value while the user keeps the
button pressed and moves the mouse.
<dt>QwtAbstractSlider::ScrTimer
<dd>Automatic scrolling. Increment the value
in the specified direction as long as
the user keeps the button pressed.
<dt>QwtAbstractSlider::ScrPage
<dd>Automatic scrolling. Same as ScrTimer, but
increment by page size.</dl>
\param p point where the mouse was pressed
\retval scrollMode The scrolling mode
\retval direction direction: 1, 0, or -1.
\param pos Mouse position
\return Value for the mouse position
\sa isScrollPosition()
*/
virtual void getScrollMode( const QPoint &p,
int &scrollMode, int &direction) = 0;
virtual double scrolledTo( const QPoint &pos ) const = 0;
void incrementValue( int numSteps );
void setMouseOffset(double);
double mouseOffset() const;
virtual void scaleChange();
protected:
virtual void sliderChange();
int scrollMode() const;
double incrementedValue(
double value, int stepCount ) const;
private:
void buttonReleased();
double alignedValue( double ) const;
double boundedValue( double ) const;
class PrivateData;
PrivateData *d_data;
......
......@@ -8,69 +8,94 @@
*****************************************************************************/
#include "qwt_analog_clock.h"
#include "qwt_round_scale_draw.h"
#include <qmath.h>
#include <qlocale.h>
/*!
Constructor
\param parent Parent widget
*/
QwtAnalogClock::QwtAnalogClock(QWidget *parent):
QwtDial(parent)
class QwtAnalogClockScaleDraw: public QwtRoundScaleDraw
{
initClock();
}
public:
QwtAnalogClockScaleDraw()
{
setSpacing( 8 );
enableComponent( QwtAbstractScaleDraw::Backbone, false );
setTickLength( QwtScaleDiv::MinorTick, 2 );
setTickLength( QwtScaleDiv::MediumTick, 4 );
setTickLength( QwtScaleDiv::MajorTick, 8 );
setPenWidth( 1 );
}
virtual QwtText label( double value ) const
{
if ( qFuzzyCompare( value + 1.0, 1.0 ) )
value = 60.0 * 60.0 * 12.0;
return QLocale().toString( qRound( value / ( 60.0 * 60.0 ) ) );
}
};
#if QT_VERSION < 0x040000
/*!
Constructor
\param parent Parent widget
\param name Object name
*/
QwtAnalogClock::QwtAnalogClock(QWidget* parent, const char *name):
QwtDial(parent, name)
QwtAnalogClock::QwtAnalogClock( QWidget *parent ):
QwtDial( parent )
{
initClock();
}
#endif
setWrapping( true );
setReadOnly( true );
void QwtAnalogClock::initClock()
{
setWrapping(true);
setReadOnly(true);
setOrigin( 270.0 );
setScaleDraw( new QwtAnalogClockScaleDraw() );
setTotalSteps( 60 );
const int secondsPerHour = 60.0 * 60.0;
setOrigin(270.0);
setRange(0.0, 60.0 * 60.0 * 12.0); // seconds
setScale(-1, 5, 60.0 * 60.0);
QList<double> majorTicks;
QList<double> minorTicks;
setScaleOptions(ScaleTicks | ScaleLabel);
setScaleTicks(1, 0, 8);
scaleDraw()->setSpacing(8);
for ( int i = 0; i < 12; i++ )
{
majorTicks += i * secondsPerHour;
QColor knobColor =
#if QT_VERSION < 0x040000
palette().color(QPalette::Active, QColorGroup::Text);
#else
palette().color(QPalette::Active, QPalette::Text);
#endif
knobColor = knobColor.dark(120);
for ( int j = 1; j < 5; j++ )
minorTicks += i * secondsPerHour + j * secondsPerHour / 5.0;
}
QwtScaleDiv scaleDiv;
scaleDiv.setInterval( 0.0, 12.0 * secondsPerHour );
scaleDiv.setTicks( QwtScaleDiv::MajorTick, majorTicks );
scaleDiv.setTicks( QwtScaleDiv::MinorTick, minorTicks );
setScale( scaleDiv );
QColor knobColor = palette().color( QPalette::Active, QPalette::Text );
knobColor = knobColor.dark( 120 );
QColor handColor;
int width;
for ( int i = 0; i < NHands; i++ ) {
if ( i == SecondHand ) {
for ( int i = 0; i < NHands; i++ )
{
if ( i == SecondHand )
{
width = 2;
handColor = knobColor.dark(120);
} else {
handColor = knobColor.dark( 120 );
}
else
{
width = 8;
handColor = knobColor;
}
QwtDialSimpleNeedle *hand = new QwtDialSimpleNeedle(
QwtDialSimpleNeedle::Arrow, true, handColor, knobColor);
hand->setWidth(width);
QwtDialSimpleNeedle::Arrow, true, handColor, knobColor );
hand->setWidth( width );
d_hand[i] = NULL;
setHand((Hand)i, hand);
setHand( static_cast<Hand>( i ), hand );
}
}
......@@ -82,24 +107,25 @@ QwtAnalogClock::~QwtAnalogClock()
}
/*!
Nop method, use setHand instead
\sa QwtAnalogClock::setHand
Nop method, use setHand() instead
\sa setHand()
*/
void QwtAnalogClock::setNeedle(QwtDialNeedle *)
void QwtAnalogClock::setNeedle( QwtDialNeedle * )
{
// no op
return;
}
/*!
Set a clockhand
Set a clock hand
\param hand Specifies the type of hand
\param needle Hand
\sa QwtAnalogClock::hand()
\sa hand()
*/
void QwtAnalogClock::setHand(Hand hand, QwtDialNeedle *needle)
void QwtAnalogClock::setHand( Hand hand, QwtDialNeedle *needle )
{
if ( hand >= 0 || hand < NHands ) {
if ( hand >= 0 && hand < NHands )
{
delete d_hand[hand];
d_hand[hand] = needle;
}
......@@ -108,9 +134,9 @@ void QwtAnalogClock::setHand(Hand hand, QwtDialNeedle *needle)
/*!
\return Clock hand
\param hd Specifies the type of hand
\sa QwtAnalogClock::setHand
\sa setHand()
*/
QwtDialNeedle *QwtAnalogClock::hand(Hand hd)
QwtDialNeedle *QwtAnalogClock::hand( Hand hd )
{
if ( hd < 0 || hd >= NHands )
return NULL;
......@@ -121,81 +147,75 @@ QwtDialNeedle *QwtAnalogClock::hand(Hand hd)
/*!
\return Clock hand
\param hd Specifies the type of hand
\sa QwtAnalogClock::setHand
\sa setHand()
*/
const QwtDialNeedle *QwtAnalogClock::hand(Hand hd) const
const QwtDialNeedle *QwtAnalogClock::hand( Hand hd ) const
{
return ((QwtAnalogClock *)this)->hand(hd);
return const_cast<QwtAnalogClock *>( this )->hand( hd );
}
/*!
\brief Set the current time
This is the same as QwtAnalogClock::setTime(), but Qt < 3.0
can't handle default parameters for slots.
*/
void QwtAnalogClock::setCurrentTime()
{
setTime(QTime::currentTime());
setTime( QTime::currentTime() );
}
/*!
Set a time
\param time Time to display
*/
void QwtAnalogClock::setTime(const QTime &time)
{
if ( time.isValid() ) {
setValue((time.hour() % 12) * 60.0 * 60.0
+ time.minute() * 60.0 + time.second());
} else
setValid(false);
}
/*!
Find the scale label for a given value
\param value Value
\return Label
*/
QwtText QwtAnalogClock::scaleLabel(double value) const
void QwtAnalogClock::setTime( const QTime &time )
{
if ( value == 0.0 )
value = 60.0 * 60.0 * 12.0;
return QString::number(int(value / (60.0 * 60.0)));
if ( time.isValid() )
{
setValue( ( time.hour() % 12 ) * 60.0 * 60.0
+ time.minute() * 60.0 + time.second() );
}
else
setValid( false );
}
/*!
\brief Draw the needle
A clock has no single needle but three hands instead. drawNeedle
A clock has no single needle but three hands instead. drawNeedle()
translates value() into directions for the hands and calls
drawHand().
\param painter Painter
\param center Center of the clock
\param radius Maximum length for the hands
\param direction Dummy, not used.
\param cg ColorGroup
\param dir Dummy, not used.
\param colorGroup ColorGroup
\sa QwtAnalogClock::drawHand()
\sa drawHand()
*/
void QwtAnalogClock::drawNeedle(QPainter *painter, const QPoint &center,
int radius, double, QPalette::ColorGroup cg) const
void QwtAnalogClock::drawNeedle( QPainter *painter, const QPointF &center,
double radius, double dir, QPalette::ColorGroup colorGroup ) const
{
if ( isValid() ) {
const double hours = value() / (60.0 * 60.0);
const double minutes = (value() - (int)hours * 60.0 * 60.0) / 60.0;
const double seconds = value() - (int)hours * 60.0 * 60.0
- (int)minutes * 60.0;
drawHand(painter, HourHand, center, radius,
360.0 - (origin() + 360.0 * hours / 12.0), cg);
drawHand(painter, MinuteHand, center, radius,
360.0 - (origin() + 360.0 * minutes / 60.0), cg);
drawHand(painter, SecondHand, center, radius,
360.0 - (origin() + 360.0 * seconds / 60.0), cg);
Q_UNUSED( dir );
if ( isValid() )
{
const double hours = value() / ( 60.0 * 60.0 );
const double minutes =
( value() - qFloor(hours) * 60.0 * 60.0 ) / 60.0;
const double seconds = value() - qFloor(hours) * 60.0 * 60.0
- qFloor(minutes) * 60.0;
double angle[NHands];
angle[HourHand] = 360.0 * hours / 12.0;
angle[MinuteHand] = 360.0 * minutes / 60.0;
angle[SecondHand] = 360.0 * seconds / 60.0;
for ( int hand = 0; hand < NHands; hand++ )
{
const double d = 360.0 - angle[hand] - origin();
drawHand( painter, static_cast<Hand>( hand ),
center, radius, d, colorGroup );
}
}
}
......@@ -209,15 +229,16 @@ void QwtAnalogClock::drawNeedle(QPainter *painter, const QPoint &center,
\param direction Direction of the hand in degrees, counter clockwise
\param cg ColorGroup
*/
void QwtAnalogClock::drawHand(QPainter *painter, Hand hd,
const QPoint &center, int radius, double direction,
QPalette::ColorGroup cg) const
void QwtAnalogClock::drawHand( QPainter *painter, Hand hd,
const QPointF &center, double radius, double direction,
QPalette::ColorGroup cg ) const
{
const QwtDialNeedle *needle = hand(hd);
if ( needle ) {
const QwtDialNeedle *needle = hand( hd );
if ( needle )
{
if ( hd == HourHand )
radius = qRound(0.8 * radius);
radius = qRound( 0.8 * radius );
needle->draw(painter, center, radius, direction, cg);
needle->draw( painter, center, radius, direction, cg );
}
}
......@@ -10,10 +10,10 @@
#ifndef QWT_ANALOG_CLOCK_H
#define QWT_ANALOG_CLOCK_H
#include <qdatetime.h>
#include "qwt_global.h"
#include "qwt_dial.h"
#include "qwt_dial_needle.h"
#include <qdatetime.h>
/*!
\brief An analog clock
......@@ -21,7 +21,8 @@
\image html analogclock.png
\par Example
\verbatim #include <qwt_analog_clock.h>
\code
#include <qwt_analog_clock.h>
QwtAnalogClock *clock = new QwtAnalogClock(...);
clock->scaleDraw()->setPenWidth(3);
......@@ -34,10 +35,7 @@
timer->connect(timer, SIGNAL(timeout()), clock, SLOT(setCurrentTime()));
timer->start(1000);
\endverbatim
Qwt is missing a set of good looking hands.
Contributions are very welcome.
\endcode
\note The examples/dials example shows how to use QwtAnalogClock.
*/
......@@ -51,41 +49,43 @@ public:
Hand type
\sa setHand(), hand()
*/
enum Hand {
enum Hand
{
//! Needle displaying the seconds
SecondHand,
//! Needle displaying the minutes
MinuteHand,
//! Needle displaying the hours
HourHand,
//! Number of needles
NHands
};
explicit QwtAnalogClock(QWidget* parent = NULL);
#if QT_VERSION < 0x040000
explicit QwtAnalogClock(QWidget* parent, const char *name);
#endif
explicit QwtAnalogClock( QWidget* parent = NULL );
virtual ~QwtAnalogClock();
virtual void setHand(Hand, QwtDialNeedle *);
const QwtDialNeedle *hand(Hand) const;
QwtDialNeedle *hand(Hand);
void setHand( Hand, QwtDialNeedle * );
public slots:
const QwtDialNeedle *hand( Hand ) const;
QwtDialNeedle *hand( Hand );
public Q_SLOTS:
void setCurrentTime();
void setTime(const QTime & = QTime::currentTime());
void setTime( const QTime & );
protected:
virtual QwtText scaleLabel(double) const;
virtual void drawNeedle(QPainter *, const QPoint &,
int radius, double direction, QPalette::ColorGroup) const;
virtual void drawNeedle( QPainter *, const QPointF &,
double radius, double direction, QPalette::ColorGroup ) const;
virtual void drawHand(QPainter *, Hand, const QPoint &,
int radius, double direction, QPalette::ColorGroup) const;
virtual void drawHand( QPainter *, Hand, const QPointF &,
double radius, double direction, QPalette::ColorGroup ) const;
private:
virtual void setNeedle(QwtDialNeedle *);
void initClock();
// use setHand instead
void setNeedle( QwtDialNeedle * );
QwtDialNeedle *d_hand[NHands];
};
......
This diff is collapsed.
......@@ -10,8 +10,8 @@
#ifndef QWT_ARROW_BUTTON_H
#define QWT_ARROW_BUTTON_H
#include <qpushbutton.h>
#include "qwt_global.h"
#include <qpushbutton.h>
/*!
\brief Arrow Button
......@@ -23,7 +23,7 @@
class QWT_EXPORT QwtArrowButton : public QPushButton
{
public:
explicit QwtArrowButton (int num, Qt::ArrowType, QWidget *parent = NULL);
explicit QwtArrowButton ( int num, Qt::ArrowType, QWidget *parent = NULL );
virtual ~QwtArrowButton();
Qt::ArrowType arrowType() const;
......@@ -33,18 +33,16 @@ public:
virtual QSize minimumSizeHint() const;
protected:
#if QT_VERSION >= 0x040000
virtual void paintEvent(QPaintEvent *event);
#endif
virtual void paintEvent( QPaintEvent *event );
virtual void drawButtonLabel(QPainter *p);
virtual void drawArrow(QPainter *,
const QRect &, Qt::ArrowType) const;
virtual void drawButtonLabel( QPainter *p );
virtual void drawArrow( QPainter *,
const QRect &, Qt::ArrowType ) const;
virtual QRect labelRect() const;
virtual QSize arrowSize(Qt::ArrowType,
const QSize &boundingSize) const;
virtual QSize arrowSize( Qt::ArrowType,
const QSize &boundingSize ) const;
virtual void keyPressEvent(QKeyEvent *);
virtual void keyPressEvent( QKeyEvent * );
private:
class PrivateData;
......
This diff is collapsed.
......@@ -11,27 +11,30 @@
#define QWT_CLIPPER_H
#include "qwt_global.h"
#include "qwt_array.h"
#include "qwt_polygon.h"
#include "qwt_double_rect.h"
#include "qwt_double_interval.h"
#include "qwt_interval.h"
#include <qpolygon.h>
#include <qvector.h>
class QRect;
class QRectF;
/*!
\brief Some clipping algos
\brief Some clipping algorithms
*/
class QWT_EXPORT QwtClipper
{
public:
static QwtPolygon clipPolygon(const QRect &, const QwtPolygon &);
static QwtPolygonF clipPolygonF(const QwtDoubleRect &, const QwtPolygonF &);
static QPolygon clipPolygon( const QRect &,
const QPolygon &, bool closePolygon = false );
static QPolygon clipPolygon( const QRectF &,
const QPolygon &, bool closePolygon = false );
#if QT_VERSION >= 0x040000
static QwtArray<QwtDoubleInterval> clipCircle(
const QwtDoubleRect &, const QwtDoublePoint &, double radius);
#endif
static QPolygonF clipPolygonF( const QRectF &,
const QPolygonF &, bool closePolygon = false );
static QVector<QwtInterval> clipCircle(
const QRectF &, const QPointF &, double radius );
};
#endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/* -*- 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_COLUMN_SYMBOL_H
#define QWT_COLUMN_SYMBOL_H
#include "qwt_global.h"
#include "qwt_interval.h"
#include <qpen.h>
#include <qsize.h>
#include <qrect.h>
class QPainter;
class QPalette;
class QRect;
class QwtText;
/*!
\brief Directed rectangle representing bounding rectangle and orientation
of a column.
*/
class QWT_EXPORT QwtColumnRect
{
public:
//! Direction of the column
enum Direction
{
//! From left to right
LeftToRight,
//! From right to left
RightToLeft,
//! From bottom to top
BottomToTop,
//! From top to bottom
TopToBottom
};
//! Build an rectangle with invalid intervals directed BottomToTop.
QwtColumnRect():
direction( BottomToTop )
{
}
//! \return A normalized QRect built from the intervals
QRectF toRect() const
{
QRectF r( hInterval.minValue(), vInterval.minValue(),
hInterval.maxValue() - hInterval.minValue(),
vInterval.maxValue() - vInterval.minValue() );
r = r.normalized();
if ( hInterval.borderFlags() & QwtInterval::ExcludeMinimum )
r.adjust( 1, 0, 0, 0 );
if ( hInterval.borderFlags() & QwtInterval::ExcludeMaximum )
r.adjust( 0, 0, -1, 0 );
if ( vInterval.borderFlags() & QwtInterval::ExcludeMinimum )
r.adjust( 0, 1, 0, 0 );
if ( vInterval.borderFlags() & QwtInterval::ExcludeMaximum )
r.adjust( 0, 0, 0, -1 );
return r;
}
//! \return Orientation
Qt::Orientation orientation() const
{
if ( direction == LeftToRight || direction == RightToLeft )
return Qt::Horizontal;
return Qt::Vertical;
}
//! Interval for the horizontal coordinates
QwtInterval hInterval;
//! Interval for the vertical coordinates
QwtInterval vInterval;
//! Direction
Direction direction;
};
//! A drawing primitive for columns
class QWT_EXPORT QwtColumnSymbol
{
public:
/*!
Style
\sa setStyle(), style()
*/
enum Style
{
//! No Style, the symbol draws nothing
NoStyle = -1,
/*!
The column is painted with a frame depending on the frameStyle()
and lineWidth() using the palette().
*/
Box,
/*!
Styles >= QwtColumnSymbol::UserStyle are reserved for derived
classes of QwtColumnSymbol that overload draw() with
additional application specific symbol types.
*/
UserStyle = 1000
};
/*!
Frame Style used in Box style().
\sa Style, setFrameStyle(), frameStyle(), setStyle(), setPalette()
*/
enum FrameStyle
{
//! No frame
NoFrame,
//! A plain frame style
Plain,
//! A raised frame style
Raised
};
public:
QwtColumnSymbol( Style = NoStyle );
virtual ~QwtColumnSymbol();
void setFrameStyle( FrameStyle style );
FrameStyle frameStyle() const;
void setLineWidth( int width );
int lineWidth() const;
void setPalette( const QPalette & );
const QPalette &palette() const;
void setStyle( Style );
Style style() const;
virtual void draw( QPainter *, const QwtColumnRect & ) const;
protected:
void drawBox( QPainter *, const QwtColumnRect & ) const;
private:
class PrivateData;
PrivateData* d_data;
};
#endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment