Problem issue PyQt / PySide QSpinBox

I added QSpinBox to QGraphicsScene using QGraphicsProxyWidget. Each time I hover over a QSpinBox, it flickers with a black bar superimposed on the player controls. I added a screenshot and code below. Am I doing something wrong? Is there any way to avoid this? Pyside 1.1.2, Python 2.7, Windows7.

QSpinBox flickering on hover

class testWidget(QGraphicsView): def __init__(self): QGraphicsView.__init__(self) floorSpinBox = QSpinBox() floorSpinBox.setGeometry(0,0,50,25) proxyWidget = QGraphicsProxyWidget() proxyWidget.setWidget(floorSpinBox) scene = QGraphicsScene(self) scene.addItem(proxyWidget) self.setScene(scene) if __name__ == "__main__": app = QApplication(sys.argv) widget = testWidget() widget.show() app.exec_() 

EDIT

There seems to be a bug report here: Bugreport . I had to finally add a QSpinBox to a regular QWidget , and not under QGraphicsView .

+1
source share
1 answer

Why do you put a spinbox in a QGraphicsScene ? This seems rather strange. If you don’t have any mysterious reason for this, but just want to use a functional, non-blurring user interface element, try making your testWidget QDialog instead of QGraphicsView .

 from PyQt4.QtGui import QDialog, QSpinBox,QApplication import sys class testWidget(QDialog): def __init__(self): QDialog.__init__(self) self.setGeometry(200,200,200,100) floorSpinBox = QSpinBox(self) floorSpinBox.setGeometry(75,40,50,25) if __name__ == "__main__": app = QApplication(sys.argv) widget = testWidget() widget.show() app.exec_() 
0
source

Source: https://habr.com/ru/post/1437661/


All Articles