#include <KDChartMeasure>
font sizes.
Definition at line 57 of file KDChartMeasure.h.
Public Member Functions | |
qreal | calculatedValue (const QSizeF &autoSize, KDChartEnums::MeasureOrientation autoOrientation) const |
qreal | calculatedValue (const QObject *autoArea, KDChartEnums::MeasureOrientation autoOrientation) const |
The reference area must either be derived from AbstractArea or be derived from QWidget, so e.g. | |
KDChartEnums::MeasureCalculationMode | calculationMode () const |
Measure (const Measure &) | |
Measure (qreal value, KDChartEnums::MeasureCalculationMode mode=KDChartEnums::MeasureCalculationModeAuto, KDChartEnums::MeasureOrientation orientation=KDChartEnums::MeasureOrientationAuto) | |
Measure () | |
bool | operator!= (const Measure &other) const |
Measure & | operator= (const Measure &) |
bool | operator== (const Measure &) const |
const QObject * | referenceArea () const |
The returned reference area will either be derived from AbstractArea or be derived from QWidget. | |
KDChartEnums::MeasureOrientation | referenceOrientation () const |
void | setAbsoluteValue (qreal val) |
This is a convenience method for specifying a value, with implicitely setting the calculation mode to MeasureCalculationModeAbsolute. | |
void | setCalculationMode (KDChartEnums::MeasureCalculationMode mode) |
void | setReferenceArea (const QObject *area) |
The reference area must either be derived from AbstractArea or be derived from QWidget, so e.g. | |
void | setReferenceOrientation (KDChartEnums::MeasureOrientation orientation) |
void | setRelativeMode (const QObject *area, KDChartEnums::MeasureOrientation orientation) |
The reference area must either be derived from AbstractArea or be derived from QWidget, so e.g. | |
void | setValue (qreal val) |
const QSizeF | sizeOfArea (const QObject *area) const |
qreal | value () const |
KDChart::Measure::Measure | ( | ) |
Definition at line 43 of file KDChartMeasure.cpp.
00044 : mValue( 0.0 ), 00045 mMode( KDChartEnums::MeasureCalculationModeAuto ), 00046 mArea( 0 ), 00047 mOrientation( KDChartEnums::MeasureOrientationAuto ) 00048 { 00049 // this bloc left empty intentionally 00050 }
KDChart::Measure::Measure | ( | qreal | value, | |
KDChartEnums::MeasureCalculationMode | mode = KDChartEnums::MeasureCalculationModeAuto , |
|||
KDChartEnums::MeasureOrientation | orientation = KDChartEnums::MeasureOrientationAuto | |||
) |
Definition at line 52 of file KDChartMeasure.cpp.
00055 : mValue( value ), 00056 mMode( mode ), 00057 mArea( 0 ), 00058 mOrientation( orientation ) 00059 { 00060 // this bloc left empty intentionally 00061 }
KDChart::Measure::Measure | ( | const Measure & | r | ) |
qreal KDChart::Measure::calculatedValue | ( | const QSizeF & | autoSize, | |
KDChartEnums::MeasureOrientation | autoOrientation | |||
) | const |
Definition at line 85 of file KDChartMeasure.cpp.
References KDChartEnums::MeasureCalculationModeAbsolute, KDChartEnums::MeasureCalculationModeAuto, KDChartEnums::MeasureCalculationModeAutoArea, KDChartEnums::MeasureCalculationModeAutoOrientation, KDChartEnums::MeasureCalculationModeRelative, KDChartEnums::MeasureOrientationAuto, KDChartEnums::MeasureOrientationHorizontal, KDChartEnums::MeasureOrientationMaximum, KDChartEnums::MeasureOrientationMinimum, KDChartEnums::MeasureOrientationVertical, sizeOfArea(), and value().
00087 { 00088 if( mMode == KDChartEnums::MeasureCalculationModeAbsolute ){ 00089 return mValue; 00090 }else{ 00091 qreal value = 0.0; 00092 const QObject theAutoArea; 00093 const QObject* autoArea = &theAutoArea; 00094 const QObject* area = mArea ? mArea : autoArea; 00095 KDChartEnums::MeasureOrientation orientation = mOrientation; 00096 switch( mMode ){ 00097 case KDChartEnums::MeasureCalculationModeAuto: 00098 area = autoArea; 00099 orientation = autoOrientation; 00100 break; 00101 case KDChartEnums::MeasureCalculationModeAutoArea: 00102 area = autoArea; 00103 break; 00104 case KDChartEnums::MeasureCalculationModeAutoOrientation: 00105 orientation = autoOrientation; 00106 break; 00107 case KDChartEnums::MeasureCalculationModeAbsolute: // fall through intended 00108 case KDChartEnums::MeasureCalculationModeRelative: 00109 break; 00110 } 00111 if( area ){ 00112 QSizeF size; 00113 if( area == autoArea ) 00114 size = autoSize; 00115 else 00116 size = sizeOfArea( area ); 00117 //qDebug() << ( area == autoArea ) << "size" << size; 00118 qreal referenceValue; 00119 switch( orientation ){ 00120 case KDChartEnums::MeasureOrientationAuto: // fall through intended 00121 case KDChartEnums::MeasureOrientationMinimum: 00122 referenceValue = qMin( size.width(), size.height() ); 00123 break; 00124 case KDChartEnums::MeasureOrientationMaximum: 00125 referenceValue = qMax( size.width(), size.height() ); 00126 break; 00127 case KDChartEnums::MeasureOrientationHorizontal: 00128 referenceValue = size.width(); 00129 break; 00130 case KDChartEnums::MeasureOrientationVertical: 00131 referenceValue = size.height(); 00132 break; 00133 } 00134 value = mValue / 1000.0 * referenceValue; 00135 } 00136 return value; 00137 } 00138 }
qreal KDChart::Measure::calculatedValue | ( | const QObject * | autoArea, | |
KDChartEnums::MeasureOrientation | autoOrientation | |||
) | const |
The reference area must either be derived from AbstractArea or be derived from QWidget, so e.g.
it could be derived from AbstractAreaWidget too.
Definition at line 141 of file KDChartMeasure.cpp.
References sizeOfArea().
Referenced by KDChart::TextAttributes::calculatedFontSize(), and KDChart::RelativePosition::calculatedPoint().
00143 { 00144 return calculatedValue( sizeOfArea( autoArea ), autoOrientation); 00145 }
KDChartEnums::MeasureCalculationMode KDChart::Measure::calculationMode | ( | ) | const |
Definition at line 71 of file KDChartMeasure.h.
Referenced by operator<<(), operator=(), and operator==().
bool KDChart::Measure::operator!= | ( | const Measure & | other | ) | const |
Definition at line 127 of file KDChartMeasure.h.
References KDGantt::operator==().
00127 { return !operator==(other); }
Definition at line 72 of file KDChartMeasure.cpp.
References calculationMode(), referenceArea(), referenceOrientation(), and value().
00073 { 00074 if( this != &r ){ 00075 mValue = r.value(); 00076 mMode = r.calculationMode(); 00077 mArea = r.referenceArea(); 00078 mOrientation = r.referenceOrientation(); 00079 } 00080 00081 return *this; 00082 }
bool KDChart::Measure::operator== | ( | const Measure & | r | ) | const |
Definition at line 184 of file KDChartMeasure.cpp.
References calculationMode(), referenceArea(), referenceOrientation(), and value().
00185 { 00186 return( mValue == r.value() && 00187 mMode == r.calculationMode() && 00188 mArea == r.referenceArea() && 00189 mOrientation == r.referenceOrientation() ); 00190 }
const QObject* KDChart::Measure::referenceArea | ( | ) | const |
The returned reference area will either be derived from AbstractArea or be derived from QWidget.
Definition at line 112 of file KDChartMeasure.h.
Referenced by operator<<(), operator=(), and operator==().
KDChartEnums::MeasureOrientation KDChart::Measure::referenceOrientation | ( | ) | const |
Definition at line 115 of file KDChartMeasure.h.
Referenced by operator<<(), operator=(), and operator==().
void KDChart::Measure::setAbsoluteValue | ( | qreal | val | ) |
This is a convenience method for specifying a value, with implicitely setting the calculation mode to MeasureCalculationModeAbsolute.
Calling setAbsoluteValue( value ) is the same as calling
setValue( value ); setCalculationMode( KDChartEnums::MeasureCalculationModeAbsolute );
Definition at line 96 of file KDChartMeasure.h.
References KDChartEnums::MeasureCalculationModeAbsolute.
00097 { 00098 mMode = KDChartEnums::MeasureCalculationModeAbsolute; 00099 mValue = val; 00100 }
void KDChart::Measure::setCalculationMode | ( | KDChartEnums::MeasureCalculationMode | mode | ) |
void KDChart::Measure::setReferenceArea | ( | const QObject * | area | ) |
The reference area must either be derived from AbstractArea or be derived from QWidget, so e.g.
it could be derived from AbstractAreaWidget too.
Definition at line 107 of file KDChartMeasure.h.
void KDChart::Measure::setReferenceOrientation | ( | KDChartEnums::MeasureOrientation | orientation | ) |
void KDChart::Measure::setRelativeMode | ( | const QObject * | area, | |
KDChartEnums::MeasureOrientation | orientation | |||
) |
The reference area must either be derived from AbstractArea or be derived from QWidget, so e.g.
it could be derived from AbstractAreaWidget too.
Definition at line 78 of file KDChartMeasure.h.
References KDChartEnums::MeasureCalculationModeRelative.
00080 { 00081 mMode = KDChartEnums::MeasureCalculationModeRelative; 00082 mArea = area; 00083 mOrientation = orientation; 00084 }
void KDChart::Measure::setValue | ( | qreal | val | ) |
const QSizeF KDChart::Measure::sizeOfArea | ( | const QObject * | area | ) | const |
Definition at line 148 of file KDChartMeasure.cpp.
References KDChart::GlobalMeasureScaling::currentFactors(), KDChart::GlobalMeasureScaling::instance(), KDChartEnums::MeasureCalculationModeAbsolute, and KDChart::CartesianCoordinatePlane::visibleDiagramArea().
Referenced by calculatedValue().
00149 { 00150 QSizeF size; 00151 const CartesianCoordinatePlane* plane = dynamic_cast<const CartesianCoordinatePlane*>( area ); 00152 if ( false ) { 00153 size = plane->visibleDiagramArea().size(); 00154 } else { 00155 const AbstractArea* kdcArea = dynamic_cast<const AbstractArea*>(area); 00156 if( kdcArea ){ 00157 size = kdcArea->geometry().size(); 00158 //qDebug() << "Measure::sizeOfArea() found kdcArea with size" << size; 00159 }else{ 00160 const QWidget* widget = dynamic_cast<const QWidget*>(area); 00161 if( widget ){ 00162 /* ATTENTION: Using the layout does not work: The Legend will never get the right size then! 00163 const QLayout * layout = widget->layout(); 00164 if( layout ){ 00165 size = layout->geometry().size(); 00166 //qDebug() << "Measure::sizeOfArea() found widget with layout size" << size; 00167 }else*/ 00168 { 00169 size = widget->geometry().size(); 00170 //qDebug() << "Measure::sizeOfArea() found widget with size" << size; 00171 } 00172 }else if( mMode != KDChartEnums::MeasureCalculationModeAbsolute ){ 00173 size = QSizeF(1.0, 1.0); 00174 //qDebug("Measure::sizeOfArea() got no valid area."); 00175 } 00176 } 00177 } 00178 const QPair< qreal, qreal > factors 00179 = GlobalMeasureScaling::instance()->currentFactors(); 00180 return QSizeF(size.width() * factors.first, size.height() * factors.second); 00181 }
qreal KDChart::Measure::value | ( | ) | const |
Definition at line 68 of file KDChartMeasure.h.
Referenced by calculatedValue(), operator<<(), operator=(), and operator==().