本文整理汇总了Python中PyQt5.QtWidgets.QTableView.setCurrentIndex方法的典型用法代码示例。如果您正苦于以下问题:Python QTableView.setCurrentIndex方法的具体用法?Python QTableView.setCurrentIndex怎么用?Python QTableView.setCurrentIndex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtWidgets.QTableView
的用法示例。
在下文中一共展示了QTableView.setCurrentIndex方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: SubtitleEditor
# 需要导入模块: from PyQt5.QtWidgets import QTableView [as 别名]
# 或者: from PyQt5.QtWidgets.QTableView import setCurrentIndex [as 别名]
#.........这里部分代码省略.........
for subNo in subNos:
self.refreshSubtitle(subNo)
def _createNewSubtitle(self, data, subNo):
fps = data.fps # data is passed to avoid unnecessary copies
minFrameTime = FrameTime(fps, frames = 1)
# calculate correct minimum subtitle start time
if subNo > 0:
timeStart = data.subtitles[subNo - 1].end + minFrameTime
else:
timeStart = FrameTime(fps, frames = 0)
# calculate correct maximum subtitle end time
if subNo < data.subtitles.size():
try:
timeEnd = data.subtitles[subNo].start - minFrameTime
except SubException:
timeEnd = FrameTime(fps, frames = 0)
else:
timeEnd = timeStart + FrameTime(fps, frames = 50)
# add subtitle to DataModel
sub = Subtitle(timeStart, timeEnd, "")
command = AddSubtitle(self.filePath, subNo, sub)
with DisableSignalling(self._subtitleData.subtitlesAdded, self._subtitlesAdded):
self._subtitleData.execute(command)
# create subtitle graphical representation in editor sub list
row = createRow(sub)
self._model.insertRow(subNo, row)
index = self._model.index(subNo, 2)
self._subList.clearSelection()
self._subList.setCurrentIndex(index)
self._subList.edit(index)
def addNewSubtitle(self):
data = self.data
subNo = data.subtitles.size()
indices = self._subList.selectedIndexes()
if len(indices) > 0:
rows = [index.row() for index in indices]
subNo = max(rows) + 1
self._createNewSubtitle(data, subNo)
def insertNewSubtitle(self):
data = self.data
subNo = 0
indices = self._subList.selectedIndexes()
if len(indices) > 0:
rows = [index.row() for index in indices]
subNo = max(rows)
self._createNewSubtitle(data, subNo)
def removeSelectedSubtitles(self):
indices = self._subList.selectedIndexes()
if len(indices) > 0:
rows = list(set([index.row() for index in indices]))
command = RemoveSubtitles(self.filePath, rows)
self._subtitleData.execute(command)
if self._model.rowCount() > rows[-1]:
self._subList.selectRow(rows[-1])
else:
self._subList.selectRow(self._model.rowCount() - 1)
def highlight(self):