Q3CanvasPolygonalItem Class ReferenceThe Q3CanvasPolygonalItem class provides a polygonal canvas item on a Q3Canvas. More... #include <Q3CanvasPolygonalItem> This class is part of the Qt 3 support library. It is provided to keep old source code working. We strongly advise against using it in new code. See Porting to Qt 4 for more information. Inherits: Q3CanvasItem. Inherited by: Q3CanvasEllipse, Q3CanvasLine, Q3CanvasPolygon, and Q3CanvasRectangle. Public Functions
Reimplemented Public Functions
Protected Functions
Reimplemented Protected Functions
Detailed DescriptionThe Q3CanvasPolygonalItem class provides a polygonal canvas item on a Q3Canvas. The mostly rectangular classes, such as Q3CanvasSprite and Q3CanvasText, use the object's bounding rectangle for movement, repainting and collision calculations. For most other items, the bounding rectangle can be far too large -- a diagonal line being the worst case, and there are many other cases which are also bad. Q3CanvasPolygonalItem provides polygon-based bounding rectangle handling, etc., which is much faster for non-rectangular items. Derived classes should try to define as small an area as possible to maximize efficiency, but the polygon must definitely be contained completely within the polygonal area. Calculating the exact requirements is usually difficult, but if you allow a small overestimate it can be easy and quick, while still getting almost all of Q3CanvasPolygonalItem's speed. Note that all subclasses must call hide() in their destructor since hide() needs to be able to access areaPoints(). Normally, Q3CanvasPolygonalItem uses the odd-even algorithm for determining whether an object intersects this object. You can change this to the winding algorithm using setWinding(). The bounding rectangle is available using boundingRect(). The points bounding the polygonal item are retrieved with areaPoints(). Use areaPointsAdvanced() to retrieve the bounding points the polygonal item will have after Q3CanvasItem::advance(1) has been called. If the shape of the polygonal item is about to change while the item is visible, call invalidate() before updating with a different result from areaPoints(). By default, Q3CanvasPolygonalItem objects have a black pen and no brush (the default QPen and QBrush constructors). You can change this with setPen() and setBrush(), but note that some Q3CanvasPolygonalItem subclasses only use the brush, ignoring the pen setting. The polygonal item can be drawn on a painter with draw(). Subclasses must reimplement drawShape() to draw themselves. Like any other canvas item polygonal items can be moved with Q3CanvasItem::move() and Q3CanvasItem::moveBy(), or by setting coordinates with Q3CanvasItem::setX(), Q3CanvasItem::setY() and Q3CanvasItem::setZ(). See also QtCanvas and Porting to Graphics View. Member Function Documentation
|
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 ! |
Copyright © 2000-2012 - www.developpez.com