1
即时通讯设法找出PyQT我如何设置Mousewheel事件? 我需要它,所以我可以将它附加到Qscroll区域PyQT4 WheelEvent?如何检测车轮是否已经使用?
我使用的代码工作正常。但大小是硬编码的。我需要它以某种方式动态调整,取决于轮子(在鼠标上)的使用方式。就像我滑动鼠标轮时一样。我的框架的高度延伸(像每个刻度50像素),反之亦然。
self.scrollArea = QtGui.QScrollArea()
#set the parent of scrollArea on the frame object of the computers
self.scrollArea.setWidget(self.ui.Main_Body)
self.scrollArea.setWidgetResizable(True)
#add the verticalLayout a object on PYQT Designer (vlayout is the name)
#drag the frame object of the computers inside the verticalLayout
#adjust the size of the verticalLayout inside the size of the frame
#add the scrollArea sa verticalLayout
self.ui.verticalLayout.addWidget(self.scrollArea)
self.ui.Main_Body.setMinimumSize(400, 14000)
最后部分是我想要增强的。我不希望它被硬编码为14000的值。 感谢任何人的帮助。我希望给出的示例代码也可以帮助其他需要的人。
)
嗨,谢谢你的回复。我想要发生的是..我的窗户内有一个框架。该框架是我想要调整大小的框架。取决于鼠标轮的使用。它的所有只是设计的东西(我老师在我的项目中的要求=(。谢谢你,我在我的代码中做了一些修改后马上给你反馈。再次感谢杰夫! – Katherina 2012-02-29 01:44:13