⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qpainter.3qt

📁 Linux下的基于X11的图形开发环境。
💻 3QT
📖 第 1 页 / 共 5 页
字号:
Draws/plots a single point at \fI(x, y)\fR using the current pen..PPSee also QPen..PPExamples:.)l desktop/desktop.cpp and drawlines/connect.cpp..SH "void QPainter::drawPoint ( const QPoint & p )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPDraws the point \fIp\fR..SH "void QPainter::drawPoints ( const QPointArray & a, int index = 0, int npoints = -1 )"Draws/plots an array of points, \fIa\fR, using the current pen..PPIf \fIindex\fR is non-zero (the default is zero) only points from \fIindex\fR are drawn. If \fInpoints\fR is negative (the default) the rest of the points from \fIindex\fR are drawn. If \fInpoints\fR is zero or greater, \fInpoints\fR points are drawn..SH "void QPainter::drawPolygon ( const QPointArray & a, bool winding = FALSE, int index = 0, int npoints = -1 )"Draws the polygon defined by the \fInpoints\fR points in \fIa\fR starting at \fIa[index]\fR. (\fIindex\fR defaults to 0.).PPIf \fInpoints\fR is -1 (the default) all points until the end of the array are used (i.e. a.size()-index line segments define the polygon)..PPThe first point is always connected to the last point..PPThe polygon is filled with the current brush(). If \fIwinding\fR is TRUE, the polygon is filled using the winding fill algorithm. If \fIwinding\fR is FALSE, the polygon is filled using the even-odd (alternative) fill algorithm..PPSee also drawLineSegments(), drawPolyline(), and QPen..PPExamples:.)l desktop/desktop.cpp and picture/picture.cpp..SH "void QPainter::drawPolyline ( const QPointArray & a, int index = 0, int npoints = -1 )"Draws the polyline defined by the \fInpoints\fR points in \fIa\fR starting at \fIa[index]\fR. (\fIindex\fR defaults to 0.).PPIf \fInpoints\fR is -1 (the default) all points until the end of the array are used (i.e. a.size()-index-1 line segments are drawn)..PPSee also drawLineSegments(), drawPolygon(), and QPen..PPExamples:.)l scribble/scribble.cpp and themes/metal.cpp..SH "void QPainter::drawRect ( int x, int y, int w, int h )"Draws a rectangle with upper left corner at \fI(x, y)\fR and with width \fIw\fR and height \fIh\fR..PPSee also QPen and drawRoundRect()..PPExamples:.)l drawdemo/drawdemo.cpp, picture/picture.cpp, t10/cannon.cpp, t11/cannon.cpp, t12/cannon.cpp, t9/cannon.cpp, and tooltip/tooltip.cpp..SH "void QPainter::drawRect ( const QRect & r )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPDraws the rectangle \fIr\fR..SH "void QPainter::drawRoundRect ( int x, int y, int w, int h, int xRnd = 25, int yRnd = 25 )"Draws a rectangle with rounded corners at \fI(x, y)\fR, with width \fIw\fR and height \fIh\fR..PPThe \fIxRnd\fR and \fIyRnd\fR arguments specify how rounded the corners should be. 0 is angled corners, 99 is maximum roundedness..PPThe width and height include all of the drawn lines..PPSee also drawRect() and QPen..PPExamples:.)l drawdemo/drawdemo.cpp and themes/wood.cpp..SH "void QPainter::drawRoundRect ( const QRect & r, int xRnd = 25, int yRnd = 25 )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPDraws a rounded rectangle \fIr\fR, rounding to the x position \fIxRnd\fR and the y position \fIyRnd\fR on each corner..SH "void QPainter::drawText ( const QPoint & p, const QString &, int pos, int len, TextDirection dir = Auto )"Draws the text from position \fIpos\fR, at point \fIp\fR. If \fIlen\fR is -1 the entire string is drawn, otherwise just the first \fIlen\fR characters. The text's direction is specified by \fIdir\fR..PPNote that the meaning of \fIy\fR is not the same for the two drawText() varieties. For overloads that take a simple \fIx\fR, \fIy\fR pair (or a point), the \fIy\fR value is the text's baseline; for overloads that take a rectangle, \fIrect.y()\fR is the top of the rectangle and the text is aligned within that rectangle in accordance with the alignment flags..PPSee also QPainter::TextDirection..PPExamples:.)l desktop/desktop.cpp, drawdemo/drawdemo.cpp, hello/hello.cpp, picture/picture.cpp, progress/progress.cpp, t13/cannon.cpp, and t8/cannon.cpp..SH "void QPainter::drawText ( int x, int y, const QString &, int len = -1, TextDirection dir = Auto )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPDraws the given text at position \fIx\fR, \fIy\fR. If \fIlen\fR is -1 (the default) all the text is drawn, otherwise the first \fIlen\fR characters are drawn. The text's direction is given by \fIdir\fR..PPSee also QPainter::TextDirection..SH "void QPainter::drawText ( const QPoint &, const QString &, int len = -1, TextDirection dir = Auto )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPDraws the text at the given point..PPSee also QPainter::TextDirection..SH "void QPainter::drawText ( int x, int y, const QString &, int pos, int len, TextDirection dir = Auto )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPDraws the text from position \fIpos\fR, at point \fI(x, y)\fR. If \fIlen\fR is -1 the entire string is drawn, otherwise just the first \fIlen\fR characters. The text's direction is specified by \fIdir\fR..SH "void QPainter::drawText ( int x, int y, int w, int h, int flags, const QString &, int len = -1, QRect * br = 0, QTextParag ** internal = 0 )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPDraws the given text within the rectangle starting at \fIx\fR, \fIy\fR, with width \fIw\fR and height \fIh\fR. If \fIlen\fR is -1 (the default) all the text is drawn, otherwise the first \fIlen\fR characters are drawn. The text's flags that are given in the \fIflags\fR parameter are Qt::AlignmentFlags and Qt::TextFlags OR'd together. \fIbr\fR (if not null) is set to the actual bounding rectangle of the output. The \fIinternal\fR parameter is for internal use only..SH "void QPainter::drawText ( const QRect & r, int tf, const QString & str, int len = -1, QRect * brect = 0, QTextParag ** internal = 0 )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPDraws at most \fIlen\fR characters from \fIstr\fR in the rectangle \fIr\fR..PPThis function draws formatted text. The \fItf\fR text format is really of type Qt::AlignmentFlags and Qt::TextFlags OR'd together..PPHorizontal alignment defaults to AlignAuto and vertical alignment defaults to AlignTop..PP\fIbrect\fR (if not null) is set to the actual bounding rectangle of the output. \fIinternal\fR is, yes, internal..PPSee also boundingRect()..SH "void QPainter::drawTiledPixmap ( int x, int y, int w, int h, const QPixmap & pixmap, int sx = 0, int sy = 0 )"Draws a tiled \fIpixmap\fR in the specified rectangle..PP\fI(x, y)\fR specifies the top-left point in the paint device that is to be drawn onto; with the width and height given by \fIw\fR and \fIh\fR. \fI(sx, sy)\fR specifies the top-left point in \fIpixmap\fR that is to be drawn. The default is (0, 0)..PPCalling drawTiledPixmap() is similar to calling drawPixmap() several times to fill (tile) an area with a pixmap, but is potentially much more efficient depending on the underlying window system..PPSee also drawPixmap()..SH "void QPainter::drawTiledPixmap ( const QRect & r, const QPixmap & pm, const QPoint & sp )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPDraws a tiled pixmap, \fIpm\fR, inside rectangle \fIr\fR with its origin at point \fIsp\fR..SH "void QPainter::drawTiledPixmap ( const QRect & r, const QPixmap & pm )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPDraws a tiled pixmap, \fIpm\fR, inside rectangle \fIr\fR..SH "void QPainter::drawWinFocusRect ( int x, int y, int w, int h, const QColor & bgColor )"Draws a Windows focus rectangle with upper left corner at (\fIx\fR, \fIy\fR) and with width \fIw\fR and height \fIh\fR using a pen color that contrasts with \fIbgColor\fR..PPThis function draws a stippled rectangle (XOR is not used) that is used to indicate keyboard focus (when the QApplication::style() is \fCWindowStyle\fR)..PPThe pen color used to draw the rectangle is either white or black depending on the color of \fIbgColor\fR (see QColor::gray())..PP\fBWarning:\fR This function draws nothing if the coordinate system has been rotated or sheared..PPSee also drawRect() and QApplication::style()..SH "void QPainter::drawWinFocusRect ( int x, int y, int w, int h )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPDraws a Windows focus rectangle with upper left corner at (\fIx\fR, \fIy\fR) and with width \fIw\fR and height \fIh\fR..PPThis function draws a stippled XOR rectangle that is used to indicate keyboard focus (when QApplication::style() is \fCWindowStyle\fR)..PP\fBWarning:\fR This function draws nothing if the coordinate system has been rotated or sheared..PPSee also drawRect() and QApplication::style()..SH "void QPainter::drawWinFocusRect ( const QRect & r )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPDraws rectangle \fIr\fR as a window focus rectangle..SH "void QPainter::drawWinFocusRect ( const QRect & r, const QColor & bgColor )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPDraws rectangle \fIr\fR as a window focus rectangle using background color \fIbgColor\fR..SH "bool QPainter::end ()"Ends painting. Any resources used while painting are released..PPNote that while you mostly don't need to call end(), the destructor will do it, there is at least one common case when it is needed, namely double buffering..PP.nf.br        QPainter p( myPixmap, this ).br        // ....br        p.end(); // stops drawing on myPixmap.br        p.begin( this );.br        p.drawPixmap( myPixmap );.br.fi.PPSince you can't draw a QPixmap while it is being painted, it is necessary to close the active painter..PPSee also begin() and isActive()..PPExamples:.)l aclock/aclock.cpp, application/application.cpp, desktop/desktop.cpp, hello/hello.cpp, picture/picture.cpp, t10/cannon.cpp, and xform/xform.cpp..SH "void QPainter::eraseRect ( int x, int y, int w, int h )"Erases the area inside \fIx\fR, \fIy\fR, \fIw\fR, \fIh\fR. Equivalent to \fCfillRect( x, y, w, h, backgroundColor() )\fR..PPExamples:.)l listboxcombo/listboxcombo.cpp and showimg/showimg.cpp..SH "void QPainter::eraseRect ( const QRect & r )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPErases the area inside the rectangle \fIr\fR..SH "void QPainter::fillRect ( int x, int y, int w, int h, const QBrush & brush )"Fills the rectangle \fI(x, y, w, h)\fR with the \fIbrush\fR..PPYou can specify a QColor as \fIbrush\fR, since there is a QBrush constructor that takes a QColor argument and creates a solid pattern brush..PPSee also drawRect()..PPExamples:.)l listboxcombo/listboxcombo.cpp, progress/progress.cpp, qdir/qdir.cpp, qfd/fontdisplayer.cpp, themes/metal.cpp, and themes/wood.cpp..SH "void QPainter::fillRect ( const QRect & r, const QBrush & brush )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPFills the rectangle \fIr\fR using brush \fIbrush\fR..SH "void QPainter::flush ( const QRegion & region, CoordinateMode cm = CoordDevice )"Flushes any buffered drawing operations inside the region \fIregion\fR using clipping mode \fIcm\fR..PPThe flush may update the whole device if the platform does not support flushing to a specified region..PPSee also CoordinateMode..SH "void QPainter::flush ()"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPFlushes any buffered drawing operations..SH "const QFont & QPainter::font () const"Returns the currently set painter font..PPSee also setFont() and QFont..PPExample: fileiconview/qfileiconview.cpp..SH "QFontInfo QPainter::fontInfo () const"Returns the font info for the painter, if the painter is active. It is not possible to obtain font information for an inactive painter, so the return value is undefined if the painter is not active..PPSee also fontMetrics() and isActive()..SH "QFontMetrics QPainter::fontMetrics () const"Returns the font metrics for the painter, if the painter is active. It is not possible to obtain metrics for an inactive painter, so the return value is undefined if the painter is not active..PPSee also fontInfo() and isActive()..PPExamples:.)l action/application.cpp, application/application.cpp, desktop/desktop.cpp, drawdemo/drawdemo.cpp, helpviewer/helpwindow.cpp, mdi/application.cpp, and qwerty/qwerty.cpp..SH "HDC QPainter::handle () const"Returns the platform-dependent handle used for drawing. Using this function is not portable..SH "bool QPainter::hasClipping () const"Returns TRUE if clipping has been set; otherwise returns FALSE..PPSee also setClipping()..PPExample: themes/wood.cpp..SH "bool QPainter::hasViewXForm () const"Returns TRUE if view transformation is enabled; otherwise returns FALSE..PPSee also setViewXForm() and xForm()..SH "bool QPainter::hasWorldXForm () const"Returns TRUE if world transformation is enabled; otherwise returns FALSE..PPSee also setWorldXForm()..SH "bool QPainter::isActive () const"Returns TRUE if the painter is active painting, i.e. begin() has been called and end() has not yet been called; otherwise returns FALSE..PPSee also QPaintDevice::paintingActive()..PPExample: desktop/desktop.cpp..SH "void QPainter::lineTo ( int x, int y )"Draws a line from the current pen position to \fI(x, y)\fR and sets \fI(x, y)\fR to be the new current pen position..PPSee also QPen, moveTo(), drawLine(), and pos()..SH "void QPainter::lineTo ( const QPoint & p )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPDraws a line to the point \fIp\fR..SH "void QPainter::moveTo ( int x, int y )"Sets the current pen position to \fI(x, y)\fR.PPSee also lineTo() and pos()..SH "void QPainter::moveTo ( const QPoint & p )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPMoves to the point \fIp\fR..SH "const QPen & QPainter::pen () const"Returns the painter's current pen..PPSee also setPen()..PPExamples:.)l progress/progress.cpp and themes/wood.cpp..SH "QPoint QPainter::pos () const"Returns the current position of the pen..PPSee also moveTo()..SH "RasterOp QPainter::rasterOp () const"Returns the current raster operation..PPSee also setRasterOp() and RasterOp..SH "void QPainter::redirect ( QPaintDevice * pdev, QPaintDevice * replacement )\fC [static]\fR"Redirects all paint commands for a paint device, \fIpdev\fR, to another paint device, \fIreplacement\fR, unless \fIreplacement\fR is 0. If \fIreplacement\fR is 0, the redirection for \fIpdev\fR is removed..PPIn general, you'll probably find calling QPixmap::grabWidget() or QPixmap::grabWindow() is an easier solution..SH "void QPainter::resetXForm ()"Resets any transformations that were made using translate(), scale(), shear(), rotate(), setWorldMatrix(), setViewport() and setWindow()..PPSee also worldMatrix(), viewport(), and window()..SH "void QPainter::restore ()"Restores the current painter state (pops a saved state off the stack)..PPSee also save()..PPExample: aclock/aclock.cpp..SH "void QPainter::restoreWorldMatrix ()"\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code..PPWe recommend using restore() instead..SH "void QPainter::rotate ( double a )"Rotates the coordinate system \fIa\fR degrees counterclockwise..PPSee also translate(), scale(), shear(), resetXForm(), setWorldMatrix(), and xForm()..PPExamples:.)l aclock/aclock.cpp, t10/cannon.cpp, and t9/cannon.cpp.

⌨️ 快捷键说明

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