我一直在環(huán)顧四周,但似乎找不到任何示例可以幫助我在.NET中更改滾輪的滾動方向QTableView。這是我最好的嘗試。這是我做的水平滾動:def eventFilter(self, obj, event): #some of my widgets are disabled, I can simply do another if for enabled ones if obj and obj.isEnabled() and event.type() == QEvent.Wheel and self.shift_key: newEvent = QWheelEvent(obj.mapToParent(event.pos()), event.globalPos(), event.delta(), event.buttons(), event.modifiers(), 1) QApplication.instance().postEvent(obj.parent(), newEvent) return True if event.type() == QEvent.KeyPress and event.key() == Qt.Key_Shift: self.shift_key = True return True elif event.type() == QEvent.KeyRelease and event.key() == Qt.Key_Shift: self.shift_key = False return True return QObject.eventFilter(self, obj, event)當我將鼠標懸停在標題或空白處時會出現(xiàn)問題,因為它不會水平滾動,并且還會顯示一條錯誤消息QApplication::postEvent: Unexpected null receiver如何使用scroll+實現(xiàn)水平滾動shift?
添加回答
舉報
0/150
提交
取消