Added QPixmap isNull and assign functions

This commit is contained in:
Filippo Cucchetto 2018-02-12 23:29:20 +01:00
parent bcca7880f6
commit f3dd457e51
3 changed files with 23 additions and 1 deletions

View File

@ -148,6 +148,13 @@ DOS_API void DOS_CALL dos_qpixmap_load(DosPixmap *vptr, const char* filepath, co
DOS_API void DOS_CALL dos_qpixmap_loadFromData(DosPixmap *vptr, const unsigned char* data, unsigned int len);
/// \brief Fill a QPixmap with a single color
DOS_API void DOS_CALL dos_qpixmap_fill(DosPixmap *vptr, unsigned char r, unsigned char g, unsigned char b, unsigned char a);
/// \brief Calls the QPixmap::operator=(const QPixmap&) function
/// \param vptr The left hand side QPixmap
/// \param other The right hand side QPixmap
DOS_API void DOS_CALL dos_qpixmap_assign(DosPixmap *vptr, const DosPixmap* other);
/// \brief Calls the QPixmap::isNull
/// \return True if the QPixmap is null, false otherwise
DOS_API bool DOS_CALL dos_qpixmap_isNull(DosPixmap *vptr);
/// @}

View File

@ -87,7 +87,7 @@ typedef DosPixmap* (DOS_CALL *PixmapCallback)(const char *id, int *width, int *h
/// In other words the length of argv is always 1 + number of arguments of \p slotName.
/// The return value should be assigned and modified by calling the dos_qvariant_assign()
/// or other dos_qvariant_set... setters.
/// \note The \p slotName is owned by the framework thus it \b shouldn't be deleted
/// \note The \p slotName is owned by the library thus it \b shouldn't be deleted
/// \note The \p argv array is owned by the library thus it \b shouldn't be deleted
typedef void (DOS_CALL *DObjectCallback)(void *self, DosQVariant *slotName, int argc, DosQVariant **argv);

View File

@ -191,6 +191,21 @@ void dos_qpixmap_fill(DosPixmap *vptr, unsigned char r, unsigned char g, unsigne
pixmap->fill(QColor(r, g, b, a));
}
void dos_qpixmap_assign(DosPixmap *vptr, const DosPixmap *other)
{
if (vptr) {
auto lhs = static_cast<QPixmap *>(vptr);
auto rhs = static_cast<QPixmap *>(vptr);
*lhs = rhs ? *rhs : QPixmap();
}
}
bool dos_qpixmap_isNull(DosPixmap *vptr)
{
auto pixmap = static_cast<QPixmap *>(vptr);
return pixmap->isNull();
}
::DosQQuickView *dos_qquickview_create()
{
return new QQuickView();