本文整理汇总了Python中PySide.QtGui.QTableView.setEditTriggers方法的典型用法代码示例。如果您正苦于以下问题:Python QTableView.setEditTriggers方法的具体用法?Python QTableView.setEditTriggers怎么用?Python QTableView.setEditTriggers使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.QtGui.QTableView
的用法示例。
在下文中一共展示了QTableView.setEditTriggers方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _addtabondemand
# 需要导入模块: from PySide.QtGui import QTableView [as 别名]
# 或者: from PySide.QtGui.QTableView import setEditTriggers [as 别名]
def _addtabondemand(self, thread):
"""Adds a new tab for the given thread, if it doesn't exist yet.
If it does, it will be made the current tab.
@param thread Instance of FourChanThreahHeader
"""
i = thread.id_()
if not i in self._openthreads.keys():
table = QTableView(self)
table.setModel(LiveFeedModel(self))
table.setAlternatingRowColors(True)
table.setEditTriggers(QAbstractItemView.NoEditTriggers)
table.setIconSize(QSize(192, 192))
table.horizontalHeader().setVisible(False)
table.horizontalHeader().setDefaultSectionSize(192)
table.horizontalHeader().setStretchLastSection(True)
table.verticalHeader().setVisible(False)
table.verticalHeader().setDefaultSectionSize(192)
table.doubleClicked.connect(self._showlivepost)
idx = self.tabPosts.addTab(table, "/%s/%s" % (thread.forum(), i))
self._openthreads[i] = (idx, thread, table)
fct = FourChanThread(
FourChanThreadUrl(thread.url()), self._masterobserver)
fct.postadded.connect(self._updatethread)
self._masterobserver.addobserver(
FourChanThreadObserver(fct, parent=self))
fct.refresh(True)
else:
idx = self._openthreads[i][0]
self.tabPosts.setCurrentIndex(idx)
示例2: setupTabs
# 需要导入模块: from PySide.QtGui import QTableView [as 别名]
# 或者: from PySide.QtGui.QTableView import setEditTriggers [as 别名]
def setupTabs(self):
""" Setup the various tabs in the AddressWidget. """
groups = ["ABC", "DEF", "GHI", "JKL", "MNO", "PQR", "STU", "VW", "XYZ"]
for group in groups:
proxyModel = QSortFilterProxyModel(self)
proxyModel.setSourceModel(self.tableModel)
proxyModel.setDynamicSortFilter(True)
tableView = QTableView()
tableView.setModel(proxyModel)
tableView.setSortingEnabled(True)
tableView.setSelectionBehavior(QAbstractItemView.SelectRows)
tableView.horizontalHeader().setStretchLastSection(True)
tableView.verticalHeader().hide()
tableView.setEditTriggers(QAbstractItemView.NoEditTriggers)
tableView.setSelectionMode(QAbstractItemView.SingleSelection)
# This here be the magic: we use the group name (e.g. "ABC") to
# build the regex for the QSortFilterProxyModel for the group's
# tab. The regex will end up looking like "^[ABC].*", only
# allowing this tab to display items where the name starts with
# "A", "B", or "C". Notice that we set it to be case-insensitive.
reFilter = "^[%s].*" % group
proxyModel.setFilterRegExp(QRegExp(reFilter, Qt.CaseInsensitive))
proxyModel.setFilterKeyColumn(0) # Filter on the "name" column
proxyModel.sort(0, Qt.AscendingOrder)
tableView.selectionModel().selectionChanged.connect(self.selectionChanged)
self.addTab(tableView, group)
示例3: __init__
# 需要导入模块: from PySide.QtGui import QTableView [as 别名]
# 或者: from PySide.QtGui.QTableView import setEditTriggers [as 别名]
def __init__(self, parent=None):
super(MainWindow, self).__init__(parent)
database = QSqlDatabase.addDatabase('QSQLITE')
database.setDatabaseName('astatsscraper.db') # Better lookup logic needed
if not database.open():
print('Error opening database!')
model = QSqlTableModel(db=database)
model.setTable('steam_apps')
table = QTableView()
table.setEditTriggers(QAbstractItemView.NoEditTriggers)
table.setModel(model)
self.setCentralWidget(table)
table.show()
示例4: uiManager
# 需要导入模块: from PySide.QtGui import QTableView [as 别名]
# 或者: from PySide.QtGui.QTableView import setEditTriggers [as 别名]
class uiManager(QMainWindow):
def __init__(self):
super(uiManager, self).__init__()
self.setMinimumSize(900,500)
self.setWindowTitle("Manage")
self.aFileModel = FileModel() # Add files
self.sFileModel = FileModel() # Queried files
self.eFileModel = FileModel() # Editing files
self.tabWidget = QTabWidget()
self.setCentralWidget(self.tabWidget)
self.defActions()
self.addTab()
self.searchTab()
self.editTab()
self.testtab()
self.statusBar().showMessage("Hi.")
def defActions(self):
self.findAct = QAction("+", self, triggered=self.findFilesDlg)
self.dropAddTabAct = QAction("-", self, shortcut="Delete",
triggered=self.dropAddTabRows)
self.dropEditTabAct = QAction("-", self, shortcut="Delete",
triggered=self.dropEditTabRows)
def dropEditTabRows(self):
self.dropFiles(self.eFileTable, self.eFileModel)
def dropAddTabRows(self):
self.dropFiles(self.aFileTable, self.aFileModel)
def testtab(self):
self.test = QWidget()
self.tabWidget.addTab(self.test, "WORDS")
self.tabWidget.setCornerWidget(self.test)
def addTab(self):
self.aFileTable = QTableView()
self.aFileTable.setModel(self.aFileModel)
self.aFileTable.setSelectionBehavior(QAbstractItemView.SelectRows)
self.setColumnsWidths(self.aFileTable)
self.addWidget = QWidget()
vLayout = QVBoxLayout()
vLayout.addWidget(self.aFileTable)
addBtn = QToolButton()
addBtn.setDefaultAction(self.findAct)
# addBtn.clicked.connect(self.findFilesDlg)
dropBtn = QToolButton()
dropBtn.setDefaultAction(self.dropAddTabAct)
# rmvBtn.clicked.connect(self.rmvFiles)
insBtn = QPushButton("Track")
insBtn.clicked.connect(self.insert)
hLayout = QHBoxLayout()
hLayout.addWidget(addBtn)
hLayout.addWidget(dropBtn)
hLayout.addStretch(1)
hLayout.addWidget(insBtn)
vLayout.addLayout(hLayout)
self.addWidget.setLayout(vLayout)
self.tabWidget.addTab(self.addWidget, u"Add")
def searchTab(self):
# sFileModel + view tab
self.sFileTable = QTableView()
self.sFileTable.setModel(self.sFileModel)
self.sFileTable.setEditTriggers(QAbstractItemView.NoEditTriggers)
self.sFileTable.setSelectionBehavior(QAbstractItemView.SelectRows)
self.setColumnsWidths(self.sFileTable)
self.searchWidget = QWidget()
# Horizontal layout
# Button, Line Edit, Button
hLayout = QHBoxLayout()
self.searchBox = QLineEdit()
#.........这里部分代码省略.........