mirror of
https://invent.kde.org/network/falkon.git
synced 2024-11-11 17:42:10 +01:00
23 lines
468 B
C++
23 lines
468 B
C++
|
#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;
|
||
|
}
|