<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Aug 24, 2019 at 4:39 AM Ali M <<a href="mailto:adeadmarshal@gmail.com">adeadmarshal@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">I've created a sqlite db with a blob field and put images in it. how can i retrieve the images and show them in a qtextbrowser? i want to get the images with a for loop something like the below code but i don't know how.<br><div><br></div><div>def readImage(self):<br>        cur = self.db.cursor()<br>        rows = cur.execute("select cover from covers")<br>        pm = QPixmap()<br>        for row in rows:<br>                pic = self.ui.label.setPixmap(QPixmap("row.jpg"))<br>                self.ui.textBrowser.insertFromMimeData(pic)<br></div></div></blockquote><div><br></div><div>You can use loadFromData(thebytes) to load a QPixmap from bytes, however you may use a QImage (which also has loadFromData) and <a href="https://doc.qt.io/qt-5/qtextcursor.html#insertImage-3">https://doc.qt.io/qt-5/qtextcursor.html#insertImage-3</a> because it looks easier to me</div><div><br></div><div>(insertFromMimeData won't work on a QPixmap anyhow AFAICT)</div><div><br></div></div></div>