Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Toutes les fonctions  ·  Vues d'ensemble  · 

QGraphicsRectItem Class Reference

The QGraphicsRectItem class provides a rectangle item that you can add to a QGraphicsScene. More...

 #include <QGraphicsRectItem>

Inherits: QAbstractGraphicsShapeItem.

This class was introduced in Qt 4.2.

Public Functions

QGraphicsRectItem ( QGraphicsItem * parent = 0 )
QGraphicsRectItem ( const QRectF & rect, QGraphicsItem * parent = 0 )
QGraphicsRectItem ( qreal x, qreal y, qreal width, qreal height, QGraphicsItem * parent = 0 )
~QGraphicsRectItem ()
QRectF rect () const
void setRect ( const QRectF & rectangle )
void setRect ( qreal x, qreal y, qreal width, qreal height )

Reimplemented Public Functions

virtual QRectF boundingRect () const
virtual bool contains ( const QPointF & point ) const
virtual bool isObscuredBy ( const QGraphicsItem * item ) const
virtual QPainterPath opaqueArea () const
virtual void paint ( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0 )
virtual QPainterPath shape () const
virtual int type () const

Additional Inherited Members

Detailed Description

The QGraphicsRectItem class provides a rectangle item that you can add to a QGraphicsScene.

To set the item's rectangle, pass a QRectF to QGraphicsRectItem's constructor, or call the setRect() function. The rect() function returns the current rectangle.

QGraphicsRectItem uses the rectangle and the pen width to provide a reasonable implementation of boundingRect(), shape(), and contains(). The paint() function draws the rectangle using the item's associated pen and brush, which you can set by calling the setPen() and setBrush() functions.

Note: The rendering of invalid rectangles, such as those with negative widths or heights, is undefined. If you cannot be sure that you are using valid rectangles (for example, if you are creating rectangles using data from an unreliable source) then you should use QRectF::normalized() to create normalized rectangles, and use those instead.

See also QGraphicsPathItem, QGraphicsEllipseItem, QGraphicsPolygonItem, QGraphicsTextItem, QGraphicsLineItem, QGraphicsPixmapItem, and Graphics View Framework.

Member Function Documentation

QGraphicsRectItem::QGraphicsRectItem ( QGraphicsItem * parent = 0 )

Constructs a QGraphicsRectItem. parent is passed to QAbstractGraphicsShapeItem's constructor.

See also QGraphicsScene::addItem().

QGraphicsRectItem::QGraphicsRectItem ( const QRectF & rect, QGraphicsItem * parent = 0 )

Constructs a QGraphicsRectItem, using rect as the default rectangle. parent is passed to QAbstractGraphicsShapeItem's constructor.

See also QGraphicsScene::addItem().

QGraphicsRectItem::QGraphicsRectItem ( qreal x, qreal y, qreal width, qreal height, QGraphicsItem * parent = 0 )

Constructs a QGraphicsRectItem with a default rectangle defined by (x, y) and the given width and height.

parent is passed to QAbstractGraphicsShapeItem's constructor.

See also QGraphicsScene::addItem().

QGraphicsRectItem::~QGraphicsRectItem ()

Destroys the QGraphicsRectItem.

QRectF QGraphicsRectItem::boundingRect () const [virtual]

Reimplemented from QGraphicsItem::boundingRect().

bool QGraphicsRectItem::contains ( const QPointF & point ) const [virtual]

Reimplemented from QGraphicsItem::contains().

bool QGraphicsRectItem::isObscuredBy ( const QGraphicsItem * item ) const [virtual]

Reimplemented from QGraphicsItem::isObscuredBy().

QPainterPath QGraphicsRectItem::opaqueArea () const [virtual]

Reimplemented from QGraphicsItem::opaqueArea().

void QGraphicsRectItem::paint ( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0 ) [virtual]

Reimplemented from QGraphicsItem::paint().

QRectF QGraphicsRectItem::rect () const

Returns the item's rectangle.

See also setRect().

void QGraphicsRectItem::setRect ( const QRectF & rectangle )

Sets the item's rectangle to be the given rectangle.

See also rect().

void QGraphicsRectItem::setRect ( qreal x, qreal y, qreal width, qreal height )

Sets the item's rectangle to the rectangle defined by (x, y) and the given width and height.

This convenience function is equivalent to calling setRect(QRectF(x, y, width, height))

See also rect().

QPainterPath QGraphicsRectItem::shape () const [virtual]

Reimplemented from QGraphicsItem::shape().

int QGraphicsRectItem::type () const [virtual]

Reimplemented from QGraphicsItem::type().

Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt 4.8
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web