qgraphicsview

Qt QGraphicsView not playing any video

。_饼干妹妹 提交于 2021-02-05 07:01:28
问题 I have a very simple QT 5.11.0 application with a graphicsview that i would like to play a video in. Here is my code, it compiles, loads and displays a blank graphicsview. #include "Demo_TeleLink.h" Demo_TeleLink::Demo_TeleLink(QWidget *parent) : QMainWindow(parent) { ui.setupUi(this); scene = new QGraphicsScene; player = new QMediaPlayer(); videoItem = new QGraphicsVideoItem; newString = "C://Users//Chris//Desktop//Sample1.mp4"; ui.graphicsView->setScene(scene); player->setVideoOutput

PyQt5 Event Filter Object Detection

杀马特。学长 韩版系。学妹 提交于 2021-01-28 03:44:52
问题 I want to report the mouse position whenever I click on a point within a QGraphicsView widget. class App(QMainWindow, Ui_MainWindow): def __init__(self, parent=None): super(App, self).__init__(parent) self.setupUi(self) self.graphicsView.viewport().installEventFilter(self) self.graphicsView_2.viewport().installEventFilter(self) def eventFilter(self, a0: 'QObject', a1: 'QEvent') -> bool: if a0 == self.graphicsView: if a1.type() == QtCore.QEvent.MouseButtonPress: mousePosition = a1.pos() print

Widget background not transparent when using QGraphicsView but transparent when using QGridLayout

蓝咒 提交于 2021-01-27 12:50:50
问题 When I was using QGridLayout to display my widgets, only the widget was shown and the part of the image that was transparent was not shown. Now I switched to using QGraphicsScene and QGraphicsView, and now my images have a gray background wherever they used to be transparent. void Piece::paintEvent(QPaintEvent *) { string image = ":/images/" + color + piece + ".png"; pixmap.load(image.c_str()); //pixmap.setMask(pixmap.createMaskFromColor(QColor(240, 240, 240))); QPainter paint(this); paint

How can I optimize the performance of a QGraphicsView-based app?

六眼飞鱼酱① 提交于 2020-12-29 14:27:52
问题 I have an app which is based on the Qt Graphics View framework. It's a jigsaw puzzle game which basically cuts a pixmap into smaller pixmaps (puzzle pieces) and displays them as QGraphicsItem s in a QGraphicsView . I want this app to run on smartphones and tablets. (It already runs on the Nokia N900 and some Symbian phones. Not optimized for Symbian^3 yet.) The source is on Gitorious. The items inherit QGraphicsItem and QObject , and have Q_PROPERTY macros for the pos() and rotation() of the

How can I optimize the performance of a QGraphicsView-based app?

孤街浪徒 提交于 2020-12-29 14:19:08
问题 I have an app which is based on the Qt Graphics View framework. It's a jigsaw puzzle game which basically cuts a pixmap into smaller pixmaps (puzzle pieces) and displays them as QGraphicsItem s in a QGraphicsView . I want this app to run on smartphones and tablets. (It already runs on the Nokia N900 and some Symbian phones. Not optimized for Symbian^3 yet.) The source is on Gitorious. The items inherit QGraphicsItem and QObject , and have Q_PROPERTY macros for the pos() and rotation() of the

How can I optimize the performance of a QGraphicsView-based app?

左心房为你撑大大i 提交于 2020-12-29 14:14:13
问题 I have an app which is based on the Qt Graphics View framework. It's a jigsaw puzzle game which basically cuts a pixmap into smaller pixmaps (puzzle pieces) and displays them as QGraphicsItem s in a QGraphicsView . I want this app to run on smartphones and tablets. (It already runs on the Nokia N900 and some Symbian phones. Not optimized for Symbian^3 yet.) The source is on Gitorious. The items inherit QGraphicsItem and QObject , and have Q_PROPERTY macros for the pos() and rotation() of the

How can I optimize the performance of a QGraphicsView-based app?

假装没事ソ 提交于 2020-12-29 14:08:06
问题 I have an app which is based on the Qt Graphics View framework. It's a jigsaw puzzle game which basically cuts a pixmap into smaller pixmaps (puzzle pieces) and displays them as QGraphicsItem s in a QGraphicsView . I want this app to run on smartphones and tablets. (It already runs on the Nokia N900 and some Symbian phones. Not optimized for Symbian^3 yet.) The source is on Gitorious. The items inherit QGraphicsItem and QObject , and have Q_PROPERTY macros for the pos() and rotation() of the

How to render a part of QGraphicsScene and save It as image file PyQt5

こ雲淡風輕ζ 提交于 2020-12-26 04:57:11
问题 Suppose I have QGraphicsPixmapItem from loaded image which is added to QGraphicsScene . And suppose I'll add several QGraphicsPolygonItem 's on scene. How I can render a part of the scene as full-size image both with polygons that are not in blank area and save this area as image file. class ImageView(QtWidgets.QGraphicsView): def __init__(self, parent): super(ImageView, self).__init__(parent) self.setFocus() self._zoom = 0 self._empty = True self.scene = QtWidgets.QGraphicsScene(self) self.

how to use QGraphicsView::RubberBandDrag?

戏子无情 提交于 2020-12-23 11:53:28
问题 Can somebody please provide an explanation, or better yet a short example, of how to use the RubberBandDrag enum value in QGraphicsView ? PyQt5 would be great, but I can translate from the C++ version if that is preferred for whomever can provide a helpful exmaple. NoDrag and ScrollHandDrag are relatively easy to understand ( NoDrag makes the mouse a pointer and you can capture clicks at certain locations, ScrollHandDrag makes the mouse a hand and you can implement click and drag to scroll

how to use QGraphicsView::RubberBandDrag?

徘徊边缘 提交于 2020-12-23 11:52:34
问题 Can somebody please provide an explanation, or better yet a short example, of how to use the RubberBandDrag enum value in QGraphicsView ? PyQt5 would be great, but I can translate from the C++ version if that is preferred for whomever can provide a helpful exmaple. NoDrag and ScrollHandDrag are relatively easy to understand ( NoDrag makes the mouse a pointer and you can capture clicks at certain locations, ScrollHandDrag makes the mouse a hand and you can implement click and drag to scroll