我不太习惯在代码中编写 UI,所以我需要一些指针。我试图在我的 N900 上创建一个简单的水平滚动对话框,但我不知道如何做到这一点。
这是我到目前为止所拥有的:
def __init__(self,parent = None):
QDialog.__init__(self,parent)
#if name == None:
self.setWindowTitle('Testing scrolling')
self.scrollArea = QScrollArea(self)
self.scrollArea.setWidgetResizable(True)
self.scrollArea.setMinimumSize(100,150)
self.aWidget = QWidget(self.scrollArea)
self.aWidget.setMinimumSize(20,200)
self.aWidget.setSizePolicy( QSizePolicy.Expanding, QSizePolicy.Expanding)
self.scrollArea.setSizePolicy( QSizePolicy.Expanding, QSizePolicy.Expanding)
self.scrollArea.setWidget(self.aWidget)
scroller = self.scrollArea.property("kineticScroller").toPyObject()
scroller.setEnabled(True)
_layout = QGridLayout(self.aWidget)
_layout.setSpacing(60)
_layout.setMargin(11)
_layout.addWidget(QPushButton('Test0'),0,0)
_layout.addWidget(QPushButton('Test1'),0,1)
_layout.addWidget(QPushButton('Test2'),0,2)
_layout.addWidget(QPushButton('Test3'),0,3)
_layout.addWidget(QPushButton('Test4'),0,4)
_layout.addWidget(QPushButton('Test5'),0,5)
_layout.addWidget(QPushButton('Test6'),0,6)