PyQt: Scrollbars are not shown with QGraphicsView class being nested under QMainWindo
I am supposed to add scrollbars to the screen. The class design shown below is the part of a software that I am supposed to modify and add scrollbars to. The scroll bar code in Window class has been added by me.
It doesn't get shown when I run the program. What am I supposed to correct?
Code:
import sys
from PyQt4 import QtGui
from PyQt4 import QtCore
def __init__(self, parent=None):
self.
scene.
setBackgroundBrush(QtGui.
QBrush(QtCore.
Qt.
darkGray, QtCore.
Qt.
SolidPattern)) self.setScene(self.scene)
self.
setTransformationAnchor(QtGui.
QGraphicsView.
AnchorUnderMouse) self.viewport().setCursor(QtCore.Qt.CrossCursor)
self.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn)
self.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn)
print "sdsads"
def __init__(self, parent=None):
Window()
GUI = CityscapesLabelTool()
GUI.show()
sys.exit(app.exec_())