qgraphicsview

Render QGraphicsView into video file frame time problem

匆匆过客 提交于 2020-04-30 09:13:14
问题 I'm developing a 2D/3D animation desginer program which user can design animated items on a graphic scene, after designing user needs to be able to convert the animation into a specific video file, for rendering I just run a QTimer with Qt::PreciseTimer key (when animation is playing on the QGraphicsView) and set its interval to 33ms to get 30 shots per second and in its timeout signal I just use GraphicsView->render to get an image of what is displaying on the scene then save it to the file,

Render QGraphicsView into video file frame time problem

拜拜、爱过 提交于 2020-04-30 09:11:31
问题 I'm developing a 2D/3D animation desginer program which user can design animated items on a graphic scene, after designing user needs to be able to convert the animation into a specific video file, for rendering I just run a QTimer with Qt::PreciseTimer key (when animation is playing on the QGraphicsView) and set its interval to 33ms to get 30 shots per second and in its timeout signal I just use GraphicsView->render to get an image of what is displaying on the scene then save it to the file,

Toggle QPen for selected items after QGraphicsScene selection change

我们两清 提交于 2020-03-19 07:55:34
问题 How can I toggle the QPen color for the selected graphicsview items? Ideally I would like to handle this color change in the graphicsview or graphics scene objects rather than directly handling it in the main windows selection event. Any help is appreciated. Currently it will turn the pen color white when the object is selected. I'm not sure how to turn it back avoiding looping through all objects. Is there a way i could add a function in the MyGraphicsView class itself that would handle the

How to anchor QGraphicsWidget/Item (make them static) on QGraphicsView

扶醉桌前 提交于 2020-02-25 04:36:20
问题 I want to make something like a hud. I have a QGraphicsScene with a huge QPixmap , that I added to a much smaller QGraphicsView . Now I need to add some control elements, like QLabel , QPushButton and QGraphicsEllipseItem . That's, I think, is not a problem. I found this helpful page Graphics View Classes. But how do I anchor this control elements to the View or maybe better said how do I not anchor them? When I drag the QPixmap , then I don't want that the hud is moving with the QPixmap out

QRubberBand move on QGraphicsView after resizing

妖精的绣舞 提交于 2020-02-16 06:15:31
问题 I have the same problem from this topic: QRubberBand move when I resize window, after a few try I realized that solution from this topic doesn't apply on QGraphics View. Why my selection move, arout QgraphicsView when I resize window. import sys from PyQt5 import QtCore, QtGui, QtWidgets # from PyQt4 import QtCore, QtWidgets class ResizableRubberBand(QtWidgets.QGraphicsView): def __init__(self, parent=None): super(ResizableRubberBand, self).__init__(parent) self.draggable = False self

QRubberBand move on QGraphicsView after resizing

百般思念 提交于 2020-02-16 06:15:06
问题 I have the same problem from this topic: QRubberBand move when I resize window, after a few try I realized that solution from this topic doesn't apply on QGraphics View. Why my selection move, arout QgraphicsView when I resize window. import sys from PyQt5 import QtCore, QtGui, QtWidgets # from PyQt4 import QtCore, QtWidgets class ResizableRubberBand(QtWidgets.QGraphicsView): def __init__(self, parent=None): super(ResizableRubberBand, self).__init__(parent) self.draggable = False self

How to use the QGraphicsView's translate() function?

你离开我真会死。 提交于 2020-01-29 10:50:26
问题 here i have a scene and a associated view ,then i hava a position in the scene coordinates.I want to set the center of the viewport with the position.How can i do it? I try to use the translate() function but it didn't work? view->translate(10, 10); The viewport should move with the delta x 10, and delta y 10, but it didn't work! 回答1: Center As said Frank Osterfeld, to center your viewport at a given position, you can simply use the function centerOn. Translate But to translate your viewport,

Maintaining relative child position after applying QGraphicsItem::ItemIgnoresTransformations

て烟熏妆下的殇ゞ 提交于 2020-01-10 19:26:34
问题 I have a QGraphicsTextItem parented to a QGraphicsItem. I want the QGraphicsTextItem to always reside directly above the QGraphicsItem, but I also want the text to remain the same size when the scale factor goes below 1, i.e. the text remains the size it is at a scale factor of 1 even when the parent graphics item is scaled smaller. I have found that setting the QGraphicsItem::ItemIgnoresTransformations flag to true when the scale factor is below 1 does the trick for retaining the size. But I

QGraphicsView fitInView margins

别说谁变了你拦得住时间么 提交于 2020-01-03 15:13:12
问题 Why this: graphics_view->fitInView(scene->sceneRect(), Qt::KeepAspectRatio); doesn’t work as expected ? It isn't fitting the scene rect correctly, showing margins around it. 回答1: The cause is this: https://bugreports.qt.io/browse/QTBUG-42331 - please vote on it on the qt bug tracker to up its priority. In short, fitInView has hardcoded margins and this can cause all kinds of havoc - the least of which is that now you lose a few pixels of display area and might also force unnecessary rescaling

QGraphicsSimpleTextItem “invalid use of incomplete type”

寵の児 提交于 2019-12-31 07:16:05
问题 My code is as follows: pointerwidget.h QGraphicsSimpleTextItem *text; pointerwidget.cpp void PointerWidget::placeNumbers(float spacing, int currentTickNumber) { float label = spacing/scaleFactor; text = scene->addSimpleText(QString::number(label),QFont("Comic Sans MS", 12, QFont::Bold)); text->setPos(currentTickNumber*spacing,30); } Everywhere that i read says to use setPos(x,y) to position the text item. This is a function of QGraphicsItem. I get the error of "invalid use of incomplete type