本文整理汇总了Python中PyQt4.QtGui.QListView.setDragEnabled方法的典型用法代码示例。如果您正苦于以下问题:Python QListView.setDragEnabled方法的具体用法?Python QListView.setDragEnabled怎么用?Python QListView.setDragEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtGui.QListView
的用法示例。
在下文中一共展示了QListView.setDragEnabled方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from PyQt4.QtGui import QListView [as 别名]
# 或者: from PyQt4.QtGui.QListView import setDragEnabled [as 别名]
def __init__(self, model, enlargeFunction, parent):
QWidget.__init__(self, parent)
def enlarge(index):
enlargeFunction(model.list[index.row()])
windowSize = self.window().frameSize()
self.resize(QSize(windowSize.width()-(25+utilities.bigCardSize[0]),275))
lvViewer = QListView(self)
lvViewer.setModel(model)
lvViewer.setDragEnabled(True)
lvViewer.setHorizontalScrollMode(QAbstractItemView.ScrollPerPixel)
lvViewer.setFlow(QListView.LeftToRight)
lvViewer.setFocus()
self.connect(lvViewer, SIGNAL('clicked(QModelIndex)'), enlarge)
button = QPushButton("Close", self)
self.connect(button,SIGNAL('clicked()'),self.hide)
layout = QVBoxLayout(self)
layout.addWidget(QLabel("I'm sorry this is so ugly.",self))
layout.addWidget(lvViewer)
layout.addWidget(button)
self.setLayout(layout)
self.show()
示例2: displayExile
# 需要导入模块: from PyQt4.QtGui import QListView [as 别名]
# 或者: from PyQt4.QtGui.QListView import setDragEnabled [as 别名]
def displayExile(self):
from PyQt4.QtGui import QListView, QAbstractItemView, QPushButton, QVBoxLayout, QLabel
from PyQt4.QtCore import QSize
from util import utilities
windowSize = self.window().frameSize()
self.viewer = QWidget(self.window())
self.viewer.move(10,10)
self.viewer.resize(QSize(windowSize.width()-(25+utilities.bigCardSize[0]),275))
lvViewer = QListView(self.viewer)
lvViewer.setModel(self.model)
lvViewer.setDragEnabled(True)
lvViewer.setHorizontalScrollMode(QAbstractItemView.ScrollPerPixel)
lvViewer.setFlow(QListView.LeftToRight)
lvViewer.setFocus()
self.connect(lvViewer, SIGNAL('clicked(QModelIndex)'), self.enlarge)
button = QPushButton("Close", self.viewer)
self.connect(button,SIGNAL('clicked()'),self.hideViewer)
layout = QVBoxLayout(self)
layout.addWidget(QLabel("I'm sorry this is so ugly.",self.viewer))
layout.addWidget(lvViewer)
layout.addWidget(button)
self.viewer.setLayout(layout)
self.viewer.show()
示例3: __init__
# 需要导入模块: from PyQt4.QtGui import QListView [as 别名]
# 或者: from PyQt4.QtGui.QListView import setDragEnabled [as 别名]
def __init__(self, parent=None):
super(MainWindow, self).__init__(parent)
view = QListView()
view.setDragEnabled(True)
view.setAcceptDrops(True)
view.setDropIndicatorShown(True)
view.setSelectionMode(view.ExtendedSelection)
self.model = ListModel(view)
view.setModel(self.model)
self.setCentralWidget(view)
示例4: PrioritizeDialog
# 需要导入模块: from PyQt4.QtGui import QListView [as 别名]
# 或者: from PyQt4.QtGui.QListView import setDragEnabled [as 别名]
class PrioritizeDialog(QDialog):
def __init__(self, parent, app):
flags = Qt.CustomizeWindowHint | Qt.WindowTitleHint | Qt.WindowSystemMenuHint
QDialog.__init__(self, parent, flags)
self._setupUi()
self.model = PrioritizeDialogModel(app=app.model)
self.categoryList = ComboboxModel(model=self.model.category_list, view=self.categoryCombobox)
self.criteriaList = ListviewModel(model=self.model.criteria_list, view=self.criteriaListView)
self.prioritizationList = PrioritizationList(model=self.model.prioritization_list, view=self.prioritizationListView)
self.model.view = self
self.addCriteriaButton.clicked.connect(self.model.add_selected)
self.removeCriteriaButton.clicked.connect(self.model.remove_selected)
self.buttonBox.accepted.connect(self.accept)
self.buttonBox.rejected.connect(self.reject)
def _setupUi(self):
self.setWindowTitle(tr("Re-Prioritize duplicates"))
self.resize(700, 400)
#widgets
msg = tr("Add criteria to the right box and click OK to send the dupes that correspond the "
"best to these criteria to their respective group's "
"reference position. Read the help file for more information.")
self.promptLabel = QLabel(msg)
self.promptLabel.setWordWrap(True)
self.categoryCombobox = QComboBox()
self.criteriaListView = QListView()
self.addCriteriaButton = QPushButton(self.style().standardIcon(QStyle.SP_ArrowRight), "")
self.removeCriteriaButton = QPushButton(self.style().standardIcon(QStyle.SP_ArrowLeft), "")
self.prioritizationListView = QListView()
self.prioritizationListView.setAcceptDrops(True)
self.prioritizationListView.setDragEnabled(True)
self.prioritizationListView.setDragDropMode(QAbstractItemView.InternalMove)
self.prioritizationListView.setSelectionBehavior(QAbstractItemView.SelectRows)
self.buttonBox = QDialogButtonBox()
self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel|QDialogButtonBox.Ok)
# layout
self.mainLayout = QVBoxLayout(self)
self.mainLayout.addWidget(self.promptLabel)
self.splitter = QSplitter()
sp = self.splitter.sizePolicy()
sp.setVerticalPolicy(QSizePolicy.Expanding)
self.splitter.setSizePolicy(sp)
self.leftSide = QWidget()
self.leftWidgetsLayout = QVBoxLayout()
self.leftWidgetsLayout.addWidget(self.categoryCombobox)
self.leftWidgetsLayout.addWidget(self.criteriaListView)
self.leftSide.setLayout(self.leftWidgetsLayout)
self.splitter.addWidget(self.leftSide)
self.rightSide = QWidget()
self.rightWidgetsLayout = QHBoxLayout()
self.addRemoveButtonsLayout = QVBoxLayout()
self.addRemoveButtonsLayout.addItem(verticalSpacer())
self.addRemoveButtonsLayout.addWidget(self.addCriteriaButton)
self.addRemoveButtonsLayout.addWidget(self.removeCriteriaButton)
self.addRemoveButtonsLayout.addItem(verticalSpacer())
self.rightWidgetsLayout.addLayout(self.addRemoveButtonsLayout)
self.rightWidgetsLayout.addWidget(self.prioritizationListView)
self.rightSide.setLayout(self.rightWidgetsLayout)
self.splitter.addWidget(self.rightSide)
self.mainLayout.addWidget(self.splitter)
self.mainLayout.addWidget(self.buttonBox)