diff --git a/plugins/declarative/declarativechart.cpp b/plugins/declarative/declarativechart.cpp index 3aff59c..645dee9 100644 --- a/plugins/declarative/declarativechart.cpp +++ b/plugins/declarative/declarativechart.cpp @@ -58,6 +58,13 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE */ /*! + \qmlproperty Font ChartView::titleFont + The title font of the chart + + See the \l {Font} {QML Font Element} for detailed documentation. +*/ + +/*! \qmlproperty string ChartView::title The title of the chart, shown on top of the chart. \sa ChartView::titleColor @@ -250,6 +257,16 @@ void DeclarativeChart::setTitleColor(QColor color) } } +QFont DeclarativeChart::titleFont() const +{ + return m_chart->titleFont(); +} + +void DeclarativeChart::setTitleFont(const QFont& font) +{ + m_chart->setTitleFont(font); +} + QColor DeclarativeChart::titleColor() { return m_chart->titleBrush().color(); diff --git a/plugins/declarative/declarativechart.h b/plugins/declarative/declarativechart.h index b99b25c..cca3f61 100644 --- a/plugins/declarative/declarativechart.h +++ b/plugins/declarative/declarativechart.h @@ -37,6 +37,7 @@ class DeclarativeChart : public QDeclarativeItem Q_PROPERTY(Theme theme READ theme WRITE setTheme) Q_PROPERTY(Animation animationOptions READ animationOptions WRITE setAnimationOptions) Q_PROPERTY(QString title READ title WRITE setTitle) + Q_PROPERTY(QFont titleFont READ titleFont WRITE setTitleFont) Q_PROPERTY(QColor titleColor READ titleColor WRITE setTitleColor NOTIFY titleColorChanged) Q_PROPERTY(QAxis *axisX READ axisX) Q_PROPERTY(QAxis *axisY READ axisY) @@ -103,6 +104,8 @@ public: QLegend *legend(); QVariantList axisXLabels(); void setAxisXLabels(QVariantList list); + QFont titleFont() const; + void setTitleFont(const QFont& font); void setTitleColor(QColor color); QColor titleColor(); void setBackgroundColor(QColor color); diff --git a/plugins/declarative/font.qdoc b/plugins/declarative/font.qdoc new file mode 100644 index 0000000..a9ea363 --- /dev/null +++ b/plugins/declarative/font.qdoc @@ -0,0 +1,114 @@ +/*! + \qmlclass Font QFont + \brief Defines the font used for drawing text. + + Font instantiates the C++ class QFont +*/ + +// NOTE: This is a copy-paste from: +// \src\declarative\graphicsitems\qdeclarativetext.cpp + +/*! + \qmlproperty string Font::family + + Sets the family name of the font. + + The family name is case insensitive and may optionally include a foundry name, e.g. "Helvetica [Cronyx]". + If the family is available from more than one foundry and the foundry isn't specified, an arbitrary foundry is chosen. + If the family isn't available a family will be set using the font matching algorithm. +*/ + +/*! + \qmlproperty bool Font::bold + + Sets whether the font weight is bold. +*/ + +/*! + \qmlproperty enumeration Font::weight + + Sets the font's weight. + + The weight can be one of: + \list + \o Font.Light + \o Font.Normal - the default + \o Font.DemiBold + \o Font.Bold + \o Font.Black + \endlist + + \qml + Text { text: "Hello"; font.weight: Font.DemiBold } + \endqml +*/ + +/*! + \qmlproperty bool Font::italic + + Sets whether the font has an italic style. +*/ + +/*! + \qmlproperty bool Font::underline + + Sets whether the text is underlined. +*/ + +/*! + \qmlproperty bool Font::strikeout + + Sets whether the font has a strikeout style. +*/ + +/*! + \qmlproperty real Font::pointSize + + Sets the font size in points. The point size must be greater than zero. +*/ + +/*! + \qmlproperty int Font::pixelSize + + Sets the font size in pixels. + + Using this function makes the font device dependent. + Use \c pointSize to set the size of the font in a device independent manner. +*/ + +/*! + \qmlproperty real Font::letterSpacing + + Sets the letter spacing for the font. + + Letter spacing changes the default spacing between individual letters in the font. + A positive value increases the letter spacing by the corresponding pixels; a negative value decreases the spacing. +*/ + +/*! + \qmlproperty real Font::wordSpacing + + Sets the word spacing for the font. + + Word spacing changes the default spacing between individual words. + A positive value increases the word spacing by a corresponding amount of pixels, + while a negative value decreases the inter-word spacing accordingly. +*/ + +/*! + \qmlproperty enumeration Font::capitalization + + Sets the capitalization for the text. + + \list + \o Font.MixedCase - This is the normal text rendering option where no capitalization change is applied. + \o Font.AllUppercase - This alters the text to be rendered in all uppercase type. + \o Font.AllLowercase - This alters the text to be rendered in all lowercase type. + \o Font.SmallCaps - This alters the text to be rendered in small-caps type. + \o Font.Capitalize - This alters the text to be rendered with the first character of each word as an uppercase character. + \endlist + + \qml + Text { text: "Hello"; font.capitalization: Font.AllLowercase } + \endqml +*/ diff --git a/src/axis/qaxis.cpp b/src/axis/qaxis.cpp index f5fcc03..88c6327 100644 --- a/src/axis/qaxis.cpp +++ b/src/axis/qaxis.cpp @@ -110,6 +110,17 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE */ /*! + \property QAxis::labelsFont + The font of the axis labels. +*/ +/*! + \qmlproperty Font Axis::labelsFont + The font of the axis labels. + + See the \l {Font} {QML Font Element} for detailed documentation. +*/ + +/*! \property QAxis::labelsColor The color of the axis labels. */ diff --git a/src/axis/qaxis.h b/src/axis/qaxis.h index 52ecca9..0bbedbb 100644 --- a/src/axis/qaxis.h +++ b/src/axis/qaxis.h @@ -37,6 +37,7 @@ class QTCOMMERCIALCHART_EXPORT QAxis : public QObject Q_PROPERTY(QColor color READ axisPenColor WRITE setAxisPenColor NOTIFY colorChanged) Q_PROPERTY(bool labelsVisible READ labelsVisible WRITE setLabelsVisible NOTIFY labelsVisibleChanged) Q_PROPERTY(int labelsAngle READ labelsAngle WRITE setLabelsAngle) + Q_PROPERTY(QFont labelsFont READ labelsFont WRITE setLabelsFont) Q_PROPERTY(QColor labelsColor READ labelsColor WRITE setLabelsColor NOTIFY labelsColorChanged) Q_PROPERTY(bool gridVisible READ isGridLineVisible WRITE setGridLineVisible NOTIFY gridVisibleChanged) Q_PROPERTY(bool shadesVisible READ shadesVisible WRITE setShadesVisible NOTIFY shadesVisibleChanged) diff --git a/src/barchart/qbarset.cpp b/src/barchart/qbarset.cpp index e187a9e..51a2f84 100644 --- a/src/barchart/qbarset.cpp +++ b/src/barchart/qbarset.cpp @@ -76,6 +76,13 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE */ /*! + \qmlproperty Font BarSet::labelFont + Defines the font used by the barSet's label. + + See the \l {Font} {QML Font Element} for detailed documentation. +*/ + +/*! \property QBarSet::color The fill (brush) color of the bar set. */ diff --git a/src/piechart/qpieslice.cpp b/src/piechart/qpieslice.cpp index 4806b83..46ad518 100644 --- a/src/piechart/qpieslice.cpp +++ b/src/piechart/qpieslice.cpp @@ -276,6 +276,16 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE */ /*! + \qmlproperty Font PieSlice::labelFont + + Defines the font used for slice label. + + See the \l {Font} {QML Font Element} for detailed documentation. + + \sa labelVisible, labelPosition +*/ + +/*! \property QPieSlice::labelPosition Position of the slice label. \sa label, labelVisible