KVIrc 5.2.6
Developer APIs
KvsObject_painter.cpp File Reference
#include "KvsObject_painter.h"
#include "KvsObject_pixmap.h"
#include "KvsObject_widget.h"
#include "kvi_debug.h"
#include "KviLocale.h"
#include "KviError.h"
#include "KviIconManager.h"
#include "KviMemory.h"
#include <QPrintDialog>
#include <QTextDocument>
#include <QIcon>

Macros

#define align_num   (sizeof(align_tbl) / sizeof(align_tbl[0]))
 
#define brushstyles_num   (sizeof(brushstyles_tbl) / sizeof(brushstyles_tbl[0]))
 
#define composition_num   (sizeof(composition_tbl) / sizeof(composition_tbl[0]))
 
#define KVSO_2ARRAYPARAMETERS(__pXOrArray, __iY)
 
#define KVSO_3OR4ARRAYPARAMETERS(__pCol1OrArray, __iCol2, __iCol3, __iOpacity)
 
#define KVSO_PARAMETERS_PAINTER(__pXOrArray, __iY, __iW, __iH)
 
#define PAINTER_ROTATE(__angle, __axis)
 
#define PAINTER_SCALE(__sX, __sY)
 
#define PAINTER_SHEAR(__sH, __sV)
 
#define PAINTER_TRANSLATE(__x, __y)
 
#define penstyles_num   (sizeof(penstyles_tbl) / sizeof(penstyles_tbl[0]))
 

Functions

 if (m_pGradient) delete m_pGradient
 
 if (m_pPainter &&!bDonotdeleteinternalqpainter) delete m_pPainter
 
 if (m_pPainterPath) delete m_pPainterPath
 
 if (m_pPrinter) delete m_pPrinter
 
 KVSO_CLASS_FUNCTION (painter, begin)
 
 KVSO_CLASS_FUNCTION (painter, beginPdf)
 
 KVSO_CLASS_FUNCTION (painter, clearGradient)
 
 KVSO_CLASS_FUNCTION (painter, colorNames)
 
 KVSO_CLASS_FUNCTION (painter, drawArc)
 
 KVSO_CLASS_FUNCTION (painter, drawChord)
 
 KVSO_CLASS_FUNCTION (painter, drawEllipse)
 
 KVSO_CLASS_FUNCTION (painter, drawHtmlText)
 
 KVSO_CLASS_FUNCTION (painter, drawIcon)
 
 KVSO_CLASS_FUNCTION (painter, drawLine)
 
 KVSO_CLASS_FUNCTION (painter, drawPath)
 
 KVSO_CLASS_FUNCTION (painter, drawPie)
 
 KVSO_CLASS_FUNCTION (painter, drawPixmap)
 
 KVSO_CLASS_FUNCTION (painter, drawPixmapMirrored)
 
 KVSO_CLASS_FUNCTION (painter, drawPixmapWithColorEffect)
 
 KVSO_CLASS_FUNCTION (painter, drawPoint)
 
 KVSO_CLASS_FUNCTION (painter, drawRect)
 
 KVSO_CLASS_FUNCTION (painter, drawRoundRect)
 
 KVSO_CLASS_FUNCTION (painter, drawText)
 
 KVSO_CLASS_FUNCTION (painter, end)
 
 KVSO_CLASS_FUNCTION (painter, fillRect)
 
 KVSO_CLASS_FUNCTION (painter, fontAscent)
 
 KVSO_CLASS_FUNCTION (painter, fontDescent)
 
 KVSO_CLASS_FUNCTION (painter, fontMetricsHeight)
 
 KVSO_CLASS_FUNCTION (painter, fontMetricsWidth)
 
 KVSO_CLASS_FUNCTION (painter, htmlTextSize)
 
 KVSO_CLASS_FUNCTION (painter, painterDeviceHeight)
 
 KVSO_CLASS_FUNCTION (painter, painterDeviceWidth)
 
 KVSO_CLASS_FUNCTION (painter, pathAddText)
 
 KVSO_CLASS_FUNCTION (painter, pathLineTo)
 
 KVSO_CLASS_FUNCTION (painter, pathMoveTo)
 
 KVSO_CLASS_FUNCTION (painter, pen)
 
 KVSO_CLASS_FUNCTION (painter, reset)
 
 KVSO_CLASS_FUNCTION (painter, resetPath)
 
 KVSO_CLASS_FUNCTION (painter, restore)
 
 KVSO_CLASS_FUNCTION (painter, rotate)
 
 KVSO_CLASS_FUNCTION (painter, save)
 
 KVSO_CLASS_FUNCTION (painter, scale)
 
 KVSO_CLASS_FUNCTION (painter, setAntialiasing)
 
 KVSO_CLASS_FUNCTION (painter, setBackGroundMode)
 
 KVSO_CLASS_FUNCTION (painter, setBrush)
 
 KVSO_CLASS_FUNCTION (painter, setBrushStyle)
 
 KVSO_CLASS_FUNCTION (painter, setCompositionMode)
 
 KVSO_CLASS_FUNCTION (painter, setFont)
 
 KVSO_CLASS_FUNCTION (painter, setFontSize)
 
 KVSO_CLASS_FUNCTION (painter, setGradientAsBrush)
 
 KVSO_CLASS_FUNCTION (painter, setGradientColor)
 
 KVSO_CLASS_FUNCTION (painter, setGradientStart)
 
 KVSO_CLASS_FUNCTION (painter, setGradientStop)
 
 KVSO_CLASS_FUNCTION (painter, setOpacity)
 
 KVSO_CLASS_FUNCTION (painter, setPen)
 
 KVSO_CLASS_FUNCTION (painter, setPenCapStyle)
 
 KVSO_CLASS_FUNCTION (painter, setPenJoinStyle)
 
 KVSO_CLASS_FUNCTION (painter, setPenStyle)
 
 KVSO_CLASS_FUNCTION (painter, setPenWidth)
 
 KVSO_CLASS_FUNCTION (painter, setSmoothPixmapTransform)
 
 KVSO_CLASS_FUNCTION (painter, setTextAntialiasing)
 
 KVSO_CLASS_FUNCTION (painter, shear)
 
 KVSO_CLASS_FUNCTION (painter, translate)
 

Variables

const int align_cod []
 
const char *const align_tbl []
 
 bDonotdeleteinternalqpainter = false
 
const Qt::BrushStyle brushstyles_cod []
 
const char *const brushstyles_tbl []
 
const QPainter::CompositionMode composition_cod []
 
const char *const composition_tbl []
 
 m_pDeviceObject = nullptr
 
 m_pGradient = nullptr
 
 m_pPainter = new QPainter()
 
 m_pPainterPath = nullptr
 
 m_pPrinter = nullptr
 
const Qt::PenStyle penstyles_cod []
 
const char *const penstyles_tbl []
 

Macro Definition Documentation

◆ align_num

#define align_num   (sizeof(align_tbl) / sizeof(align_tbl[0]))

◆ brushstyles_num

#define brushstyles_num   (sizeof(brushstyles_tbl) / sizeof(brushstyles_tbl[0]))

Referenced by KVSO_CLASS_FUNCTION().

◆ composition_num

#define composition_num   (sizeof(composition_tbl) / sizeof(composition_tbl[0]))

Referenced by KVSO_CLASS_FUNCTION().

◆ KVSO_2ARRAYPARAMETERS

#define KVSO_2ARRAYPARAMETERS ( __pXOrArray,
__iY )

Referenced by KVSO_CLASS_FUNCTION().

◆ KVSO_3OR4ARRAYPARAMETERS

#define KVSO_3OR4ARRAYPARAMETERS ( __pCol1OrArray,
__iCol2,
__iCol3,
__iOpacity )

◆ KVSO_PARAMETERS_PAINTER

#define KVSO_PARAMETERS_PAINTER ( __pXOrArray,
__iY,
__iW,
__iH )

◆ PAINTER_ROTATE

#define PAINTER_ROTATE ( __angle,
__axis )
Value:
QTransform transform; \
transform.rotate(__angle, __axis); \
m_pPainter->setTransform(transform, true);
m_pPainter
Definition KvsObject_painter.cpp:611

Referenced by KVSO_CLASS_FUNCTION().

◆ PAINTER_SCALE

#define PAINTER_SCALE ( __sX,
__sY )
Value:
QTransform transform; \
transform.scale(__sX, __sY); \
m_pPainter->setTransform(transform, true);

Referenced by KVSO_CLASS_FUNCTION().

◆ PAINTER_SHEAR

#define PAINTER_SHEAR ( __sH,
__sV )
Value:
QTransform transform; \
transform.shear(__sH, __sV); \
m_pPainter->setTransform(transform, true);

Referenced by KVSO_CLASS_FUNCTION().

◆ PAINTER_TRANSLATE

#define PAINTER_TRANSLATE ( __x,
__y )
Value:
QTransform transform; \
transform.translate(__x, __y); \
m_pPainter->setTransform(transform, true);

Referenced by KVSO_CLASS_FUNCTION().

◆ penstyles_num

#define penstyles_num   (sizeof(penstyles_tbl) / sizeof(penstyles_tbl[0]))

Referenced by KVSO_CLASS_FUNCTION().

Function Documentation

◆ if() [1/4]

if ( m_pGradient )

References if(), and m_pGradient.

◆ if() [2/4]

if ( m_pPainter &&! bDonotdeleteinternalqpainter)

◆ if() [3/4]

References if(), and m_pPainterPath.

◆ if() [4/4]

if ( m_pPrinter )

◆ KVSO_CLASS_FUNCTION() [1/59]

◆ KVSO_CLASS_FUNCTION() [2/59]

KVSO_CLASS_FUNCTION ( painter ,
beginPdf  )

◆ KVSO_CLASS_FUNCTION() [3/59]

KVSO_CLASS_FUNCTION ( painter ,
clearGradient  )

References m_pGradient.

◆ KVSO_CLASS_FUNCTION() [4/59]

KVSO_CLASS_FUNCTION ( painter ,
colorNames  )

References a, CHECK_INTERNAL_POINTER, i, and m_pPainter.

◆ KVSO_CLASS_FUNCTION() [5/59]

◆ KVSO_CLASS_FUNCTION() [6/59]

◆ KVSO_CLASS_FUNCTION() [7/59]

◆ KVSO_CLASS_FUNCTION() [8/59]

KVSO_CLASS_FUNCTION ( painter ,
drawHtmlText  )

◆ KVSO_CLASS_FUNCTION() [9/59]

◆ KVSO_CLASS_FUNCTION() [10/59]

◆ KVSO_CLASS_FUNCTION() [11/59]

KVSO_CLASS_FUNCTION ( painter ,
drawPath  )

◆ KVSO_CLASS_FUNCTION() [12/59]

◆ KVSO_CLASS_FUNCTION() [13/59]

◆ KVSO_CLASS_FUNCTION() [14/59]

◆ KVSO_CLASS_FUNCTION() [15/59]

◆ KVSO_CLASS_FUNCTION() [16/59]

◆ KVSO_CLASS_FUNCTION() [17/59]

◆ KVSO_CLASS_FUNCTION() [18/59]

◆ KVSO_CLASS_FUNCTION() [19/59]

◆ KVSO_CLASS_FUNCTION() [20/59]

KVSO_CLASS_FUNCTION ( painter ,
end  )

◆ KVSO_CLASS_FUNCTION() [21/59]

◆ KVSO_CLASS_FUNCTION() [22/59]

KVSO_CLASS_FUNCTION ( painter ,
fontAscent  )

◆ KVSO_CLASS_FUNCTION() [23/59]

KVSO_CLASS_FUNCTION ( painter ,
fontDescent  )

◆ KVSO_CLASS_FUNCTION() [24/59]

KVSO_CLASS_FUNCTION ( painter ,
fontMetricsHeight  )

◆ KVSO_CLASS_FUNCTION() [25/59]

KVSO_CLASS_FUNCTION ( painter ,
fontMetricsWidth  )

◆ KVSO_CLASS_FUNCTION() [26/59]

KVSO_CLASS_FUNCTION ( painter ,
htmlTextSize  )

◆ KVSO_CLASS_FUNCTION() [27/59]

KVSO_CLASS_FUNCTION ( painter ,
painterDeviceHeight  )

◆ KVSO_CLASS_FUNCTION() [28/59]

KVSO_CLASS_FUNCTION ( painter ,
painterDeviceWidth  )

◆ KVSO_CLASS_FUNCTION() [29/59]

◆ KVSO_CLASS_FUNCTION() [30/59]

KVSO_CLASS_FUNCTION ( painter ,
pathLineTo  )

◆ KVSO_CLASS_FUNCTION() [31/59]

KVSO_CLASS_FUNCTION ( painter ,
pathMoveTo  )

◆ KVSO_CLASS_FUNCTION() [32/59]

◆ KVSO_CLASS_FUNCTION() [33/59]

KVSO_CLASS_FUNCTION ( painter ,
reset  )

◆ KVSO_CLASS_FUNCTION() [34/59]

KVSO_CLASS_FUNCTION ( painter ,
resetPath  )

References m_pPainterPath.

◆ KVSO_CLASS_FUNCTION() [35/59]

KVSO_CLASS_FUNCTION ( painter ,
restore  )

◆ KVSO_CLASS_FUNCTION() [36/59]

◆ KVSO_CLASS_FUNCTION() [37/59]

KVSO_CLASS_FUNCTION ( painter ,
save  )

◆ KVSO_CLASS_FUNCTION() [38/59]

◆ KVSO_CLASS_FUNCTION() [39/59]

KVSO_CLASS_FUNCTION ( painter ,
setAntialiasing  )

◆ KVSO_CLASS_FUNCTION() [40/59]

◆ KVSO_CLASS_FUNCTION() [41/59]

◆ KVSO_CLASS_FUNCTION() [42/59]

◆ KVSO_CLASS_FUNCTION() [43/59]

◆ KVSO_CLASS_FUNCTION() [44/59]

◆ KVSO_CLASS_FUNCTION() [45/59]

KVSO_CLASS_FUNCTION ( painter ,
setFontSize  )

◆ KVSO_CLASS_FUNCTION() [46/59]

KVSO_CLASS_FUNCTION ( painter ,
setGradientAsBrush  )

◆ KVSO_CLASS_FUNCTION() [47/59]

◆ KVSO_CLASS_FUNCTION() [48/59]

KVSO_CLASS_FUNCTION ( painter ,
setGradientStart  )

◆ KVSO_CLASS_FUNCTION() [49/59]

KVSO_CLASS_FUNCTION ( painter ,
setGradientStop  )

◆ KVSO_CLASS_FUNCTION() [50/59]

KVSO_CLASS_FUNCTION ( painter ,
setOpacity  )

◆ KVSO_CLASS_FUNCTION() [51/59]

◆ KVSO_CLASS_FUNCTION() [52/59]

KVSO_CLASS_FUNCTION ( painter ,
setPenCapStyle  )

◆ KVSO_CLASS_FUNCTION() [53/59]

KVSO_CLASS_FUNCTION ( painter ,
setPenJoinStyle  )

◆ KVSO_CLASS_FUNCTION() [54/59]

◆ KVSO_CLASS_FUNCTION() [55/59]

KVSO_CLASS_FUNCTION ( painter ,
setPenWidth  )

◆ KVSO_CLASS_FUNCTION() [56/59]

KVSO_CLASS_FUNCTION ( painter ,
setSmoothPixmapTransform  )

◆ KVSO_CLASS_FUNCTION() [57/59]

KVSO_CLASS_FUNCTION ( painter ,
setTextAntialiasing  )

◆ KVSO_CLASS_FUNCTION() [58/59]

◆ KVSO_CLASS_FUNCTION() [59/59]

Variable Documentation

◆ align_cod

const int align_cod[]
Initial value:
= {
Qt::AlignLeft,
Qt::AlignRight,
Qt::AlignHCenter,
Qt::AlignTop,
Qt::AlignBottom,
Qt::AlignVCenter,
Qt::AlignCenter,
Qt::TextSingleLine,
Qt::TextExpandTabs,
Qt::TextShowMnemonic,
Qt::TextWordWrap,
Qt::TextIncludeTrailingSpaces
}

◆ align_tbl

const char* const align_tbl[]
Initial value:
= {
"Left",
"Right",
"HCenter",
"Top",
"Bottom",
"VCenter",
"Center",
"TextSingleLine",
"TextExpandTabs",
"TextShowMnemonic",
"TextWordWrap",
"TextIncludeTrailingSpaces"
}

◆ bDonotdeleteinternalqpainter

bDonotdeleteinternalqpainter = false

Referenced by if().

◆ brushstyles_cod

const Qt::BrushStyle brushstyles_cod[]
Initial value:
= {
Qt::NoBrush,
Qt::SolidPattern,
Qt::Dense1Pattern,
Qt::Dense2Pattern,
Qt::Dense3Pattern,
Qt::Dense4Pattern,
Qt::Dense5Pattern,
Qt::Dense6Pattern,
Qt::Dense7Pattern,
Qt::HorPattern,
Qt::VerPattern,
Qt::CrossPattern,
Qt::BDiagPattern,
Qt::FDiagPattern,
Qt::DiagCrossPattern
}

Referenced by KVSO_CLASS_FUNCTION().

◆ brushstyles_tbl

const char* const brushstyles_tbl[]
Initial value:
= {
"NoBrush",
"SolidPattern",
"Dense1Pattern",
"Dense2Pattern",
"Dense3Pattern",
"Dense4Pattern",
"Dense5Pattern",
"Dense6Pattern",
"Dense7Pattern",
"HorPattern",
"VerPattern",
"CrossPattern",
"BDiagPattern",
"FDiagPattern",
"DiagCrossPattern"
}

Referenced by KVSO_CLASS_FUNCTION().

◆ composition_cod

const QPainter::CompositionMode composition_cod[]
Initial value:
= {
QPainter::CompositionMode_SourceOver,
QPainter::CompositionMode_DestinationOver,
QPainter::CompositionMode_Clear,
QPainter::CompositionMode_Source,
QPainter::CompositionMode_Destination,
QPainter::CompositionMode_SourceIn,
QPainter::CompositionMode_DestinationIn,
QPainter::CompositionMode_SourceOut,
QPainter::CompositionMode_DestinationOut,
QPainter::CompositionMode_SourceAtop,
QPainter::CompositionMode_DestinationAtop,
QPainter::CompositionMode_Xor,
QPainter::CompositionMode_Plus,
QPainter::CompositionMode_Multiply,
QPainter::CompositionMode_Screen,
QPainter::CompositionMode_Overlay,
QPainter::CompositionMode_Darken,
QPainter::CompositionMode_Lighten,
QPainter::CompositionMode_ColorDodge,
QPainter::CompositionMode_ColorBurn,
QPainter::CompositionMode_HardLight,
QPainter::CompositionMode_SoftLight,
QPainter::CompositionMode_Difference,
QPainter::CompositionMode_Exclusion,
}

Referenced by KVSO_CLASS_FUNCTION().

◆ composition_tbl

const char* const composition_tbl[]
Initial value:
= {
"SourceOver",
"DestinationOver",
"Clear",
"Source",
"Destination",
"SourceIn",
"DestinationIn",
"SourceOut",
"DestinationOut",
"SourceAtop",
"DestinationAtop",
"Xor",
"Plus",
"Multiply",
"Screen",
"Overlay",
"Darken",
"Lighten",
"ColorDodge",
"ColorBurn",
"HardLight",
"SoftLight",
"Difference",
"Exclusion"
}

Referenced by KVSO_CLASS_FUNCTION().

◆ m_pDeviceObject

m_pDeviceObject = nullptr

Referenced by KVSO_CLASS_FUNCTION().

◆ m_pGradient

◆ m_pPainter

◆ m_pPainterPath

◆ m_pPrinter

◆ penstyles_cod

const Qt::PenStyle penstyles_cod[]
Initial value:
= {
Qt::NoPen,
Qt::SolidLine,
Qt::DashLine,
Qt::DotLine,
Qt::DashDotLine,
Qt::DashDotDotLine
}

Referenced by KVSO_CLASS_FUNCTION().

◆ penstyles_tbl

const char* const penstyles_tbl[]
Initial value:
= {
"noPen",
"solidLine",
"dashLine",
"dotLine",
"dashDotLine",
"dashDotDotLine"
}

Referenced by KVSO_CLASS_FUNCTION().