📄 qpen.3qt
字号:
'\" t.TH QPen 3qt "5 March 2001" "Trolltech AS" \" -*- nroff -*-.\" Copyright 1992-2001 Trolltech AS. All rights reserved. See the.\" license file included in the distribution for a complete license.\" statement..\".ad l.nh.SH NAMEQPen \- Defines how a.br.PP\fC#include <qpen.h>\fR.PPInherits Qt..PP.SS "Public Members".in +1c.ti -1c.BI "\fBQPen\fR () ".br.ti -1c.BI "\fBQPen\fR ( PenStyle ) ".br.ti -1c.BI "\fBQPen\fR ( const QColor & " "color" ", uint " "width" "=0, PenStyle " "style" "=SolidLine ) ".br.ti -1c.BI "\fBQPen\fR ( const QColor & " "cl" ", uint " "w" ", PenStyle " "s" ", PenCapStyle " "c" ", PenJoinStyle j ) ".br.ti -1c.BI "\fBQPen\fR ( const QPen & ) ".br.ti -1c.BI "\fB~QPen\fR () ".br.ti -1c.BI "QPen& \fBoperator=\fR ( const QPen & ) ".br.ti -1c.BI "PenStyle \fBstyle\fR () const".br.ti -1c.BI "void \fBsetStyle\fR ( PenStyle ) ".br.ti -1c.BI "uint \fBwidth\fR () const".br.ti -1c.BI "void \fBsetWidth\fR ( uint ) ".br.ti -1c.BI "const QColor& \fBcolor\fR () const".br.ti -1c.BI "void \fBsetColor\fR ( const QColor & ) ".br.ti -1c.BI "PenCapStyle \fBcapStyle\fR () const".br.ti -1c.BI "void \fBsetCapStyle\fR ( PenCapStyle ) ".br.ti -1c.BI "PenJoinStyle \fBjoinStyle\fR () const".br.ti -1c.BI "void \fBsetJoinStyle\fR ( PenJoinStyle ) ".br.ti -1c.BI "bool \fBoperator==\fR ( const QPen & p ) const".br.ti -1c.BI "bool \fBoperator!=\fR ( const QPen & p ) const".br.in -1c.SH RELATED FUNCTION DOCUMENTATION(Note that these are not member functions.).in +1c.ti -1c.BI "QDataStream & \fBoperator<<\fR (QDataStream & " "s" ", const QPen & " "p" ")".br.ti -1c.BI "QDataStream & \fBoperator>>\fR (QDataStream & " "s" ", QPen & " "p" ")".br.in -1c.SH DESCRIPTIONThe QPen class defines how a QPainter should draw lines and outlines of shapes..PPA pen has a style, a width, a color, a cap style and a join style..PPThe pen style defines the line type. The default pen style is \fCQt::SolidLine.\fR Setting the style to \fCNoPen\fR tells the painter to not draw lines or outlines..PPThe pen width defines the line width. The default line width is 0, which draws a 1-pixel line very fast, but with lower precision than with a line width of 1. Setting the line width to 1 or more draws lines that are precise, but drawing is slower..PPThe pen color defines the color of lines and text. The default line color is black. The QColor documentation lists predefined colors..PPThe cap style defines how the end points of lines are drawn. The join style defines how the joins between two lines drawn when multiple, connected lines are drawn (QPainter::drawPolyLine() etc.). The cap and join styles apply only to wide lines, i.e. when the width is 1 or greater..PPUse the QBrush class for specifying fill styles..PPExample:.PP.nf.br QPainter painter;.br QPen pen( red, 2 ); // red solid line, 2 pixel width.br painter.begin( &anyPaintDevice ); // paint something.br painter.setPen( pen ); // set the red, fat pen.br painter.drawRect( 40,30, 200,100 ); // draw rectangle.br painter.setPen( blue ); // set blue pen, 0 pixel width.br painter.drawLine( 40,30, 240,130 ); // draw diagonal in rectangle.br painter.end(); // painting done.fi.PPSee the setStyle() function for a complete list of pen styles..PPAbout the end point of lines: For wide (non-0-width) pens, it depends on the cap style whether the end point is drawn or not. For 0-width pens, QPainter will try to make sure that the end point is drawn, but this cannot be absolutely guaranteed, since the underlying drawing engine is free to use any (typically accellerated) algorithm for drawing 0-width lines. On all tested systems, however, the endpoint of at least all non-diagonal lines are drawn..PPSee also QPainter and QPainter::setPen()..PPExamples:.(lprogress/progress.cpp desktop/desktop.cpp.)l.SH MEMBER FUNCTION DOCUMENTATION.SH "QPen::QPen ()"Constructs a default black solid line pen with 0 width..SH "QPen::QPen ( PenStyle style )"Constructs a pen black with 0 width and a specified style..PPSee also setStyle()..SH "QPen::QPen ( const QColor & cl, uint w, PenStyle s, PenCapStyle c, PenJoinStyle j )"Constructs a pen with a specified color, width and styles..PPSee also setWidth(), setStyle() and setColor()..SH "QPen::QPen ( const QColor & color, uint width=0, PenStyle style=SolidLine )"Constructs a pen with a specified color, width and style..PPSee also setWidth(), setStyle() and setColor()..SH "QPen::QPen ( const QPen & p )"Constructs a pen which is a copy of \fIp.\fR.SH "QPen::~QPen ()"Destructs the pen..SH "Qt::PenCapStyle QPen::capStyle() const"Returns the pen's cap style..PPSee also setCapStyle()..SH "const QColor & QPen::color () const"Returns the pen color..PPSee also setColor()..SH "Qt::PenJoinStyle QPen::joinStyle() const"Returns the pen's join style..PPSee also setJoinStyle()..SH "bool QPen::operator!= ( const QPen & p ) const"Returns TRUE if the pen is different from \fIp,\fR or FALSE if the pens are equal..PPTwo pens are different if they have different styles, widths or colors..PPSee also operator==()..SH "QPen & QPen::operator= ( const QPen & p )"Assigns \fIc\fR to this pen and returns a reference to this pen..SH "bool QPen::operator== ( const QPen & p ) const"Returns TRUE if the pen is equal to \fIp,\fR or FALSE if the pens are different..PPTwo pens are equal if they have equal styles, widths and colors..PPSee also operator!=()..SH "void QPen::setCapStyle ( PenCapStyle c )"Sets the pen's cap style to \fIc.\fR.PPThe default value is FlatCap. The cap style has no effect on 0-width pens..PP\fBWarning:\fR On Windows 95/98, the cap style setting has no effect. Wide lines are rendered as if the cap style was SquareCap..PPSee also capStyle()..SH "void QPen::setColor ( const QColor & c )"Sets the pen color to \fIc.\fR.PPSee also color()..PPExamples:.(lprogress/progress.cpp.)l.SH "void QPen::setJoinStyle ( PenJoinStyle j )"Sets the pen's join style to \fIj.\fR.PPThe default value is MiterJoin. The join style has no effect on 0-width pens..PP\fBWarning:\fR On Windows 95/98, the join style setting has no effect. Wide lines are rendered as if the join style was BevelJoin..PPSee also joinStyle()..SH "void QPen::setStyle ( PenStyle s )"Sets the pen style to \fIs..PP\fBWarning:\fR\fR On Windows 95/98, the style setting (other than NoPen and SolidLine) has no effect for lines with width greater than 1..PPSee also style()..SH "void QPen::setWidth ( uint w )"Sets the pen width to \fIw.\fR.PPSee also width()..PPExamples:.(lprogress/progress.cpp.)l.SH "PenStyle QPen::style () const"Returns the pen style..PPSee also setStyle()..SH "uint QPen::width () const"Returns the pen width..PPSee also setWidth()..SH RELATED FUNCTION DOCUMENTATION.SH "QDataStream & operator<< (QDataStream & s, const QPen & p)"Writes a pen to the stream and returns a reference to the stream..PPSee also Format of the QDataStream operators.SH "QDataStream & operator>> (QDataStream & s, QPen & p)"Reads a pen from the stream and returns a reference to the stream..PPSee also Format of the QDataStream operators.SH "SEE ALSO".BR http://doc.trolltech.com/qpen.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 manual page, pleasereport them to.BR qt-bugs@trolltech.com .Please include the name of the manual page (qpen.3qt) and the Qtversion (2.3.0).
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -