The QGeoMapTextObject class is a QGeoMapObject used to draw text on a map. More...
#include <QGeoMapTextObject>
Inherits: QGeoMapObject.
This class was introduced in Qt Mobility 1.1.
|
QGeoMapTextObject () | |
QGeoMapTextObject ( const QGeoCoordinate & coordinate, const QString & text = QString(), const QFont & font = QFont(), const QPoint & offset = QPoint(), Qt::Alignment alignment = Qt::AlignCenter ) | |
~QGeoMapTextObject () | |
Qt::Alignment | alignment () const |
QBrush | brush () const |
QGeoCoordinate | coordinate () const |
QFont | font () const |
QPoint | offset () const |
QPen | pen () const |
void | setAlignment ( Qt::Alignment alignment ) |
void | setBrush ( const QBrush & brush ) |
void | setCoordinate ( const QGeoCoordinate & coordinate ) |
void | setFont ( const QFont & font ) |
void | setOffset ( const QPoint & offset ) |
void | setPen ( const QPen & pen ) |
void | setText ( const QString & text ) |
QString | text () const |
virtual QGeoMapObject::Type | type () const |
void | alignmentChanged ( Qt::Alignment alignment ) |
void | brushChanged ( const QBrush & brush ) |
void | coordinateChanged ( const QGeoCoordinate & coordinate ) |
void | fontChanged ( const QFont & font ) |
void | offsetChanged ( const QPoint & offset ) |
void | penChanged ( const QPen & pen ) |
void | textChanged ( const QString & text ) |
The QGeoMapTextObject class is a QGeoMapObject used to draw text on a map.
The text is drawn at a given coordinate on the map.
The text object is drawn such that the rendered size of the text object is independent of the zoom level of the map.
This property holds the alignment options used to align the text when drawing this text object.
The default value of this property will align the text so that it is centered both horizontally and vertically around the point that is QGeoMapTextObject::offset pixels away from the position of QGeoMapTextObject::coordinate on the screen.
Using
textObject->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
will place the text so that the point halway up the left edge of the text is at the anchor point defined by QGeoMapTextObject::offset and QGeoMapTextObject::coordinate.
The alignment property is a flag, so using
textObject->setAlignment(Qt::AlignLeft);
may alter the vertical alignment as well.
The Qt::AlignVertical_Mask and Qt::AlignHorizontal_Mask enum values can be used to alter one component of the alignment independent of the other.
textObject->setAlignment(Qt::AlignLeft | (textObject->alignment() & Qt::AlignVertical_Mask));
The alignment does not take the width of QGeoMapTextObject::pen into consideration.
This property was introduced in Qt Mobility 1.1.
Access functions:
Qt::Alignment | alignment () const |
void | setAlignment ( Qt::Alignment alignment ) |
Notifier signal:
void | alignmentChanged ( Qt::Alignment alignment ) |
This property holds the brush that will be used to draw this object.
The brush is used to fill in the glyphs of the text.
The outline around the perimeter of the glyphs is drawn using the QGeoMapTextObject::pen property.
This property was introduced in Qt Mobility 1.1.
Access functions:
QBrush | brush () const |
void | setBrush ( const QBrush & brush ) |
Notifier signal:
void | brushChanged ( const QBrush & brush ) |
This property holds the coordinate at which this text object will be rendered.
The default value of this property is an invalid coordinate. While the value of this property is invalid the text object will not be displayed.
If QGeoMapTextObject::offset and QGeoMapTextObject::alignment are not set the text will be drawn so that it is centered both horizontally and vertically around the position of QGeoMapTextObject::coordinate on the screen.
This property was introduced in Qt Mobility 1.1.
Access functions:
QGeoCoordinate | coordinate () const |
void | setCoordinate ( const QGeoCoordinate & coordinate ) |
Notifier signal:
void | coordinateChanged ( const QGeoCoordinate & coordinate ) |
This property holds the font that will be used to render the text for this text object.
The default value of this property is the application's default font.
It is not necessary to account for the zoom level of the map, since text objects are scaled such that they appear to be independent of the zoom level.
This property was introduced in Qt Mobility 1.1.
Access functions:
QFont | font () const |
void | setFont ( const QFont & font ) |
Notifier signal:
void | fontChanged ( const QFont & font ) |
This property holds the offset in pixels from the screen position of QGeoMapTextObject::coordinate at which the text will be rendered when drawing this text object.
The default value of this property is QPoint(0,0).
This property was introduced in Qt Mobility 1.1.
Access functions:
QPoint | offset () const |
void | setOffset ( const QPoint & offset ) |
Notifier signal:
void | offsetChanged ( const QPoint & offset ) |
This property holds the pen that will be used to draw this object.
The pen is used to draw an outline around the text. The text itself is filled using the QGeoMapTextObject::brush property.
The pen will be treated as a cosmetic pen, which means that the width of the pen will be independent of the zoom level of the map.
This property was introduced in Qt Mobility 1.1.
Access functions:
QPen | pen () const |
void | setPen ( const QPen & pen ) |
Notifier signal:
void | penChanged ( const QPen & pen ) |
This property holds the text that will be displayed by this text object.
The default value of this property is an empty string.
This property was introduced in Qt Mobility 1.1.
Access functions:
QString | text () const |
void | setText ( const QString & text ) |
Notifier signal:
void | textChanged ( const QString & text ) |
Constructs a new text object.
Constructs a new text object which will display the text text with font font at the coordinate coordinate on the map.
The text will be displayed at an on-screen offset from the coordinate of offset pixels, and will be aligned according to alignment.
This function was introduced in Qt Mobility 1.1.
Destroys this text object.
This signal is emitted when the alignment of this text object has changed.
The new value is alignment.
This function was introduced in Qt Mobility 1.1.
This signal is emitted when the brush used to fill the inside of the letters for this text object has changed.
The new value is brush.
This function was introduced in Qt Mobility 1.1.
This signal is emitted when the coordinate at which this text object will be drawn has changed.
The new value is coordinate.
This function was introduced in Qt Mobility 1.1.
This signal is emitted when the font use to draw this text object has changed.
The new value is font.
This function was introduced in Qt Mobility 1.1.
This signal is emitted when the on screen offset from the coordinate at which this text object will be drawn has changed.
The new value is offset.
This function was introduced in Qt Mobility 1.1.
This signal is emitted when the pen used to draw the outline of the letters for this text object has changed.
The new value is pen.
This function was introduced in Qt Mobility 1.1.
This signal is emitted when the text to be drawn by this text object has changed.
The new value is text.
This function was introduced in Qt Mobility 1.1.
Reimplemented from QGeoMapObject::type().
This function was introduced in Qt Mobility 1.1.
© 2008-2011 Nokia Corporation and/or its subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation in Finland and/or other countries worldwide.
All other trademarks are property of their respective owners. Privacy Policy
Licensees holding valid Qt Commercial licenses may use this document in accordance with the Qt Commercial License Agreement provided with the Software or, alternatively, in accordance with the terms contained in a written agreement between you and Nokia.
Alternatively, this document may be used under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation.