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

📄 qpainter.3qt

📁 Trolltech公司发布的基于C++图形开发环境
💻 3QT
📖 第 1 页 / 共 5 页
字号:
.PPThe window rectangle is part of the view transformation. The window specifies the logical coordinate system. Its sister, the viewport(), specifies the device coordinate system..PPThe default window rectangle is the same as the device's rectangle. See the Coordinate System Overview for an overview of coordinate transformation..PPSee also window(), setViewport(), setViewXForm(), setWorldMatrix() and setWorldXForm()..PPExamples:.(ldrawdemo/drawdemo.cpp.)l.SH "void QPainter::setWindow ( const QRect & r )"This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts..SH "void QPainter::setWorldMatrix ( const QWMatrix & m, bool combine=FALSE )"Sets the world transformation matrix to \fIm\fR and enables world transformation..PPIf \fIcombine\fR is TRUE, then \fIm\fR is combined with the current transformation matrix, otherwise \fIm\fR replaces the current transformation matrix..PPIf \fIm\fR the identity matrix and \fIcombine\fR is FALSE, this function calls setWorldXForm(FALSE). (The identity matrix is the matrix where QWMatrix::m11() and QWMatrix::m22() are 1.0 and the rest are 0.0.).PPWorld transformations are applied after the view transformations (i.e. window and viewport)..PPThe following functions can transform the coordinate system without using a QWMatrix:.TPtranslate().TPscale().TPshear().TProtate().PPThey operate on the painter's worldMatrix() and are implemented like this:.PP.nf.br    void QPainter::rotate( double a ).br    {.br        QWMatrix m;.br        m.rotate( a );.br        setWorldMatrix( m, TRUE );.br    }.fi.PPNote that you should always use \fIcombine\fR when you are drawing into a QPicture. Otherwise it may not be possible to replay the picture with additional transformations. Using translate(), scale(), etc. is safe..PPFor a brief overview of coordinate transformation, see the Coordinate System Overview..PPSee also worldMatrix(), setWorldXForm(), setWindow(), setViewport(), setViewXForm(), xForm() and QWMatrix..PPExamples:.(ldrawdemo/drawdemo.cpp.)l.SH "void QPainter::setWorldXForm ( bool enable )"Enables world transformations if \fIenable\fR is TRUE, or disables world transformations if \fIenable\fR is FALSE. The world transformation matrix is not changed..PPSee also setWorldMatrix(), setWindow(), setViewport(), setViewXForm() and xForm()..SH "void QPainter::shear ( double sh, double sv )"Shears the coordinate system \fI(sh,sv).\fR.PPSee also translate(), scale(), rotate(), resetXForm(), setWorldMatrix() and xForm()..SH "int * QPainter::tabArray () const"Returns the currently set tab stop array..PPSee also setTabArray()..SH "int QPainter::tabStops () const"Returns the tab stop setting..PPSee also setTabStops()..SH "void QPainter::translate ( double dx, double dy )"Translates the coordinate system by \fI(dx,dy).\fR.PPFor example, the following code draws a single vertical line 20 pixels high..PP.nf.br    void MyWidget::paintEvent().br    {.br        QPainter paint( this );.br        paint.drawLine(10,0,10,20);.br        paint.translate(100.0,100.0);.br        paint.drawLine(-90,-80,-90,-70);.br    }.fi.PPSee also scale(), shear(), rotate(), resetXForm(), setWorldMatrix() and xForm()..SH "QRect QPainter::viewport () const"Returns the viewport rectangle..PPSee also setViewport() and setViewXForm()..SH "QRect QPainter::window () const"Returns the window rectangle..PPSee also setWindow() and setViewXForm()..SH "const QWMatrix & QPainter::worldMatrix () const"Returns the world transformation matrix..PPSee also setWorldMatrix()..SH "QPoint QPainter::xForm ( const QPoint & pv ) const"Returns the point \fIpv\fR transformed from model coordinates to device coordinates..PPSee also xFormDev() and QWMatrix::map()..SH "QPointArray QPainter::xForm ( const QPointArray & av ) const"This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts..PPReturns the point array \fIav\fR transformed from model coordinates to device coordinates..PPSee also xFormDev() and QWMatrix::map()..SH "QPointArray QPainter::xForm ( const QPointArray & av, int index, int npoints ) const"This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts..PPReturns the point array \fIav\fR transformed from model coordinates to device coordinates. The \fIindex\fR is the first point in the array and \fInpoints\fR denotes the number of points to be transformed. If \fInpoints\fR is negative, all points from \fIav[index]\fR until the last point in the array are transformed..PPThe returned point array consists of the number of points that were transformed..PPExample:.PP.nf.br    QPointArray a(10);.br    QPointArray b;.br    b = painter.xForm(a,2,4);   // b.size() == 4.br    b = painter.xForm(a,2,-1);  // b.size() == 8.fi.PPSee also xFormDev() and QWMatrix::map()..SH "QRect QPainter::xForm ( const QRect & rv ) const"This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts..PPReturns the rectangle \fIrv\fR transformed from model coordinates to device coordinates..PPIf world transformation is enabled and rotation or shearing has been specified, then the bounding rectangle is returned..PPSee also xFormDev() and QWMatrix::map()..SH "QPoint QPainter::xFormDev ( const QPoint & pd ) const"Returns the point \fIpd\fR transformed from device coordinates to model coordinates..PPSee also xForm() and QWMatrix::map()..SH "QPointArray QPainter::xFormDev ( const QPointArray & ad ) const"Returns the point array \fIad\fR transformed from device coordinates to model coordinates..PPSee also xForm() and QWMatrix::map()..SH "QRect QPainter::xFormDev ( const QRect & rd ) const"Returns the rectangle \fIrd\fR transformed from device coordinates to model coordinates..PPIf world transformation is enabled and rotation or shearing is used, then the bounding rectangle is returned..PPSee also xForm() and QWMatrix::map()..SH "QPointArray QPainter::xFormDev ( const QPointArray & ad, int index, int npoints ) const"This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts..PPReturns the point array \fIad\fR transformed from device coordinates to model coordinates. The \fIindex\fR is the first point in the array and \fInpoints\fR denotes the number of points to be transformed. If \fInpoints\fR is negative, all points from \fIad[index]\fR until the last point in the array are transformed..PPThe returned point array consists of the number of points that were transformed..PPExample:.PP.nf.br    QPointArray a(10);.br    QPointArray b;.br    b = painter.xFormDev(a,1,3);        // b.size() == 3.br    b = painter.xFormDev(a,1,-1);       // b.size() == 9.fi.PPSee also xForm() and QWMatrix::map()..SH RELATED FUNCTION DOCUMENTATION.SH "void qDrawPlainRect (QPainter * p, int x, int y, int w, int h, const QColor & c, int lineWidth, const QBrush * fill)"\fC#include <qdrawutil.h>\fR.PPDraws a plain rectangle given by (\fIx, y, w, h)\fR using the painter \fIp.\fR.PPThe color argument \fIc\fR specifies the line color..PPThe \fIlineWidth\fR argument specifies the line width..PPThe rectangle interior is filled with the \fIfill\fR brush unless \fIfill\fR is null..PPIf you want to use a QFrame widget instead, you can make it display a plain rectangle, for example \fCQFrame::setFrameStyle( QFrame::Box | QFrame::Plain )\fR..PP\fBWarning:\fR This function does not look at QWidget::style() or QApplication::style(). Use the drawing functions in QStyle to make widgets that follow the current GUI style..PPSee also qDrawShadeRect() and QStyle::drawRect()..SH "void qDrawWinPanel (QPainter * p, int x, int y, int w, int h, const QColorGroup & g, bool sunken, const QBrush * fill)"\fC#include <qdrawutil.h>\fR.PPDraws a Windows-style panel given by (\fIx, y, w, h)\fR using the painter \fIp.\fR.PPThe color group argument \fIg\fR specifies the shading colors..PPThe panel appears sunken if \fIsunken\fR is TRUE, or raised if \fIsunken\fR is FALSE..PPThe line width is 2 pixels..PPThe button interior is filled with the \fIfill\fR brush unless \fIfill\fR is null..PPIf you want to use a QFrame widget instead, you can make it display a shaded panel, for example \fCQFrame::setFrameStyle( QFrame::WinPanel | QFrame::Raised )\fR..PP\fBWarning:\fR This function does not look at QWidget::style() or QApplication::style(). Use the drawing functions in QStyle to make widgets that follow the current GUI style..PPSee also qDrawShadePanel(), qDrawWinButton() and QStyle::drawPanel()..SH "void qDrawShadeLine (QPainter * p, int x1, int y1, int x2, int y2, const QColorGroup & g, bool sunken, int lineWidth, int midLineWidth)"\fC#include <qdrawutil.h>\fR.PPDraws a horizontal (\fIy1\fR == \fIy2)\fR or vertical (\fIx1\fR == \fIx2)\fR shaded line using the painter \fIp.\fR.PPNothing is drawn if \fIy1\fR != \fIy2\fR and \fIx1\fR != \fIx2\fR (i.e. the line is neither horizontal nor vertical)..PPThe color group argument \fIg\fR specifies the shading colors (light, dark and middle colors)..PPThe line appears sunken if \fIsunken\fR is TRUE, or raised if \fIsunken\fR is FALSE..PPThe \fIlineWidth\fR argument specifies the line width for each of the lines. It is not the total line width..PPThe \fImidLineWidth\fR argument specifies the width of a middle line drawn in the QColorGroup::mid() color..PPIf you want to use a QFrame widget instead, you can make it display a shaded line, for example \fCQFrame::setFrameStyle( QFrame::HLine | QFrame::Sunken )\fR..PP\fBWarning:\fR This function does not look at QWidget::style() or QApplication::style(). Use the drawing functions in QStyle to make widgets that follow the current GUI style..PPSee also qDrawShadeRect(), qDrawShadePanel() and QStyle::drawSeparator()..SH "void qDrawShadeRect (QPainter * p, int x, int y, int w, int h, const QColorGroup & g, bool sunken, int lineWidth, int midLineWidth, const QBrush * fill)"\fC#include <qdrawutil.h>\fR.PPDraws a shaded rectangle/box given by (\fIx, y, w, h)\fR using the painter \fIp.\fR.PPThe color group argument \fIg\fR specifies the shading colors (light, dark and middle colors)..PPThe rectangle appears sunken if \fIsunken\fR is TRUE, or raised if \fIsunken\fR is FALSE..PPThe \fIlineWidth\fR argument specifies the line width for each of the lines. It is not the total line width..PPThe \fImidLineWidth\fR argument specifies the width of a middle line drawn in the QColorGroup::mid() color..PPThe rectangle interior is filled with the \fIfill\fR brush unless \fIfill\fR is null..PPIf you want to use a QFrame widget instead, you can make it display a shaded rectangle, for example \fCQFrame::setFrameStyle( QFrame::Box | QFrame::Raised )\fR..PP\fBWarning:\fR This function does not look at QWidget::style() or QApplication::style(). Use the drawing functions in QStyle to make widgets that follow the current GUI style..PPSee also qDrawShadeLine(), qDrawShadePanel(), qDrawPlainRect(), QStyle::drawRect() and QStyle::drawRectStrong()..SH "void qDrawShadePanel (QPainter * p, int x, int y, int w, int h, const QColorGroup & g, bool sunken, int lineWidth, const QBrush * fill)"\fC#include <qdrawutil.h>\fR.PPDraws a shaded panel given by (\fIx, y, w, h)\fR using the painter \fIp.\fR.PPThe color group argument \fIg\fR specifies the shading colors (light, dark and middle colors)..PPThe panel appears sunken if \fIsunken\fR is TRUE, or raised if \fIsunken\fR is FALSE..PPThe \fIlineWidth\fR argument specifies the line width..PPThe panel interior is filled with the \fIfill\fR brush unless \fIfill\fR is null..PPIf you want to use a QFrame widget instead, you can make it display a shaded panel, for example \fCQFrame::setFrameStyle( QFrame::Panel | QFrame::Sunken )\fR..PP\fBWarning:\fR This function does not look at QWidget::style() or QApplication::style(). Use the drawing functions in QStyle to make widgets that follow the current GUI style..PPSee also qDrawWinPanel(), qDrawShadeLine(), qDrawShadeRect() and QStyle::drawPanel()..SH "void qDrawWinButton (QPainter * p, int x, int y, int w, int h, const QColorGroup & g, bool sunken, const QBrush * fill)"\fC#include <qdrawutil.h>\fR.PPDraws a Windows-style button given by (\fIx, y, w, h)\fR using the painter \fIp.\fR.PPThe color group argument \fIg\fR specifies the shading colors (light, dark and middle colors)..PPThe button appears sunken if \fIsunken\fR is TRUE, or raised if \fIsunken\fR is FALSE..PPThe line width is 2 pixels..PPThe button interior is filled with the \fI*fill\fR brush unless \fIfill\fR is null..PP\fBWarning:\fR This function does not look at QWidget::style() or QApplication::style(). Use the drawing functions in QStyle to make widgets that follow the current GUI style..PPSee also  qDrawWinPanel() and QStyle::drawButton()..SH "SEE ALSO".BR http://doc.trolltech.com/qpainter.html.BR http://www.trolltech.com/faq/tech.html.SH COPYRIGHTCopyright 1992-2001 Trolltech AS, http://www.trolltech.com.  See thelicense file included in the distribution for a complete licensestatement..SH AUTHORGenerated automatically from the source code..SH BUGSIf you find a bug in Qt, please report it as described in.BR http://doc.trolltech.com/bughowto.html .Good bug reports make our job much simpler. Thank you..PIn case of content or formattting problems with this man

⌨️ 快捷键说明

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