Logo    
KDWinUtils
Helper library for MFC to Qt migration
Loading...
Searching...
No Matches
Utils Namespace Reference

Functions

void centerWindow (QWidget *dialogWidget, const QRect &parentRect)
 Centers the dialog widget in the parentRect.
 
void drawArc (QPainter *painter, const QRect &rect, const QPoint &p1, const QPoint &p2)
 Draws an arc specified by the given rectangle, and 2 points.
 
void drawCenterLabel (QPainter *pDC, const QPoint &pt, const QString &label)
 Draws a label centered at the specified point.
 
void drawChord (QPainter *painter, const QRect &rect, const QPoint &p1, const QPoint &p2)
 Draws an chrod specified by the given rectangle, and 2 points.
 
void drawLabel (QPainter *pDC, const QPoint &pt, const QString &label, Qt::Alignment align)
 Draws a label at the specified point with the given alignment.
 
void drawPie (QPainter *painter, const QRect &rect, const QPoint &p1, const QPoint &p2)
 Draws a pie specified by the given rectangle, and 2 points.
 
QAction * findCommand (const QList< QAction * > &actionList, const QString &menuText)
 Finds a command with the specified text from a list of commands.
 
QAction * findCommand (const QList< QAction * > &actionList, int id)
 Finds a command with the specified ID from a list of commands.
 
HWND nativeHandle (QWidget *_widget)
 Returns the native handle of the widget.
 
float scaleFactor (QWidget *widget)
 Returns the scale factor of the widget.
 
bool setCommandChecked (const QList< QAction * > &actionList, int id, bool checked)
 Checks the command with the specified ID from a list of commands.
 
bool setCommandEnabled (const QList< QAction * > &actionList, int id, bool enable)
 Enables the command with the specified ID from a list of commands.
 
COLORREF toCOLORREF (const QColor &color)
 Converts a QColor to a COLORREF.
 
CPoint toCPoint (const QPoint &point)
 Converts a QPoint into a CPoint.
 
CRect toCRect (const QRect &rect)
 Converts a QRect into a CRect.
 
CSize toCSize (const QSize &size)
 Converts a QSize into a CSize.
 
CString toCString (const QString &str)
 Converts a QString into a CString.
 
HBITMAP toHBITMAP (const QImage &image)
 Converts a QImage to a HBITMAP.
 
HICON toHICON (const QImage &image)
 Converts a QImage to a HICON.
 
QColor toQColor (COLORREF rgb)
 Converts a COLORREF to a QColor.
 
QColor toQColor (COLORREF rgb, int alpha)
 Converts a COLORREF to a QColor with alpha.
 
QImage toQImage (HBITMAP bitmap)
 Converts a HBITMAP to a QImage.
 
QImage toQImage (HICON icon)
 Converts a HICON to a QImage.
 
QList< QImage > toQImageList (CImageList *imageList)
 Converts a CImageList to a list of QImage.
 
QPoint toQPoint (const CPoint &point)
 Converts a QPoint into a CPoint.
 
QRect toQRect (const CRect &rect)
 Converts a CRect into a QRect.
 
QSize toQSize (const CSize &size)
 Converts a CSize into a QSize.
 
QString toQString (const CStringA &str)
 Converts a CString (char) into a QString.
 
QString toQString (const CStringW &str)
 Converts a CString (wide char) into a QString.
 
QString toQString (const wchar_t *str)
 Converts a wide string into a QString.
 
Qt::BrushStyle toQtBrushStyle (int nIndex)
 Converts a CBrush style to a Qt::BrushStyle.
 
Qt::PenCapStyle toQtPenCapStyle (int value)
 Converts a CPen cap style to a Qt::PenCapStyle.
 
Qt::PenJoinStyle toQtPenJoinStyle (int value)
 Converts a CPen join style to a Qt::PenJoinStyle.
 
Qt::PenStyle toQtPenStyle (int value)
 Converts a CPen style to a Qt::PenStyle.
 

Function Documentation

◆ centerWindow()

void Utils::centerWindow ( QWidget * dialogWidget,
const QRect & parentRect )

Centers the dialog widget in the parentRect.

◆ drawArc()

void Utils::drawArc ( QPainter * painter,
const QRect & rect,
const QPoint & p1,
const QPoint & p2 )

Draws an arc specified by the given rectangle, and 2 points.

◆ drawCenterLabel()

void Utils::drawCenterLabel ( QPainter * pDC,
const QPoint & pt,
const QString & label )

Draws a label centered at the specified point.

◆ drawChord()

void Utils::drawChord ( QPainter * painter,
const QRect & rect,
const QPoint & p1,
const QPoint & p2 )

Draws an chrod specified by the given rectangle, and 2 points.

◆ drawLabel()

void Utils::drawLabel ( QPainter * pDC,
const QPoint & pt,
const QString & label,
Qt::Alignment align )

Draws a label at the specified point with the given alignment.

◆ drawPie()

void Utils::drawPie ( QPainter * painter,
const QRect & rect,
const QPoint & p1,
const QPoint & p2 )

Draws a pie specified by the given rectangle, and 2 points.

◆ findCommand() [1/2]

QAction * Utils::findCommand ( const QList< QAction * > & actionList,
const QString & menuText )

Finds a command with the specified text from a list of commands.

Returns
A pointer to the found command, or nullptr if not found.

◆ findCommand() [2/2]

QAction * Utils::findCommand ( const QList< QAction * > & actionList,
int id )

Finds a command with the specified ID from a list of commands.

Returns
A pointer to the found command, or nullptr if not found.

◆ nativeHandle()

HWND Utils::nativeHandle ( QWidget * _widget)

Returns the native handle of the widget.

◆ scaleFactor()

float Utils::scaleFactor ( QWidget * widget)

Returns the scale factor of the widget.

◆ setCommandChecked()

bool Utils::setCommandChecked ( const QList< QAction * > & actionList,
int id,
bool checked )

Checks the command with the specified ID from a list of commands.

Returns
True if the command has been found, false otherwise.

◆ setCommandEnabled()

bool Utils::setCommandEnabled ( const QList< QAction * > & actionList,
int id,
bool enable )

Enables the command with the specified ID from a list of commands.

Returns
True if the command has been found, false otherwise.

◆ toCOLORREF()

COLORREF Utils::toCOLORREF ( const QColor & color)

Converts a QColor to a COLORREF.

◆ toCPoint()

CPoint Utils::toCPoint ( const QPoint & point)

Converts a QPoint into a CPoint.

◆ toCRect()

CRect Utils::toCRect ( const QRect & rect)

Converts a QRect into a CRect.

◆ toCSize()

CSize Utils::toCSize ( const QSize & size)

Converts a QSize into a CSize.

◆ toCString()

CString Utils::toCString ( const QString & str)

Converts a QString into a CString.

Depending if the macro UNICODE is set, will use wide char or normal char.

◆ toHBITMAP()

HBITMAP Utils::toHBITMAP ( const QImage & image)

Converts a QImage to a HBITMAP.

◆ toHICON()

HICON Utils::toHICON ( const QImage & image)

Converts a QImage to a HICON.

◆ toQColor() [1/2]

QColor Utils::toQColor ( COLORREF rgb)

Converts a COLORREF to a QColor.

◆ toQColor() [2/2]

QColor Utils::toQColor ( COLORREF rgb,
int alpha )

Converts a COLORREF to a QColor with alpha.

◆ toQImage() [1/2]

QImage Utils::toQImage ( HBITMAP bitmap)

Converts a HBITMAP to a QImage.

◆ toQImage() [2/2]

QImage Utils::toQImage ( HICON icon)

Converts a HICON to a QImage.

◆ toQImageList()

QList< QImage > Utils::toQImageList ( CImageList * imageList)

Converts a CImageList to a list of QImage.

◆ toQPoint()

QPoint Utils::toQPoint ( const CPoint & point)

Converts a QPoint into a CPoint.

◆ toQRect()

QRect Utils::toQRect ( const CRect & rect)

Converts a CRect into a QRect.

◆ toQSize()

QSize Utils::toQSize ( const CSize & size)

Converts a CSize into a QSize.

◆ toQString() [1/3]

QString Utils::toQString ( const CStringA & str)

Converts a CString (char) into a QString.

◆ toQString() [2/3]

QString Utils::toQString ( const CStringW & str)

Converts a CString (wide char) into a QString.

◆ toQString() [3/3]

QString Utils::toQString ( const wchar_t * str)

Converts a wide string into a QString.

◆ toQtBrushStyle()

Qt::BrushStyle Utils::toQtBrushStyle ( int nIndex)

Converts a CBrush style to a Qt::BrushStyle.

◆ toQtPenCapStyle()

Qt::PenCapStyle Utils::toQtPenCapStyle ( int value)

Converts a CPen cap style to a Qt::PenCapStyle.

◆ toQtPenJoinStyle()

Qt::PenJoinStyle Utils::toQtPenJoinStyle ( int value)

Converts a CPen join style to a Qt::PenJoinStyle.

◆ toQtPenStyle()

Qt::PenStyle Utils::toQtPenStyle ( int value)

Converts a CPen style to a Qt::PenStyle.