本文整理汇总了Python中PyQt5.QtWidgets.QTreeView.update方法的典型用法代码示例。如果您正苦于以下问题:Python QTreeView.update方法的具体用法?Python QTreeView.update怎么用?Python QTreeView.update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtWidgets.QTreeView
的用法示例。
在下文中一共展示了QTreeView.update方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Widget
# 需要导入模块: from PyQt5.QtWidgets import QTreeView [as 别名]
# 或者: from PyQt5.QtWidgets.QTreeView import update [as 别名]
#.........这里部分代码省略.........
a = self.editAction = act(self.slotEdit, 'document-edit')
a.setShortcut(QKeySequence(Qt.Key_F2))
editButton.setDefaultAction(a)
menu.addAction(a)
# set shortcut action
a = self.shortcutAction = act(self.slotShortcut, 'preferences-desktop-keyboard-shortcuts')
menu.addAction(a)
# delete action
a = self.deleteAction = act(self.slotDelete, 'list-remove')
a.setShortcut(QKeySequence(Qt.CTRL + Qt.Key_Delete))
menu.addAction(a)
# restore action
a = self.restoreAction = act(self.slotRestore)
menu.addSeparator()
menu.addAction(a)
# help button
a = self.helpAction = act(self.slotHelp, 'help-contents')
menu.addSeparator()
menu.addAction(a)
self.treeView.setSelectionBehavior(QTreeView.SelectRows)
self.treeView.setSelectionMode(QTreeView.ExtendedSelection)
self.treeView.setRootIsDecorated(False)
self.treeView.setAllColumnsShowFocus(True)
self.treeView.setModel(model.model())
self.treeView.setCurrentIndex(QModelIndex())
# signals
self.searchEntry.returnPressed.connect(self.slotReturnPressed)
self.searchEntry.textChanged.connect(self.updateFilter)
self.treeView.doubleClicked.connect(self.slotDoubleClicked)
self.treeView.customContextMenuRequested.connect(self.showContextMenu)
self.treeView.selectionModel().currentChanged.connect(self.updateText)
self.treeView.model().dataChanged.connect(self.updateFilter)
# highlight text
self.highlighter = highlight.Highlighter(self.textView.document())
# complete on snippet variables
self.searchEntry.setCompleter(QCompleter([
':icon', ':indent', ':menu', ':name', ':python', ':selection',
':set', ':symbol', ':template', ':template-run'], self.searchEntry))
self.readSettings()
app.settingsChanged.connect(self.readSettings)
app.translateUI(self)
self.updateColumnSizes()
self.setAcceptDrops(True)
def dropEvent(self, ev):
if not ev.source() and ev.mimeData().hasUrls():
filename = ev.mimeData().urls()[0].toLocalFile()
if filename:
ev.accept()
from . import import_export
import_export.load(filename, self)
def dragEnterEvent(self, ev):
if not ev.source() and ev.mimeData().hasUrls():
ev.accept()
def translateUI(self):
try: