本文整理汇总了Python中PyQt4.QtGui.QListView.sizeHintForRow方法的典型用法代码示例。如果您正苦于以下问题:Python QListView.sizeHintForRow方法的具体用法?Python QListView.sizeHintForRow怎么用?Python QListView.sizeHintForRow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtGui.QListView
的用法示例。
在下文中一共展示了QListView.sizeHintForRow方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: widget
# 需要导入模块: from PyQt4.QtGui import QListView [as 别名]
# 或者: from PyQt4.QtGui.QListView import sizeHintForRow [as 别名]
def widget(self,parent):
td = ListPickerDialog(self, parent)
td.setWindowTitle("Select Server")
td.setAttribute(Qt.WA_DeleteOnClose)
layout = QHBoxLayout();
layout.setContentsMargins(16, 0, 16, 8)
view = self.view()
if not view:
listView = QListView()
listView.setEditTriggers( QAbstractItemView.NoEditTriggers)
listView.setModel(self.model())
listView.setModelColumn(self.modelColumn())
if listView.sizeHintForRow(0)>0:
listView.setMinimumHeight(listView.sizeHintForRow(0) * 5)
view = listView
else:
view.setModel(self.model())
layout.addWidget(view)
self.setView(view)
if self.model():
index = self.model().index(self.currentIndex(), self.modelColumn())
self.selectModelIndex(index)
btnbox = QDialogButtonBox(Qt.Vertical)
btnbox.addButton("Select", QDialogButtonBox.AcceptRole)
addBtn = btnbox.addButton("Add", QDialogButtonBox.ActionRole)
addBtn.clicked.connect(self.addServer)
editBtn = btnbox.addButton("Edit", QDialogButtonBox.ActionRole)
editBtn.clicked.connect(self.editServer)
remBtn = btnbox.addButton("Remove", QDialogButtonBox.ActionRole)
remBtn.clicked.connect(self.remServer)
btnbox.accepted.connect( td.accept)
btnbox.rejected.connect( td.reject)
layout.addWidget(btnbox)
td.setLayout(layout)
return td