本文整理汇总了Python中PyQt5.QtWidgets.QTableWidgetItem方法的典型用法代码示例。如果您正苦于以下问题:Python QtWidgets.QTableWidgetItem方法的具体用法?Python QtWidgets.QTableWidgetItem怎么用?Python QtWidgets.QTableWidgetItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtWidgets
的用法示例。
在下文中一共展示了QtWidgets.QTableWidgetItem方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: load_tab_data
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QTableWidgetItem [as 别名]
def load_tab_data(self, refresh=False):
namespace = self.manifest.list.currentItem().data(NAMESPACE_ROLE)
data = self.pkmeter.data.get(namespace, {})
data = utils.flatten_datatree(data, namespace)
if not data:
return self.load_message('Data not available for this module.')
self.datatable.setRowCount(len(data))
for row in range(len(data)):
for col in range(3):
item = QtWidgets.QTableWidgetItem(data[row][col], 0)
self.datatable.setItem(row, col, item)
if not refresh:
self.datatable_wrap.manifest.filter.setText('')
else:
self.filter_datatable()
self.datatable_wrap.setParent(self.manifest.contents)
self.manifest.contents.layout().addWidget(self.datatable_wrap)
示例2: __init__
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QTableWidgetItem [as 别名]
def __init__(self):
#self.position_struc = sim_struct.POSITION()
self.p1 = []
self.p2 = []
#self.ogl_object = None
#self.electrode.definition = 'plane'
self.didt_box = QtWidgets.QDoubleSpinBox()
self.didt_box.setSuffix("x10e6 A/s")
self.didt_box.setMinimum(0)
self.didt_box.setMaximum(200)
self.didt_box.setSingleStep(0.5)
self.didt_box.setValue(1)
self.dist_box = QtWidgets.QDoubleSpinBox()
self.dist_box.setSuffix("mm")
self.dist_box.setMinimum(0.)
self.dist_box.setMaximum(200)
self.dist_box.setSingleStep(1)
self.dist_box.setValue(4)
self.position_item = QtWidgets.QTableWidgetItem('')
self.position_item.setFlags(self.position_item.flags() ^ QtCore.Qt.ItemIsEditable)
self.name_item = QtWidgets.QTableWidgetItem('')
示例3: add_input_action
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QTableWidgetItem [as 别名]
def add_input_action(self):
self.inputs_table.setRowCount(self.inputs_table.rowCount()+1)
i = self.inputs_table.rowCount()-1
type_combo = QtWidgets.QComboBox()
type_combo.addItems(["REG", "MEM"])
action_combo = QtWidgets.QComboBox()
action_combo.addItems(["DEFAULT", "PATCH", "CONC", "SYMB", "IGNORE"])
when_combo = QtWidgets.QComboBox()
when_combo.addItems(["BEFORE", "AFTER"])
info = [type_combo, QtWidgets.QTableWidgetItem(), QtWidgets.QTableWidgetItem(), QtWidgets.QTableWidgetItem(),
action_combo, when_combo]
for col_id, widget in enumerate(info):
if isinstance(widget, QtWidgets.QTableWidgetItem):
self.inputs_table.setItem(i, col_id, widget)
else:
self.inputs_table.setCellWidget(i, col_id, widget)
return i
示例4: populate_from_profile
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QTableWidgetItem [as 别名]
def populate_from_profile(self):
profile = self.profile()
if profile.repo is not None:
self.currentRepoLabel.setText(profile.repo.url)
self.archiveTable.setRowCount(0) # clear the table
for row, archive in enumerate(
ArchiveModel.select().where(ArchiveModel.repo == profile.repo)
):
self.archiveTable.insertRow(row)
formatted_time = str(archive.time)
# formatted_time = archive.time.strftime("%Y-%m-%d %H:%M") # FIXME
self.archiveTable.setItem(row, 0, QTableWidgetItem(archive.name))
self.archiveTable.setItem(row, 1, QTableWidgetItem(formatted_time))
self.archiveTable.setItem(row, 2, QTableWidgetItem(archive.hostname))
# self.archiveTable.setRowCount(len(archives))
self._toggle_all_buttons(enabled=True)
else:
self.archiveTable.setRowCount(0)
self.currentRepoLabel.setText("N/A")
self._toggle_all_buttons(enabled=False)
示例5: add_point
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QTableWidgetItem [as 别名]
def add_point(point):
global w
if w.point_now is None:
w.point_now = point
w.point_lock = point
add_row(w)
i = w.table.rowCount() - 1
item_x = QTableWidgetItem("{0}".format(point.x()))
item_y = QTableWidgetItem("{0}".format(point.y()))
w.table.setItem(i, 0, item_x)
w.table.setItem(i, 1, item_y)
else:
w.edges.append([w.point_now.x(), w.point_now.y(),
point.x(), point.y()])
w.point_now = point
add_row(w)
i = w.table.rowCount() - 1
item_x = QTableWidgetItem("{0}".format(point.x()))
item_y = QTableWidgetItem("{0}".format(point.y()))
w.table.setItem(i, 0, item_x)
w.table.setItem(i, 1, item_y)
item_x = w.table.item(i-1, 0)
item_y = w.table.item(i-1, 1)
w.scene.addLine(point.x(), point.y(), float(item_x.text()), float(item_y.text()), w.pen)
#print(w.edges)
示例6: add_point
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QTableWidgetItem [as 别名]
def add_point(point):
global w
if w.input_bars:
if w.point_now is None:
w.point_now = point
else:
w.lines.append([[w.point_now.x(), w.point_now.y()],
[point.x(), point.y()]])
add_row(w)
i = w.table.rowCount() - 1
item_b = QTableWidgetItem("[{0}, {1}]".format(w.point_now.x(), w.point_now.y()))
item_e = QTableWidgetItem("[{0}, {1}]".format(point.x(), point.y()))
w.table.setItem(i, 0, item_b)
w.table.setItem(i, 1, item_e)
w.scene.addLine(w.point_now.x(), w.point_now.y(), point.x(), point.y(), w.pen)
w.point_now = None
示例7: add_bars
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QTableWidgetItem [as 别名]
def add_bars(win):
if len(win.edges) == 0:
QMessageBox.warning(win, "Внимание!", "Не введен отсекатель!")
return
win.pen.setColor(red)
w.lines.append([[win.edges[0].x() - 15, win.edges[0].y() - 15],
[win.edges[1].x() - 15, win.edges[1].y() - 15]])
add_row(w.table_bars)
i = w.table_bars.rowCount() - 1
item_b = QTableWidgetItem("[{0}, {1}]".format(win.edges[0].x() - 15 , win.edges[0].y() - 15))
item_e = QTableWidgetItem("[{0}, {1}]".format(win.edges[1].x() - 15, win.edges[1].y() - 15))
w.table_bars.setItem(i, 0, item_b)
w.table_bars.setItem(i, 1, item_e)
w.scene.addLine(win.edges[0].x() - 15, win.edges[0].y() - 15, win.edges[1].x() - 15, win.edges[1].y() - 15, w.pen)
win.pen.setColor(red)
w.lines.append([[win.edges[0].x() + 15, win.edges[0].y() + 15],
[win.edges[1].x() + 15, win.edges[1].y() + 15]])
add_row(w.table_bars)
i = w.table_bars.rowCount() - 1
item_b = QTableWidgetItem("[{0}, {1}]".format(win.edges[0].x() + 15, win.edges[0].y() + 15))
item_e = QTableWidgetItem("[{0}, {1}]".format(win.edges[1].x() + 15, win.edges[1].y() + 15))
w.table_bars.setItem(i, 0, item_b)
w.table_bars.setItem(i, 1, item_e)
w.scene.addLine(win.edges[0].x() + 15, win.edges[0].y() + 15, win.edges[1].x() + 15, win.edges[1].y() + 15, w.pen)
示例8: showLocationProperties
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QTableWidgetItem [as 别名]
def showLocationProperties(self, location):
if location:
props = location.value()
self.widget.propertyTable.setRowCount(len(props))
keys = list(props.keys())
keys.sort()
r = 0
for k in keys:
prop = props[k]
nameItem = QtWidgets.QTableWidgetItem(prop.pipParentKey)
if k in ['locationformid', 'locationmarkerformid']:
value = hex(prop.value())
else:
value = str(prop.value())
valueItem = QtWidgets.QTableWidgetItem(value)
self.widget.propertyTable.setItem(r, 0, nameItem)
self.widget.propertyTable.setItem(r, 1, valueItem)
r += 1
示例9: singleDownload
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QTableWidgetItem [as 别名]
def singleDownload(self):
print('single')
row = self.downloadWidget.rowCount()
self.downloadWidget.setRowCount(row+1)
item = QTableWidgetItem(self.title)
self.downloadWidget.setItem(row, 0, item)
item = QTableWidgetItem('p{}'.format(self.page))
self.downloadWidget.setItem(row, 1, item)
item = QTableWidgetItem('0/{}'.format(self.slices))
self.downloadWidget.setItem(row, 2, item)
qpb = QProgressBar()
qpb.setValue(0)
self.downloadWidget.setCellWidget(row, 3, qpb)
# print(self.links)
t = Downloader(self.av, self.links)
self.row2qthread[row] = t
t.finish.connect(self.downloaded)
t.signal.connect(self.updateItem)
t.cur_slice.connect(self.updateItem)
t.start()
# print(int(t.currentThreadId()))
示例10: downloaded
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QTableWidgetItem [as 别名]
def downloaded(self, t, slices):
"""finish a video downloading
"""
print('downloaded')
for k, v in self.row2qthread.items():
if v == t:
if slices == -1:
s = '下载出错:'+ self.downloadWidget.item(k, 0).text()
item = QTableWidgetItem(s)
self.downloadWidget.setItem(k, 0, item)
elif slices == -2:
s = '结束下载:'+ self.downloadWidget.item(k, 0).text()
item = QTableWidgetItem(s)
self.downloadWidget.setItem(k, 0, item)
else:
item = QTableWidgetItem('{0}/{0}'.format(slices))
self.downloadWidget.setItem(k, 2, item)
QMessageBox.about(self, '哔哩哔哩工具箱 v1.1 - ©Tich', '{} 下载完成!'.format(self.downloadWidget.item(k, 0).text()))
break
示例11: updateItem
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QTableWidgetItem [as 别名]
def updateItem(self, t, array):
"""update downloadWidget cell
t: qthread
array: (val1, [val2], flag)
val1: contains (downloaded count)/(total count)*100 / cur_slice
val2: total slices
op:0 => download counts
:1 => video slices
"""
val = array[0]
op = array[-1]
for k, v in self.row2qthread.items():
if v == t:
if op==0:
self.downloadWidget.cellWidget(k, 3).setValue(val)
else:
item = QTableWidgetItem('{}/{}'.format(val, array[-2]))
self.downloadWidget.setItem(k, 2, item)
return
示例12: updateTable
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QTableWidgetItem [as 别名]
def updateTable(self, w):
""":author : Tich
update data in the table
:param w: update data in `w.table`
"""
try:
num = cursor.execute("SELECT * FROM words ORDER BY origin;")
if num:
w.table.setRowCount(num)
for r in cursor:
# print(r)
i = cursor.rownumber - 1
for x in range(3):
item = QTableWidgetItem(str(r[x]))
item.setTextAlignment(Qt.AlignCenter);
w.table.setItem(i, x, item)
except Exception as e:
# print(e)
self.messageBox("update table error!\nerror msg: %s"%e.args[1])
示例13: find_fakefast_on_click
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QTableWidgetItem [as 别名]
def find_fakefast_on_click(self):
start_addr = int(self.t_fakefast_addr.text(), 16)
fake_chunks = self.heap.find_fakefast(start_addr)
if len(fake_chunks) == 0:
idaapi.info("Fakefast: 0 results")
return
self.tbl_fakefast.clearContents()
self.tbl_fakefast.setRowCount(0)
self.tbl_fakefast.setSortingEnabled(False)
for idx, chunk in enumerate(fake_chunks):
self.tbl_fakefast.insertRow(idx)
self.tbl_fakefast.setItem(idx, 0, QtWidgets.QTableWidgetItem("%d" % chunk['fast_id']))
self.tbl_fakefast.setItem(idx, 1, QtWidgets.QTableWidgetItem("0x%x" % chunk['size']))
self.tbl_fakefast.setItem(idx, 2, QtWidgets.QTableWidgetItem("%d" % chunk['bytes_to']))
self.tbl_fakefast.setItem(idx, 3, QtWidgets.QTableWidgetItem("0x%x" % chunk['address']))
self.tbl_fakefast.resizeRowsToContents()
self.tbl_fakefast.resizeColumnsToContents()
self.tbl_fakefast.setSortingEnabled(True)
# -----------------------------------------------------------------------
示例14: CodoLargo
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QTableWidgetItem [as 别名]
def CodoLargo(self):
title = QtWidgets.QApplication.translate("pychemqt", "Long Pipe Bend")
icon = os.environ["pychemqt"]+"/images/equip/LB.png"
parameter = [
QtWidgets.QApplication.translate("pychemqt", "Bend radio"),
QtWidgets.QApplication.translate("pychemqt", "Pipe diameter")]
dialog = Dialog(2, title, icon, parameter)
if dialog.exec_():
indice = self.Accesorios.rowCount()
self.Accesorios.setRowCount(indice+1)
self.Accesorios.setItem(indice, 0, QtWidgets.QTableWidgetItem(
QtGui.QIcon(QtGui.QPixmap(icon)), "LB"))
self.Accesorios.setSpan(indice, 1, 1, 2)
self.Accesorios.setItem(indice, 1, QtWidgets.QTableWidgetItem(
"r=%0.3f, D=%0.3f" % (dialog.D1.value.mm, dialog.D2.value.mm)))
self.Accesorios.setItem(indice, 3, QtWidgets.QTableWidgetItem(
representacion(dialog.K, 3)))
self.Accesorios.item(indice, 3).setTextAlignment(
QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
self.Accesorios.setItem(indice, 4, QtWidgets.QTableWidgetItem(str(1)))
self.Accesorios.item(indice, 4).setTextAlignment(
QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
self.Accesorios.setItem(indice, 5, QtWidgets.QTableWidgetItem(title))
self.Accesorios.setRowHeight(indice, 20)
self.CalcularK()
示例15: CodoSegmentado
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QTableWidgetItem [as 别名]
def CodoSegmentado(self):
title = QtWidgets.QApplication.translate("pychemqt", "Mitre bend with custom angle")
icon = os.environ["pychemqt"]+"/images/equip/MB45.png"
parameter = [QtWidgets.QApplication.translate("pychemqt", "Pipe diameter"), ""]
dialog = Dialog(1, title, icon, parameter)
if dialog.exec_():
indice = self.Accesorios.rowCount()
self.Accesorios.setRowCount(indice+1)
self.Accesorios.setItem(indice, 0, QtWidgets.QTableWidgetItem(
QtGui.QIcon(QtGui.QPixmap(icon)), "MBx"))
self.Accesorios.setItem(indice, 1, QtWidgets.QTableWidgetItem(
"%0.3f" % dialog.D1.value.mm))
self.Accesorios.setItem(indice, 2, QtWidgets.QTableWidgetItem(
"θ=%iº" % dialog.angulo.value()))
self.Accesorios.setItem(indice, 3, QtWidgets.QTableWidgetItem(
representacion(dialog.K, 3)))
self.Accesorios.item(indice, 3).setTextAlignment(
QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
self.Accesorios.setItem(indice, 4, QtWidgets.QTableWidgetItem(str(1)))
self.Accesorios.item(indice, 4).setTextAlignment(
QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
self.Accesorios.setItem(indice, 5, QtWidgets.QTableWidgetItem(
QtWidgets.QApplication.translate("pychemqt", "Mitre Bend")))
self.Accesorios.setRowHeight(indice, 20)
self.CalcularK()