1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 17:42:10 +01:00
falkonOfficial/src/tools/globalfunctions.cpp

23 lines
468 B
C++
Raw Normal View History

#include "globalfunctions.h"
QByteArray qz_pixmapToByteArray(const QPixmap &pix)
{
QByteArray bytes;
QBuffer buffer(&bytes);
buffer.open(QIODevice::WriteOnly);
if (pix.save(&buffer, "PNG"))
return buffer.buffer().toBase64();
return QByteArray();
}
QByteArray qz_readAllFileContents(const QString &filename)
{
QFile file(filename);
file.open(QFile::ReadOnly);
QByteArray a = file.readAll();
file.close();
return a;
}