How to Store and Retrieve Image on SQLite: Difference between revisions

From Qt Wiki
Jump to navigation Jump to search
No edit summary
(No difference)

Revision as of 15:48, 14 January 2015

English Español Български

How to Store and Retrieve an Image or File with SQLite

Images or any files can be stored in a database. Here is one way to do it using the following steps:

1. Read the system file into a QByteArray.
2. Store QByteArray as a Binary Large Object in database.

For example :

Now, the image/file can be retrieved like any other data

Creating a QPixmap from QByteArray :

It is done. Now the pixmap can be used in a Button as icon or in label etc.

Categories: