<qdrawutil.h> - Drawing Utility Functions

头: #include <qdrawutil.h>

函数

void qDrawBorderPixmap (QPainter * painter , const QRect & target , const QMargins & margins , const QPixmap & pixmap )
void qDrawBorderPixmap (QPainter * painter , const QRect & targetRect , const QMargins & targetMargins , const QPixmap & pixmap , const QRect & sourceRect , const QMargins & sourceMargins , const QTileRules & rules = QTileRules())
void qDrawPlainRect (QPainter * painter , int x , int y , int width , int height , const QColor & lineColor , int lineWidth = 1, const QBrush * fill = nullptr)
void qDrawPlainRect (QPainter * painter , const QRect & rect , const QColor & lineColor , int lineWidth = 1, const QBrush * fill = nullptr)
void qDrawShadeLine (QPainter * painter , int x1 , int y1 , int x2 , int y2 , const QPalette & palette , bool sunken = true, int lineWidth = 1, int midLineWidth = 0)
void qDrawShadeLine (QPainter * painter , const QPoint & p1 , const QPoint & p2 , const QPalette & palette , bool sunken = true, int lineWidth = 1, int midLineWidth = 0)
void qDrawShadePanel (QPainter * painter , int x , int y , int width , int height , const QPalette & palette , bool sunken = false, int lineWidth = 1, const QBrush * fill = nullptr)
void qDrawShadePanel (QPainter * painter , const QRect & rect , const QPalette & palette , bool sunken = false, int lineWidth = 1, const QBrush * fill = nullptr)
void qDrawShadeRect (QPainter * painter , int x , int y , int width , int height , const QPalette & palette , bool sunken = false, int lineWidth = 1, int midLineWidth = 0, const QBrush * fill = nullptr)
void qDrawShadeRect (QPainter * painter , const QRect & rect , const QPalette & palette , bool sunken = false, int lineWidth = 1, int midLineWidth = 0, const QBrush * fill = nullptr)
void qDrawWinButton (QPainter * painter , int x , int y , int width , int height , const QPalette & palette , bool sunken = false, const QBrush * fill = nullptr)
void qDrawWinButton (QPainter * painter , const QRect & rect , const QPalette & palette , bool sunken = false, const QBrush * fill = nullptr)
void qDrawWinPanel (QPainter * painter , int x , int y , int width , int height , const QPalette & palette , bool sunken = false, const QBrush * fill = nullptr)
void qDrawWinPanel (QPainter * painter , const QRect & rect , const QPalette & palette , bool sunken = false, const QBrush * fill = nullptr)

详细描述

另请参阅 QPainter .

函数文档编制

void qDrawBorderPixmap ( QPainter * painter , const QRect & target , const QMargins & margins , const QPixmap & pixmap )

The qDrawBorderPixmap function is for drawing a pixmap into the margins of a rectangle.

绘制给定 pixmap 进给定 target rectangle, using the given painter . The pixmap will be split into nine segments and drawn according to the margins 结构。

void qDrawBorderPixmap ( QPainter * painter , const QRect & targetRect , const QMargins & targetMargins , const QPixmap & pixmap , const QRect & sourceRect , const QMargins & sourceMargins , const QTileRules & rules = QTileRules())

Draws the indicated sourceRect 矩形从给定 pixmap 进给定 targetRect rectangle, using the given painter . The pixmap will be split into nine segments according to the given targetMargins and sourceMargins structures. Finally, the pixmap will be drawn according to the given rules .

This function is used to draw a scaled pixmap, similar to CSS3 边框图像

另请参阅 Qt::TileRule , QTileRules ,和 QMargins .

void qDrawPlainRect ( QPainter * painter , int x , int y , int width , int height , const QColor & lineColor , int lineWidth = 1, const QBrush * fill = nullptr)

Draws the plain rectangle beginning at ( x , y ) 采用给定 width and height ,使用指定 painter , lineColor and lineWidth . The rectangle's interior is filled with the fill brush unless fill is nullptr .

警告: This function does not look at QWidget::style () 或 QApplication::style (). Use the drawing functions in QStyle to make widgets that follow the current GUI style.

Alternatively you can use a QFrame widget and apply the QFrame::setFrameStyle () function to display a plain rectangle:

QFrame frame:
frame.setFrameStyle(QFrame::Box | QFrame::Plain);
					

另请参阅 qDrawShadeRect () 和 QStyle .

void qDrawPlainRect ( QPainter * painter , const QRect & rect , const QColor & lineColor , int lineWidth = 1, const QBrush * fill = nullptr)

这是重载函数。

Draws the plain rectangle specified by rect 使用给定 painter , lineColor and lineWidth . The rectangle's interior is filled with the fill brush unless fill is nullptr .

警告: This function does not look at QWidget::style () 或 QApplication::style (). Use the drawing functions in QStyle to make widgets that follow the current GUI style.

Alternatively you can use a QFrame widget and apply the QFrame::setFrameStyle () function to display a plain rectangle:

QFrame frame:
frame.setFrameStyle(QFrame::Box | QFrame::Plain);
					

另请参阅 qDrawShadeRect () 和 QStyle .

void qDrawShadeLine ( QPainter * painter , int x1 , int y1 , int x2 , int y2 , const QPalette & palette , bool sunken = true, int lineWidth = 1, int midLineWidth = 0)

Draws a horizontal ( y1 == y2 ) or vertical ( x1 == x2 ) shaded line using the given painter . Note that nothing is drawn if y1 != y2 and x1 != x2 (i.e. the line is neither horizontal nor vertical).

提供的 palette specifies the shading colors ( light , dark and middle colors). The given lineWidth specifies the line width for each of the lines; it is not the total line width. The given midLineWidth specifies the width of a middle line drawn in the QPalette::mid () color.

The line appears sunken if sunken is true, otherwise raised.

警告: This function does not look at QWidget::style () 或 QApplication::style (). Use the drawing functions in QStyle to make widgets that follow the current GUI style.

Alternatively you can use a QFrame widget and apply the QFrame::setFrameStyle () function to display a shaded line:

QFrame frame:
frame.setFrameStyle(QFrame::HLine | QFrame::Sunken);
					

另请参阅 qDrawShadeRect (), qDrawShadePanel (),和 QStyle .

void qDrawShadeLine ( QPainter * painter , const QPoint & p1 , const QPoint & p2 , const QPalette & palette , bool sunken = true, int lineWidth = 1, int midLineWidth = 0)

这是重载函数。

Draws a horizontal or vertical shaded line between p1 and p2 使用给定 painter . Note that nothing is drawn if the line between the points would be neither horizontal nor vertical.

提供的 palette specifies the shading colors ( light , dark and middle colors). The given lineWidth specifies the line width for each of the lines; it is not the total line width. The given midLineWidth specifies the width of a middle line drawn in the QPalette::mid () color.

The line appears sunken if sunken is true, otherwise raised.

警告: This function does not look at QWidget::style () 或 QApplication::style (). Use the drawing functions in QStyle to make widgets that follow the current GUI style.

Alternatively you can use a QFrame widget and apply the QFrame::setFrameStyle () function to display a shaded line:

QFrame frame:
frame.setFrameStyle(QFrame::HLine | QFrame::Sunken);
					

另请参阅 qDrawShadeRect (), qDrawShadePanel (),和 QStyle .

void qDrawShadePanel ( QPainter * painter , int x , int y , int width , int height , const QPalette & palette , bool sunken = false, int lineWidth = 1, const QBrush * fill = nullptr)

Draws the shaded panel beginning at ( x , y ) 采用给定 width and height 使用提供 painter 和给定 lineWidth .

给定 palette specifies the shading colors ( light , dark and middle colors). The panel's interior is filled with the fill brush unless fill is nullptr .

The panel appears sunken if sunken is true, otherwise raised.

警告: This function does not look at QWidget::style () 或 QApplication::style (). Use the drawing functions in QStyle to make widgets that follow the current GUI style.

Alternatively you can use a QFrame widget and apply the QFrame::setFrameStyle () function to display a shaded panel:

QFrame frame:
frame.setFrameStyle( QFrame::Panel | QFrame::Sunken);
					

另请参阅 qDrawWinPanel (), qDrawShadeLine (), qDrawShadeRect (),和 QStyle .

void qDrawShadePanel ( QPainter * painter , const QRect & rect , const QPalette & palette , bool sunken = false, int lineWidth = 1, const QBrush * fill = nullptr)

这是重载函数。

Draws the shaded panel at the rectangle specified by rect 使用给定 painter 和给定 lineWidth .

给定 palette specifies the shading colors ( light , dark and middle colors). The panel's interior is filled with the fill brush unless fill is nullptr .

The panel appears sunken if sunken is true, otherwise raised.

警告: This function does not look at QWidget::style () 或 QApplication::style (). Use the drawing functions in QStyle to make widgets that follow the current GUI style.

Alternatively you can use a QFrame widget and apply the QFrame::setFrameStyle () function to display a shaded panel:

QFrame frame:
frame.setFrameStyle( QFrame::Panel | QFrame::Sunken);
					

另请参阅 qDrawWinPanel (), qDrawShadeLine (), qDrawShadeRect (),和 QStyle .

void qDrawShadeRect ( QPainter * painter , int x , int y , int width , int height , const QPalette & palette , bool sunken = false, int lineWidth = 1, int midLineWidth = 0, const QBrush * fill = nullptr)

Draws the shaded rectangle beginning at ( x , y ) 采用给定 width and height 使用提供 painter .

The provide palette specifies the shading colors ( light , dark and middle colors. The given lineWidth specifies the line width for each of the lines; it is not the total line width. The midLineWidth specifies the width of a middle line drawn in the QPalette::mid () color. The rectangle's interior is filled with the fill brush unless fill is nullptr .

The rectangle appears sunken if sunken is true, otherwise raised.

警告: This function does not look at QWidget::style () 或 QApplication::style (). Use the drawing functions in QStyle to make widgets that follow the current GUI style.

Alternatively you can use a QFrame widget and apply the QFrame::setFrameStyle () function to display a shaded rectangle:

QFrame frame:
frame.setFrameStyle(QFrame::Box | QFrame::Raised);
					

另请参阅 qDrawShadeLine (), qDrawShadePanel (), qDrawPlainRect (),和 QStyle .

void qDrawShadeRect ( QPainter * painter , const QRect & rect , const QPalette & palette , bool sunken = false, int lineWidth = 1, int midLineWidth = 0, const QBrush * fill = nullptr)

这是重载函数。

Draws the shaded rectangle specified by rect 使用给定 painter .

The provide palette specifies the shading colors ( light , dark and middle colors. The given lineWidth specifies the line width for each of the lines; it is not the total line width. The midLineWidth specifies the width of a middle line drawn in the QPalette::mid () color. The rectangle's interior is filled with the fill brush unless fill is nullptr .

The rectangle appears sunken if sunken is true, otherwise raised.

警告: This function does not look at QWidget::style () 或 QApplication::style (). Use the drawing functions in QStyle to make widgets that follow the current GUI style.

Alternatively you can use a QFrame widget and apply the QFrame::setFrameStyle () function to display a shaded rectangle:

QFrame frame:
frame.setFrameStyle(QFrame::Box | QFrame::Raised);
					

另请参阅 qDrawShadeLine (), qDrawShadePanel (), qDrawPlainRect (),和 QStyle .

void qDrawWinButton ( QPainter * painter , int x , int y , int width , int height , const QPalette & palette , bool sunken = false, const QBrush * fill = nullptr)

Draws the Windows-style button specified by the given point ( x , y }, width and height 使用提供 painter with a line width of 2 pixels. The button's interior is filled with the fill brush unless fill is nullptr .

给定 palette specifies the shading colors ( light , dark and middle colors).

The button appears sunken if sunken is true, otherwise raised.

警告: This function does not look at QWidget::style () 或 QApplication::style ()-> Use the drawing functions in QStyle to make widgets that follow the current GUI style.

另请参阅 qDrawWinPanel () 和 QStyle .

void qDrawWinButton ( QPainter * painter , const QRect & rect , const QPalette & palette , bool sunken = false, const QBrush * fill = nullptr)

这是重载函数。

Draws the Windows-style button at the rectangle specified by rect 使用给定 painter with a line width of 2 pixels. The button's interior is filled with the fill brush unless fill is nullptr .

给定 palette specifies the shading colors ( light , dark and middle colors).

The button appears sunken if sunken is true, otherwise raised.

警告: This function does not look at QWidget::style () 或 QApplication::style ()-> Use the drawing functions in QStyle to make widgets that follow the current GUI style.

另请参阅 qDrawWinPanel () 和 QStyle .

void qDrawWinPanel ( QPainter * painter , int x , int y , int width , int height , const QPalette & palette , bool sunken = false, const QBrush * fill = nullptr)

Draws the Windows-style panel specified by the given point( x , y ), width and height 使用提供 painter with a line width of 2 pixels. The button's interior is filled with the fill brush unless fill is nullptr .

给定 palette specifies the shading colors. The panel appears sunken if sunken is true, otherwise raised.

警告: This function does not look at QWidget::style () 或 QApplication::style (). Use the drawing functions in QStyle to make widgets that follow the current GUI style.

Alternatively you can use a QFrame widget and apply the QFrame::setFrameStyle () function to display a shaded panel:

QFrame frame:
frame.setFrameStyle(QFrame::WinPanel | QFrame::Raised);
					

另请参阅 qDrawShadePanel (), qDrawWinButton (),和 QStyle .

void qDrawWinPanel ( QPainter * painter , const QRect & rect , const QPalette & palette , bool sunken = false, const QBrush * fill = nullptr)

这是重载函数。

Draws the Windows-style panel at the rectangle specified by rect 使用给定 painter with a line width of 2 pixels. The button's interior is filled with the fill brush unless fill is nullptr .

给定 palette specifies the shading colors. The panel appears sunken if sunken is true, otherwise raised.

警告: This function does not look at QWidget::style () 或 QApplication::style (). Use the drawing functions in QStyle to make widgets that follow the current GUI style.

Alternatively you can use a QFrame widget and apply the QFrame::setFrameStyle () function to display a shaded panel:

QFrame frame:
frame.setFrameStyle(QFrame::WinPanel | QFrame::Raised);
					

另请参阅 qDrawShadePanel (), qDrawWinButton (),和 QStyle .