Vote count:
0
Hi my question is related to this: PyQT4 WheelEvent
from PyQt4.QtGui import *
from PyQt4.QtCore import *
import sys
class Main(QWidget):
def __init__(self, parent=None):
super(Main, self).__init__(parent)
layout = QHBoxLayout(self)
layout.addWidget(Scroll(self))
class Scroll(QScrollArea):
def __init__(self, parent=None):
super(Scroll, self).__init__(parent)
self.parent = parent
def wheelEvent(self, event):
super(Scroll, self).wheelEvent(event)
print "wheelEvent", event.delta()
newHeight = self.parent.geometry().height() - event.delta()
width = self.parent.geometry().width()
self.parent.resize(width, newHeight)
app = QApplication(sys.argv)
main = Main()
main.show()
sys.exit(app.exec_())
My Scroll class is created in Qt Designer and i have no access to it Is there any opportunity to have access to PyQT WheelEvent of Scroll class but in Main class?
asked 26 secs ago
PyQT4 WheelEvent in parent from child
Aucun commentaire:
Enregistrer un commentaire