qcanvas-h.html

来自「qtopiaphone英文帮助,用于初学者和开发人员,初学者可以用来学习,开发人」· HTML 代码 · 共 715 行 · 第 1/2 页

HTML
715
字号
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Qt Toolkit - qcanvas.h include file</title><style type="text/css"><!--h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }a:link { color: #004faf; text-decoration: none }a:visited { color: #672967; text-decoration: none }body { background: white; color: black; }--></style></head><body bgcolor="#ffffff"><table width="100%"><tr><td><a href="index.html"><img width="100" height="100" src="qtlogo.png"alt="Home" border="0"><img width="100"height="100" src="face.png" alt="Home" border="0"></a><td valign="top"><div align="right"><img src="dochead.png" width="472" height="27"><br><a href="classes.html"><b>Classes</b></a>- <a href="annotated.html">Annotated</a>- <a href="hierarchy.html">Tree</a>- <a href="functions.html">Functions</a>- <a href="index.html">Home</a>- <a href="topicals.html"><b>Structure</b>  <font face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular" align="center" size=32>Qte</font></a></div></table><h1 align=center>qcanvas.h</h1><br clear="all">This is the verbatim text of the qcanvas.h include file.  It isprovided only for illustration; the copyrightremains with Trolltech.<hr><pre>/************************************************************************ &#36;Id&#58; qt/src/canvas/qcanvas.h   2.3.8   edited 2004-05-12 $**** Definition of QCanvas classes**** Created : 991211**** Copyright (C) 1999-2000 Trolltech AS.  All rights reserved.**** This file is part of the canvas module of the Qt GUI Toolkit.**** This file may be distributed under the terms of the Q Public License** as defined by Trolltech AS of Norway and appearing in the file** LICENSE.QPL included in the packaging of this file.**** This file may be distributed and/or modified under the terms of the** GNU General Public License version 2 as published by the Free Software** Foundation and appearing in the file LICENSE.GPL included in the** packaging of this file.**** Licensees holding valid Qt Enterprise Edition licenses may use this** file in accordance with the Qt Commercial License Agreement provided** with the Software.**** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.**** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for**   information about Qt Commercial License Agreements.** See http://www.trolltech.com/qpl/ for QPL licensing information.** See http://www.trolltech.com/gpl/ for GPL licensing information.**** Contact info@trolltech.com if any conditions of this licensing are** not clear to you.************************************************************************/#ifndef QCANVAS_H#define QCANVAS_H#ifndef QT_H#include &lt;qbitmap.h&gt;#include &lt;qwidget.h&gt;#include &lt;qscrollview.h&gt;#include &lt;qlist.h&gt;#include &lt;qptrdict.h&gt;#endif // QT_H#ifndef QT_NO_CANVASclass <a href="qcanvassprite.html">QCanvasSprite</a>;class <a href="qcanvaspolygonalitem.html">QCanvasPolygonalItem</a>;class <a href="qcanvasrectangle.html">QCanvasRectangle</a>;class <a href="qcanvaspolygon.html">QCanvasPolygon</a>;class <a href="qcanvasellipse.html">QCanvasEllipse</a>;class <a href="qcanvastext.html">QCanvasText</a>;class <a href="qcanvasline.html">QCanvasLine</a>;class QCanvasChunk;class <a href="qcanvas.html">QCanvas</a>;class QCanvasData;class <a href="qcanvasitem.html">QCanvasItem</a>;class <a href="qcanvasview.html">QCanvasView</a>;class <a href="qcanvaspixmap.html">QCanvasPixmap</a>;#if defined(Q_TEMPLATEDLL)// MOC_SKIP_BEGINtemplate class Q_EXPORT QList&lt; QCanvasItem &gt;;template class Q_EXPORT QList&lt; QCanvasView &gt;;template class Q_EXPORT QValueList&lt; QCanvasItem* &gt;;// MOC_SKIP_END#endifclass QCanvasItemList : public QValueList&lt;QCanvasItem*&gt; {public:    void sort();    void drawUnique( QPainter&amp; painter );};class QCanvasItemExtra;class Q_EXPORT <a href="qcanvasitem.html">QCanvasItem</a> : public <a href="qt.html">Qt</a>{public:    QCanvasItem(QCanvas* canvas);    virtual ~QCanvasItem();    double x() const        { return myx; }    double y() const        { return myy; }    double z() const        { return myz; } // (depth)    virtual void moveBy(double dx, double dy);    void move(double x, double y);    void setX(double a) { move(a,y()); }    void setY(double a) { move(x(),a); }    void setZ(double a) { myz=a; changeChunks(); }    bool animated() const;    virtual void setAnimated(bool y);    virtual void setVelocity( double vx, double vy);    void setXVelocity( double vx ) { setVelocity(vx,yVelocity()); }    void setYVelocity( double vy ) { setVelocity(xVelocity(),vy); }    double xVelocity() const;    double yVelocity() const;    virtual void advance(int stage);    virtual bool collidesWith( const QCanvasItem* ) const=0;    QCanvasItemList collisions(bool exact /* NO DEFAULT */ ) const;    virtual void setCanvas(QCanvas*);    virtual void draw(QPainter&amp;)=0;    void show();    void hide();    virtual void setVisible(bool yes);    bool visible() const        { return (bool)vis; }    virtual void setSelected(bool yes);    bool selected() const        { return (bool)sel; }    virtual void setEnabled(bool yes);    bool enabled() const        { return (bool)ena; }    virtual void setActive(bool yes);    bool active() const        { return (bool)act; }    virtual int rtti() const;    virtual QRect boundingRect() const=0;    virtual QRect boundingRectAdvanced() const;    QCanvas* canvas() const        { return cnv; }private:    // For friendly sublasses...    friend class QCanvasPolygonalItem;    friend class QCanvasSprite;    friend class QCanvasRectangle;    friend class QCanvasPolygon;    friend class QCanvasEllipse;    friend class QCanvasText;    friend class QCanvasLine;    virtual QPointArray chunks() const;    virtual void addToChunks();    virtual void removeFromChunks();    virtual void changeChunks();    virtual bool collidesWith(   const QCanvasSprite*,                                 const QCanvasPolygonalItem*,                                 const QCanvasRectangle*,                                 const QCanvasEllipse*,                                 const QCanvasText* ) const=0;    // End of friend stuff    QCanvas* cnv;    static QCanvas* current_canvas;    double myx,myy,myz;    QCanvasItemExtra *ext;    QCanvasItemExtra&amp; extra();    uint ani:1;    uint vis:1;    uint sel:1;    uint ena:1;    uint act:1;};class Q_EXPORT <a href="qcanvas.html">QCanvas</a> : public <a href="qobject.html">QObject</a>{    Q_OBJECTpublic:    QCanvas( QObject* parent = 0, const char* name = 0 );    QCanvas(int w, int h);    QCanvas( QPixmap p, int h, int v, int tilewidth, int tileheight );    virtual ~QCanvas();    virtual void setTiles( QPixmap tiles, int h, int v,                           int tilewidth, int tileheight );    virtual void setBackgroundPixmap( const QPixmap&amp; p );    QPixmap backgroundPixmap() const;    virtual void setBackgroundColor( const QColor&amp; c );    QColor backgroundColor() const;    virtual void setTile( int x, int y, int tilenum );    int tile( int x, int y ) const        { return grid[x+y*htiles]; }    int tilesHorizontally() const        { return htiles; }    int tilesVertically() const        { return vtiles; }    int tileWidth() const        { return tilew; }    int tileHeight() const        { return tileh; }    virtual void resize(int width, int height);    int width() const        { return awidth; }    int height() const        { return aheight; }    QSize size() const        { return QSize(awidth,aheight); }    bool onCanvas( int x, int y ) const        { return x&gt;=0 &amp;&amp; y&gt;=0 &amp;&amp; x&lt;awidth &amp;&amp; y&lt;aheight; }    bool onCanvas( const QPoint&amp; p ) const        { return onCanvas(p.x(),p.y()); }    bool validChunk( int x, int y ) const        { return x&gt;=0 &amp;&amp; y&gt;=0 &amp;&amp; x&lt;chwidth &amp;&amp; y&lt;chheight; }    bool validChunk( const QPoint&amp; p ) const        { return validChunk(p.x(),p.y()); }    int chunkSize() const        { return chunksize; }    virtual void retune(int chunksize, int maxclusters=100);    bool sameChunk(int x1, int y1, int x2, int y2) const        { return x1/chunksize==x2/chunksize &amp;&amp; y1/chunksize==y2/chunksize; }    virtual void setChangedChunk(int i, int j);    virtual void setChangedChunkContaining(int x, int y);    virtual void setAllChanged();    virtual void setChanged(const QRect&amp; inarea);    // These call setChangedChunk.    void addItemToChunk(QCanvasItem*, int i, int j);    void removeItemFromChunk(QCanvasItem*, int i, int j);    void addItemToChunkContaining(QCanvasItem*, int x, int y);    void removeItemFromChunkContaining(QCanvasItem*, int x, int y);    QCanvasItemList allItems();    QCanvasItemList collisions( const QPoint&amp;) const;    QCanvasItemList collisions( const QRect&amp;) const;    QCanvasItemList collisions( const QPointArray&amp; pa, const QCanvasItem* item,                                bool exact) const;    // These are for QCanvasView to call    virtual void addView(QCanvasView*);    virtual void removeView(QCanvasView*);    void drawArea(const QRect&amp;, QPainter* p=0, bool double_buffer=TRUE);    // These are for QCanvasItem to call    virtual void addItem(QCanvasItem*);    virtual void addAnimation(QCanvasItem*);    virtual void removeItem(QCanvasItem*);    virtual void removeAnimation(QCanvasItem*);    virtual void setAdvancePeriod(int ms);    virtual void setUpdatePeriod(int ms);    virtual void setDoubleBuffering(bool y);signals:    void resized();public slots:    virtual void advance();    virtual void update();protected:    virtual void drawBackground(QPainter&amp;, const QRect&amp; area);    virtual void drawForeground(QPainter&amp;, const QRect&amp; area);private:    void init(int w, int h, int chunksze=16, int maxclust=100);    QCanvasChunk&amp; chunk(int i, int j) const;    QCanvasChunk&amp; chunkContaining(int x, int y) const;    void drawChanges(const QRect&amp; inarea);    QPixmap offscr;    int awidth,aheight;    int chunksize;    int maxclusters;    int chwidth,chheight;    QCanvasChunk* chunks;    QCanvasData* d;    void initTiles(QPixmap p, int h, int v, int tilewidth, int tileheight);    ushort *grid;    ushort htiles;    ushort vtiles;    ushort tilew;    ushort tileh;    bool oneone;    QPixmap pm;    QTimer* update_timer;    QColor bgcolor;    bool debug_redraw_areas;    bool dblbuf;    friend void qt_unview(QCanvas* c);};class Q_EXPORT <a href="qcanvasview.html">QCanvasView</a> : public <a href="qscrollview.html">QScrollView</a>{    Q_OBJECTpublic:    QCanvasView(QCanvas* viewing=0, QWidget* parent=0, const char* name=0, WFlags f=0);    ~QCanvasView();    QCanvas* canvas() const        { return viewing; }    void setCanvas(QCanvas* v);protected:    void drawContents( QPainter*, int cx, int cy, int cw, int ch );    QSize sizeHint() const;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?