<qdrawutil.h> - Drawing Utility Functions
Header: | #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) |
(since 6.7) void | qDrawPlainRoundedRect(QPainter *painter, int x, int y, int width, int height, qreal rx, qreal ry, const QColor &lineColor, int lineWidth = 1, const QBrush *fill = nullptr) |
(since 6.7) void | qDrawPlainRoundedRect(QPainter *painter, const QRect &rect, qreal rx, qreal ry, 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)
qDrawBorderPixmap 函数用于在矩形的边缘绘制像素图。
使用给定的painter ,将给定的pixmap 绘制到给定的target 矩形中。像素图将被分成九段,并按照margins 结构绘制。
void qDrawBorderPixmap(QPainter *painter, const QRect &targetRect, const QMargins &targetMargins, const QPixmap &pixmap, const QRect &sourceRect, const QMargins &sourceMargins, const QTileRules &rules = QTileRules())
使用给定的painter ,将给定的sourceRect 矩形从给定的pixmap 绘制到给定的targetRect 矩形中。像素图将根据给定的targetMargins 和sourceMargins 结构分成九段。最后,将根据给定的rules 绘制像素图。
该函数用于绘制按比例缩放的像素图,类似于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)
width height使用指定的painter 、lineColor 和lineWidth ,绘制从 (x,y) 处开始的纯矩形。除非fill 是nullptr
,否则矩形内部将使用fill 笔刷填充。
警告: 此函数不查看QWidget::style() 或QApplication::style() 。请使用QStyle 中的绘图函数来制作遵循当前 GUI 风格的部件。
或者,您也可以使用QFrame widget 并应用QFrame::setFrameStyle() 函数来显示一个普通矩形:
另请参阅 qDrawShadeRect() 和QStyle 。
void qDrawPlainRect(QPainter *painter, const QRect &rect, const QColor &lineColor, int lineWidth = 1, const QBrush *fill = nullptr)
这是一个重载函数。
使用给定的painter 、lineColor 和lineWidth 绘制rect 指定的纯矩形。除非fill 是nullptr
,否则矩形内部将使用fill 笔刷填充。
警告: 此函数不查看QWidget::style() 或QApplication::style() 。请使用QStyle 中的绘图函数来制作遵循当前图形用户界面风格的部件。
或者,您也可以使用QFrame widget 并应用QFrame::setFrameStyle() 函数来显示一个普通矩形:
另请参阅 qDrawShadeRect() 和QStyle 。
[since 6.7]
void qDrawPlainRoundedRect(QPainter *painter, int x, int y, int width, int height, qreal rx, qreal ry, const QColor &lineColor, int lineWidth = 1, const QBrush *fill = nullptr)
绘制从 (x,y) 处开始的普通圆角矩形,使用给定的width 和height ,水平rx 和垂直半径ry ,指定的painter 、lineColor 和lineWidth 。除非fill 是nullptr
,否则矩形内部将使用fill 笔刷填充。
警告: 此函数不查看QWidget::style() 或QApplication::style() 。请使用QStyle 中的绘图函数来制作遵循当前 GUI 风格的部件。
或者,您也可以使用QFrame widget 并应用QFrame::setFrameStyle() 函数来显示一个普通矩形:
该函数在 Qt 6.7 中引入。
另请参阅 qDrawShadeRect() 和QStyle 。
[since 6.7]
void qDrawPlainRoundedRect(QPainter *painter, const QRect &rect, qreal rx, qreal ry, const QColor &lineColor, int lineWidth = 1, const QBrush *fill = nullptr)
这是一个重载函数。
使用水平rx 和垂直半径ry 、给定的painter 、lineColor 和lineWidth 绘制rect 指定的纯矩形。除非fill 是nullptr
,否则矩形内部将使用fill 笔刷填充。
警告: 此函数不查看QWidget::style() 或QApplication::style() 。请使用QStyle 中的绘图函数来制作遵循当前 GUI 风格的部件。
或者,您也可以使用QFrame widget 并应用QFrame::setFrameStyle() 函数来显示一个普通矩形:
该函数在 Qt 6.7 中引入。
另请参阅 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)
使用给定的painter 绘制水平 (y1 ==y2) 或垂直 (x1 ==x2) 阴影线。请注意,如果y1!=y2 和x1!=x2 (即线条既不是水平的,也不是垂直的),则不会绘制任何线条。
palette 指定阴影颜色(light 、dark 和middle 颜色)。lineWidth 指定每行的线宽,而不是总线宽。midLineWidth 指定以QPalette::mid() 颜色绘制的中间线的宽度。
如果sunken 为 true,线条会下沉,否则会上扬。
警告: 此函数不查看QWidget::style() 或QApplication::style() 。请使用QStyle 中的绘制函数来制作遵循当前图形用户界面风格的部件。
或者,您也可以使用QFrame widget 并应用QFrame::setFrameStyle() 函数来显示阴影线:
另请参阅 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)
这是一个重载函数。
使用给定的painter 在p1 和p2 之间绘制一条水平或垂直的阴影线。请注意,如果两点之间的线既非水平也非垂直,则不会绘制任何线。
palette 指定阴影颜色(light 、dark 和middle 颜色)。lineWidth 指定每条直线的线宽,而不是总线宽。midLineWidth 指定以QPalette::mid() 颜色绘制的中间线的宽度。
如果sunken 为 true,线条会下沉,否则会上扬。
警告: 此函数不查看QWidget::style() 或QApplication::style() 。请使用QStyle 中的绘制函数来制作遵循当前图形用户界面风格的部件。
或者,您也可以使用QFrame widget 并应用QFrame::setFrameStyle() 函数来显示阴影线:
另请参阅 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)
从 (x,y) 处开始,使用给定的width 和height 以及提供的painter 和给定的lineWidth 绘制阴影面板。
palette 指定了阴影颜色(light 、dark 和middle 颜色)。除非fill 是nullptr
,否则面板内部将使用fill 笔刷填充。
如果sunken 为 true,面板会出现凹陷,否则会凸起。
警告: 此函数不查看QWidget::style() 或QApplication::style() 。请使用QStyle 中的绘图函数来制作遵循当前 GUI 风格的部件。
或者,您也可以使用QFrame widget 并应用QFrame::setFrameStyle() 函数来显示阴影面板:
另请参阅 qDrawWinPanel(),qDrawShadeLine(),qDrawShadeRect() 和QStyle 。
void qDrawShadePanel(QPainter *painter, const QRect &rect, const QPalette &palette, bool sunken = false, int lineWidth = 1, const QBrush *fill = nullptr)
这是一个重载函数。
使用给定的painter 和lineWidth 在rect 指定的矩形区域绘制阴影面板。
给定的palette 指定了阴影颜色(light 、dark 和middle 颜色)。除非fill 是nullptr
,否则面板内部将使用fill 笔刷填充。
如果sunken 为 true,面板会出现凹陷,否则会凸起。
警告: 此函数不查看QWidget::style() 或QApplication::style() 。请使用QStyle 中的绘图函数来制作遵循当前 GUI 风格的部件。
或者,您也可以使用QFrame widget 并应用QFrame::setFrameStyle() 函数来显示阴影面板:
另请参阅 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)
使用提供的painter ,用给定的width 和height 绘制从 (x,y) 开始的阴影矩形。
palette 指定阴影颜色(light 、dark 和middle )。给定的lineWidth 指定了每一行的行宽,而不是总行宽。midLineWidth 指定了以QPalette::mid() 颜色绘制的中间线的宽度。除非fill 是nullptr
,否则矩形内部将使用fill 笔刷填充。
如果sunken 为 true,矩形会出现凹陷,否则会凸起。
警告: 此函数不查看QWidget::style() 或QApplication::style() 。请使用QStyle 中的绘图函数来制作遵循当前 GUI 风格的部件。
或者,您也可以使用QFrame widget 并应用QFrame::setFrameStyle() 函数来显示阴影矩形:
另请参阅 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)
这是一个重载函数。
使用给定的painter 绘制rect 指定的阴影矩形。
palette 指定阴影颜色(light 、dark 和middle )。给定的lineWidth 指定了每条线的线宽,而不是总线宽。midLineWidth 指定以QPalette::mid() 颜色绘制的中间线的宽度。除非fill 是nullptr
,否则矩形内部将使用fill 笔刷填充。
如果sunken 为 true,矩形会出现凹陷,否则会凸起。
警告: 此函数不查看QWidget::style() 或QApplication::style() 。请使用QStyle 中的绘图函数来制作遵循当前 GUI 风格的部件。
或者,您也可以使用QFrame widget 并应用QFrame::setFrameStyle() 函数来显示阴影矩形:
另请参阅 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)
使用提供的painter 以 2 像素的线宽绘制由给定点(x,y}、width 和height )指定的 Windows 风格按钮。除非fill 是nullptr
,否则按钮内部将使用fill 笔刷填充。
给定的palette 指定了阴影颜色(light 、dark 和middle 颜色)。
如果sunken 为 true,按钮会显示为凹陷,否则会凸起。
警告: 本函数不查看QWidget::style() 或QApplication::style()-> 使用QStyle 中的绘图函数来制作遵循当前 GUI 风格的部件。
另请参阅 qDrawWinPanel() 和QStyle 。
void qDrawWinButton(QPainter *painter, const QRect &rect, const QPalette &palette, bool sunken = false, const QBrush *fill = nullptr)
这是一个重载函数。
使用给定的painter 在rect 指定的矩形处绘制 Windows 风格按钮,线宽为 2 像素。除非fill 是nullptr
,否则按钮内部将使用fill 笔刷填充。
给定的palette 指定了阴影颜色(light 、dark 和middle 颜色)。
如果sunken 为 true,按钮会下沉,否则会上扬。
警告: 此函数不查看QWidget::style() 或QApplication::style()-> 使用QStyle 中的绘图函数制作遵循当前 GUI 风格的部件。
另请参阅 qDrawWinPanel() 和QStyle 。
void qDrawWinPanel(QPainter *painter, int x, int y, int width, int height, const QPalette &palette, bool sunken = false, const QBrush *fill = nullptr)
使用painter 以 2 像素的线宽绘制由给定点(x,y )、width 和height 指定的 Windows 风格面板。除非fill 是nullptr
,否则按钮内部将使用fill 笔刷填充。
给定的palette 指定了阴影颜色。如果sunken 为 true,面板会显示为凹陷,否则会凸起。
警告: 此函数不查看QWidget::style() 或QApplication::style() 。请使用QStyle 中的绘图函数来制作遵循当前图形用户界面风格的部件。
或者,您也可以使用QFrame widget 并应用QFrame::setFrameStyle() 函数来显示阴影面板:
另请参阅 qDrawShadePanel(),qDrawWinButton() 和QStyle 。
void qDrawWinPanel(QPainter *painter, const QRect &rect, const QPalette &palette, bool sunken = false, const QBrush *fill = nullptr)
这是一个重载函数。
使用给定的painter 在rect 指定的矩形处绘制 Windows 风格面板,线宽为 2 像素。除非fill 是nullptr
,否则按钮内部将使用fill 笔刷填充。
给定的palette 指定了阴影颜色。如果sunken 为 true,面板会显示为凹陷,否则会凸起。
警告: 此函数不查看QWidget::style() 或QApplication::style() 。请使用QStyle 中的绘图函数来制作遵循当前图形用户界面风格的部件。
或者,您也可以使用QFrame widget 并应用QFrame::setFrameStyle() 函数来显示阴影面板:
另请参阅 qDrawShadePanel(),qDrawWinButton() 和QStyle 。
© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.