diff options
author | Yann Bodson <yann.bodson@nokia.com> | 2009-11-03 01:54:57 (GMT) |
---|---|---|
committer | Yann Bodson <yann.bodson@nokia.com> | 2009-11-03 01:54:57 (GMT) |
commit | 9063457d08b2bcc8c055f6f0370f73360e6ec1dc (patch) | |
tree | d0bbae0c62ded054c5de1e3e3b394a94c2c0758c /src/declarative/qml | |
parent | 1e8034a10d2496d7fb7aa987357333c6e2c3258d (diff) | |
download | Qt-9063457d08b2bcc8c055f6f0370f73360e6ec1dc.zip Qt-9063457d08b2bcc8c055f6f0370f73360e6ec1dc.tar.gz Qt-9063457d08b2bcc8c055f6f0370f73360e6ec1dc.tar.bz2 |
* add more font examples
* add missing properties to QmlFontValueType
Diffstat (limited to 'src/declarative/qml')
-rw-r--r-- | src/declarative/qml/qmlvaluetype.cpp | 60 | ||||
-rw-r--r-- | src/declarative/qml/qmlvaluetype_p.h | 39 |
2 files changed, 99 insertions, 0 deletions
diff --git a/src/declarative/qml/qmlvaluetype.cpp b/src/declarative/qml/qmlvaluetype.cpp index 1713205..859a93a 100644 --- a/src/declarative/qml/qmlvaluetype.cpp +++ b/src/declarative/qml/qmlvaluetype.cpp @@ -521,6 +521,16 @@ void QmlFontValueType::setBold(bool b) font.setBold(b); } +QmlFontValueType::FontWeight QmlFontValueType::weight() const +{ + return (QmlFontValueType::FontWeight)font.weight(); +} + +void QmlFontValueType::setWeight(QmlFontValueType::FontWeight w) +{ + font.setWeight((QFont::Weight)w); +} + bool QmlFontValueType::italic() const { return font.italic(); @@ -541,6 +551,26 @@ void QmlFontValueType::setUnderline(bool b) font.setUnderline(b); } +bool QmlFontValueType::overline() const +{ + return font.overline(); +} + +void QmlFontValueType::setOverline(bool b) +{ + font.setOverline(b); +} + +bool QmlFontValueType::strikeout() const +{ + return font.strikeOut(); +} + +void QmlFontValueType::setStrikeout(bool b) +{ + font.setStrikeOut(b); +} + qreal QmlFontValueType::pointSize() const { return font.pointSizeF(); @@ -566,4 +596,34 @@ void QmlFontValueType::setPixelSize(int size) hasPixelSize = true; } +QmlFontValueType::Capitalization QmlFontValueType::capitalization() const +{ + return (QmlFontValueType::Capitalization)font.capitalization(); +} + +void QmlFontValueType::setCapitalization(QmlFontValueType::Capitalization c) +{ + font.setCapitalization((QFont::Capitalization)c); +} + +qreal QmlFontValueType::letterSpacing() const +{ + return font.letterSpacing(); +} + +void QmlFontValueType::setLetterSpacing(qreal size) +{ + font.setLetterSpacing(QFont::PercentageSpacing, size); +} + +qreal QmlFontValueType::wordSpacing() const +{ + return font.wordSpacing(); +} + +void QmlFontValueType::setWordSpacing(qreal size) +{ + font.setWordSpacing(size); +} + QT_END_NAMESPACE diff --git a/src/declarative/qml/qmlvaluetype_p.h b/src/declarative/qml/qmlvaluetype_p.h index 9842c02..0af3813 100644 --- a/src/declarative/qml/qmlvaluetype_p.h +++ b/src/declarative/qml/qmlvaluetype_p.h @@ -258,13 +258,34 @@ private: class QmlFontValueType : public QmlValueType { Q_OBJECT + Q_ENUMS(FontWeight) + Q_ENUMS(Capitalization) + Q_PROPERTY(QString family READ family WRITE setFamily) Q_PROPERTY(bool bold READ bold WRITE setBold) + Q_PROPERTY(FontWeight weight READ weight WRITE setWeight) Q_PROPERTY(bool italic READ italic WRITE setItalic) Q_PROPERTY(bool underline READ underline WRITE setUnderline) + Q_PROPERTY(bool overline READ overline WRITE setOverline) + Q_PROPERTY(bool strikeout READ strikeout WRITE setStrikeout) Q_PROPERTY(qreal pointSize READ pointSize WRITE setPointSize) Q_PROPERTY(int pixelSize READ pixelSize WRITE setPixelSize) + Q_PROPERTY(Capitalization capitalization READ capitalization WRITE setCapitalization) + Q_PROPERTY(qreal letterSpacing READ letterSpacing WRITE setLetterSpacing) + Q_PROPERTY(qreal wordSpacing READ wordSpacing WRITE setWordSpacing) + public: + enum FontWeight { Light = QFont::Light, + Normal = QFont::Normal, + DemiBold = QFont::DemiBold, + Bold = QFont::Bold, + Black = QFont::Black }; + enum Capitalization { MixedCase = QFont::MixedCase, + AllUppercase = QFont::AllUppercase, + AllLowercase = QFont::AllLowercase, + SmallCaps = QFont::SmallCaps, + Capitalize = QFont::Capitalize }; + QmlFontValueType(QObject *parent = 0); virtual void read(QObject *, int); @@ -278,18 +299,36 @@ public: bool bold() const; void setBold(bool b); + FontWeight weight() const; + void setWeight(FontWeight); + bool italic() const; void setItalic(bool b); bool underline() const; void setUnderline(bool b); + bool overline() const; + void setOverline(bool b); + + bool strikeout() const; + void setStrikeout(bool b); + qreal pointSize() const; void setPointSize(qreal size); int pixelSize() const; void setPixelSize(int size); + Capitalization capitalization() const; + void setCapitalization(Capitalization); + + qreal letterSpacing() const; + void setLetterSpacing(qreal spacing); + + qreal wordSpacing() const; + void setWordSpacing(qreal spacing); + private: QFont font; bool hasPixelSize; |