qpixmap

How to save a QPixmap Object to a file?

﹥>﹥吖頭↗ 提交于 2019-11-30 16:33:23
问题 I'm having trouble reading and writing QByteArray data to a file. My goal is to save QPixmap data into a QByteArray and save that QByteArray to a file (with the ability to read this QByteArray back from the file and into a QPixmap). I want to use following code from the QPixmap documentation: QPixmap pixmap(<image path>); QByteArray bytes; QBuffer buffer(&bytes); buffer.open(QIODevice::WriteOnly); pixmap.save(&buffer, "PNG"); // writes pixmap into bytes in PNG format After writing the buffer

QPixmap maintain aspect ratio

心已入冬 提交于 2019-11-30 16:10:23
I'm writing a program that will allow me to upload photos to TUMBLR via their API, I've got the uploading working (thanks to you guys). I've put a 'queueBox' on the side of the GUI, which displays the image names, and they are stored in a QListWidget. I've put this in my Main Class' constructor: def __init__(self): QtGui.QMainWindow.__init__(self) self.setupUi(self) self.queueBox.itemClicked.connect(self.displayPhoto) and I have this method: def displayPhoto(self, item): tempName = (item.text()) print tempName self.myLabel.setPixmap(QtGui.QPixmap(_fromUtf8(directory + '\\' + tempName))) ##

Displaying a video stream in QLabel with PySide

久未见 提交于 2019-11-30 15:48:52
问题 Can anybody point me in the right direction on how to create a new QMovie "provider" in PySide? I have a video stream that I want to display as simply as possible (no audio, just a sequence of frames with an unknown and variable framerate). This example seems perfect except that my video is coming from an unconventional source. It's not a file but a network stream in a format that is not standardized. I can easily write code that receives each frame and my idea is to create a "QMovie provider

How to use QPainter on QPixmap

℡╲_俬逩灬. 提交于 2019-11-30 12:37:27
I'm a newbie to Qt/Embedded. I want to use QPainter to draw stuff on a QPixmap , which will be added to QGraphicsScene . Here is my code. But it does not show the drawings on the pixmap. It shows only the black pixmap. int main(int argc, char **argv) { QApplication a(argc, argv); QMainWindow *win1 = new QMainWindow(); win1->resize(500,500); win1->show(); QGraphicsScene *scene = new QGraphicsScene(win1); QGraphicsView view(scene, win1); view.show(); view.resize(500,500); QPixmap *pix = new QPixmap(500,500); scene->addPixmap(*pix); QPainter *paint = new QPainter(pix); paint->setPen(*(new QColor

QPixmap maintain aspect ratio

♀尐吖头ヾ 提交于 2019-11-29 23:30:27
问题 I'm writing a program that will allow me to upload photos to TUMBLR via their API, I've got the uploading working (thanks to you guys). I've put a 'queueBox' on the side of the GUI, which displays the image names, and they are stored in a QListWidget. I've put this in my Main Class' constructor: def __init__(self): QtGui.QMainWindow.__init__(self) self.setupUi(self) self.queueBox.itemClicked.connect(self.displayPhoto) and I have this method: def displayPhoto(self, item): tempName = (item.text

What is the difference between QImage and QPixmap?

女生的网名这么多〃 提交于 2019-11-28 04:37:00
I do not understand what is the difference between QImage and QPixmap, they seem to offer the same functionality. When should I use a QImage and when should I use a QPixmap? karlphillip Easilly answered by reading the docs on QImage and QPixmap : The QPixmap class is an off-screen image representation that can be used as a paint device. The QImage class provides a hardware-independent image representation that allows direct access to the pixel data, and can be used as a paint device. Edit: Also, from @Dave's answer: You can't manipulate a QPixmap outside the GUI-thread, but QImage has no such

Qt C++ Displaying images outside the GUI thread (Boost thread)

江枫思渺然 提交于 2019-11-27 08:47:52
问题 I am developing a C++ library realizing its interface by means of Qt, using VS2015. On the library side, 3 boost threads continously load images from 3 folders. I am trying to display these images in 3 different QLabel (or equivalent QWidgets ), so the thread body consists of this functionality, in particular by exploiting the setPixmap method. Although the call to the function is protected by a boost mutex, I got exceptions probably due to threads synchronization. Looking for a solution, I

What is the difference between QImage and QPixmap?

≡放荡痞女 提交于 2019-11-27 05:14:19
问题 I do not understand what is the difference between QImage and QPixmap, they seem to offer the same functionality. When should I use a QImage and when should I use a QPixmap? 回答1: Easilly answered by reading the docs on QImage and QPixmap: The QPixmap class is an off-screen image representation that can be used as a paint device. The QImage class provides a hardware-independent image representation that allows direct access to the pixel data, and can be used as a paint device. Edit: Also, from

PyQt showing video stream from opencv

南笙酒味 提交于 2019-11-26 00:29:20
问题 Try to link PyQt and Opencv video feed, can\'t understand how to apply while loop for continuously streaming video. It just take a still picture.Please can anyone help to solve the problem. PtQt=5 Python=3.6.1 class App(QWidget): def __init__(self): super().__init__() self.title = \'PyQt5 Video\' self.left = 100 self.top = 100 self.width = 640 self.height = 480 self.initUI() def initUI(self): self.setWindowTitle(self.title) self.setGeometry(self.left, self.top, self.width, self.height) self