1
0
Files
wfassoc/example/qwfassoc/src/icon_utils.h

25 lines
709 B
C
Raw Normal View History

2026-06-23 20:46:56 +08:00
#pragma once
#ifndef QWFASSOC_ICON_UTILS_H_
#define QWFASSOC_ICON_UTILS_H_
#include <QPixmap>
#include <wfassoc++.h>
namespace qwfassoc {
namespace icon_utils {
// Convert a wfassocpp::HICON handle (the C++ wrapper around wfassoc's opaque
// icon handle) into a QPixmap suitable for use in Qt widgets.
//
// The conversion goes through QImage::fromHICON() (available since Qt 6.0 on
// Windows) and then QPixmap::fromImage() using its rvalue-reference overload
// so that no extra pixel buffer copy is performed. The returned pixmap is null
// if the input handle is null.
QPixmap fromHicon(wfassocpp::HICON handle);
} // namespace icon_utils
} // namespace qwfassoc
#endif // QWFASSOC_ICON_UTILS_H_