qpixmap

PyQt4: Graphics View and Pixmap Size

旧城冷巷雨未停 提交于 2019-12-13 05:04:31
问题 I'm developing a GUI using QTDesigner for some image processing tasks. I have two graphic views beneath each other in a grid layout. Both should display an image and later on I will add overlays. I create my Pixmap img_pixmap and add it to my Scene. This scene is then added to my graphics view. Since my image is much larger than my screen size I apply fitInView() . In code: self.img_pixmap_p = self.img_scene.addPixmap(img_pixmap) self.img_view.setScene(self.img_scene) self.img_scene

Rotate QGraphicsPixmapItem results in shear if resizing without keeping aspect ratio

落花浮王杯 提交于 2019-12-13 02:00:23
问题 I am trying to rotate a QGraphicsPixmapItem child. For other QGraphicsItem , rotation and scaling work fine. But for a QGraphicsPixmapItem , if the size does not keep aspect ratio, instead of rotation I get shear. sample code: #include <QApplication> #include <QGraphicsView> #include <QMessageBox> #include <QGraphicsPixmapItem> #include <QFileDialog> int main(int argc, char *argv[]) { QGraphicsScene s; s.setSceneRect(-200, -200, 500, 500); QGraphicsView view(&s); view.show();

Convert Leptonica Pix Object to QPixmap ( or other image object )

泄露秘密 提交于 2019-12-12 10:25:51
问题 I'm using the Leptonica Library to process some pictures. After that I want to show them in my QT GUI. Leptonica is using their own format Pix for the images, while QT is using their own format QPixmap. At the moment the only way for me is to save the pictures after processing as a file ( like bmp ) and then load them again with a QT function call. Now I want to convert them in my code, so I dont need to take the detour with saving them on the filesystem. Any ideas how to do this? Best

Add a border to a QPixmap

橙三吉。 提交于 2019-12-12 04:39:09
问题 I load a QPixmap from a file. I want to add a border around the QPixmap, say 4px white on each side. What is the fastest way to do this? Do I have to create a second larger QPixmap and draw the first into the second or is there some way to extend the existing one without scaling (I've noticed that there is a QPixmap::transformed() but don't know if this is suitable in my case. 回答1: Do I have to create a second larger QPixmap and draw the first into the second Yes. is there some way to extend

mupdf: how to put a fz_pixmap into Qt4 QPixmap

大憨熊 提交于 2019-12-12 04:28:12
问题 I am trying to exploit mupdf library (Qt4 app). I have taken some code from pdfdraw.c. I was able to create a pixmap (fz_pixmap) from a pdf page. Now I need to display the pixmap. It is likely I can use QPixmap but I ask how to do so. 来源: https://stackoverflow.com/questions/7417994/mupdf-how-to-put-a-fz-pixmap-into-qt4-qpixmap

QPropertyAnimation for rotating QWidget

我是研究僧i 提交于 2019-12-11 17:11:34
问题 I'm new to Qt and I'm having some problem with QWidget rotation. I have a QPixmap inside a QLabel. What I want is to animate it with a continuous rotation by 90 degrees. I know QPropertyAnimation and I know how to use it, but I'm struggling with How to use it for rotating a QWidget . Is there any simple way to use achieve my goal and rotate the entire QLabel or the QPixmap inside it with an animation? Thank you. 回答1: This is the demo for rotation of QLabel/QPixmap with animation. it's not

QGraphicsPixmapItem::setPixmap() Performance?

痴心易碎 提交于 2019-12-11 10:18:54
问题 Since it seems I need to improve the performance of my code, I wanted to ask, how good is the performance of QGraphicsPixmapItem::setPixmap(*Qimage) ? My Image is 1024x1024 px and is updated about every 2.5seconds. But I need it to be updated much faster (4096x every 2.5 seconds at best). Is it possible with QGraphicsPixmapItem::setPixmap(*Qimage) ? I am filling every single pixel of QImage directly with an array: array[y*SCENEWIDTH+x] = color . But with that speed QGraphicsPixmapItem:

QGraphicsView doesn't resize after pixmap scale, while pixmap not centered any more

大城市里の小女人 提交于 2019-12-11 01:57:58
问题 I have created a QGraphicsView and inside it a QGraphicsScene. I load a pixmap in the QGraphicsScene. Actually it's an inherited QGraphicsScene which implements a wheelEvent in order to make the zoom in/out function. Zoom function scales the pixmap by 10% up or down depending on the wheel's rotation. The scaling works fine, however the QGraphicsView size or QGraphicsScene size gets the value of maximum size of the rotation that was tried and not center any more. For example, If I scale it up

QPainter or QLabel is less costly to draw QPixmap

半城伤御伤魂 提交于 2019-12-10 22:38:08
问题 I have to create an Icon pixmap, two methods I am familiarized to do that, One is setting the pixmap as o QLabel and display it, and other is drawing pixmap using QPainter , ie Method one Icon::Icon { QLabel iconLab = new QLabel; QLabel iconName = new QLabel; iconLab->setPixmap("mypixmap.png"); iconName->setText("myiconname"); QVBoxLayout *iconLayout = new QVBoxLayout; iconLayout->setMargin(0); iconLayout->addWidget(iconLab, 1, Qt::AlignCenter); iconLayout->addWidget(iconName, 1, Qt:

I am not using QPixmap, in PyQt. but I get QPixmap: It is not safe to use pixmaps outside the GUI thread in PyQt

こ雲淡風輕ζ 提交于 2019-12-10 20:38:52
问题 I am using PyQt for a project. But not all of a sudden I am getting an error: QPixmap: It is not safe to use pixmaps outside the GUI thread in PyQt I am not using QPixmap anywhere in my code... please help. class itemCheckBtn(QtGui.QDialog): qApp = None; okCallback = None; def __init__(self,parent=None): itemCheckBtn.qApp=None; QtGui.QWidget.__init__(self, None) self.ui = Ui_merchantPriceFrom(); self.ui.setupUi(self) QtCore.QObject.connect(self.ui.itemCheckButton, QtCore.SIGNAL("clicked()"),