本文整理汇总了Python中PySide2.QtWidgets.QTableWidget方法的典型用法代码示例。如果您正苦于以下问题:Python QtWidgets.QTableWidget方法的具体用法?Python QtWidgets.QTableWidget怎么用?Python QtWidgets.QTableWidget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide2.QtWidgets
的用法示例。
在下文中一共展示了QtWidgets.QTableWidget方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setupUi
# 需要导入模块: from PySide2 import QtWidgets [as 别名]
# 或者: from PySide2.QtWidgets import QTableWidget [as 别名]
def setupUi(self, TabItemWindow):
TabItemWindow.setObjectName("TabItemWindow")
TabItemWindow.resize(400, 300)
self.verticalLayout = QtWidgets.QVBoxLayout(TabItemWindow)
self.verticalLayout.setSpacing(0)
self.verticalLayout.setContentsMargins(0, 0, 0, 0)
self.verticalLayout.setObjectName("verticalLayout")
self.tableWidget = QtWidgets.QTableWidget(TabItemWindow)
self.tableWidget.setColumnCount(1)
self.tableWidget.setObjectName("tableWidget")
self.tableWidget.setColumnCount(1)
self.tableWidget.setRowCount(0)
self.tableWidget.horizontalHeader().setVisible(False)
self.tableWidget.horizontalHeader().setStretchLastSection(True)
self.tableWidget.verticalHeader().setDefaultSectionSize(24)
self.tableWidget.verticalHeader().setHighlightSections(False)
self.verticalLayout.addWidget(self.tableWidget)
self.retranslateUi(TabItemWindow)
QtCore.QMetaObject.connectSlotsByName(TabItemWindow)
示例2: __init__
# 需要导入模块: from PySide2 import QtWidgets [as 别名]
# 或者: from PySide2.QtWidgets import QTableWidget [as 别名]
def __init__(self, node):
super().__init__()
self.node: NetworkNode = node
self.delete_popup = None
self.layout = QGridLayout()
self.table = QTableWidget(0, 3)
self.table.setHorizontalHeaderLabels(['Id', 'Key', 'Value'])
self.table.setColumnHidden(0, True)
self.node.configuration.configuration_changed.connect(
self.handle_configuration_change
)
self.table.cellChanged.connect(self.handle_cell_change)
self.layout.addWidget(self.table, 0, 0, 1, 2)
self.deleteButton = QPushButton('Remove Selected Row')
self.deleteButton.clicked.connect(
self.handle_delete_action
)
self.layout.addWidget(self.deleteButton, 1, 0)
self.addButton = QPushButton('Add Configuration')
self.addButton.clicked.connect(
self.handle_add_action
)
self.layout.addWidget(self.addButton, 1, 1)
self.setLayout(self.layout)
#################################
# Add/Update/Get for table rows #
#################################
示例3: setLang
# 需要导入模块: from PySide2 import QtWidgets [as 别名]
# 或者: from PySide2.QtWidgets import QTableWidget [as 别名]
def setLang(self, langName):
lang_data = self.memoData['lang'][langName]
for ui_name in lang_data.keys():
if ui_name in self.uiList.keys() and lang_data[ui_name] != '':
ui_element = self.uiList[ui_name]
# '' means no translation availdanle in that data file
if isinstance(ui_element, (QtWidgets.QLabel, QtWidgets.QPushButton, QtWidgets.QAction, QtWidgets.QCheckBox) ):
# uiType: QLabel, QPushButton, QAction(menuItem), QCheckBox
ui_element.setText(lang_data[ui_name])
elif isinstance(ui_element, (QtWidgets.QGroupBox, QtWidgets.QMenu) ):
# uiType: QMenu, QGroupBox
ui_element.setTitle(lang_data[ui_name])
elif isinstance(ui_element, QtWidgets.QTabWidget):
# uiType: QTabWidget
tabCnt = ui_element.count()
tabNameList = lang_data[ui_name].split(';')
if len(tabNameList) == tabCnt:
for i in range(tabCnt):
if tabNameList[i] != '':
ui_element.setTabText(i,tabNameList[i])
elif isinstance(ui_element, QtWidgets.QComboBox):
# uiType: QComboBox
itemCnt = ui_element.count()
itemNameList = lang_data[ui_name].split(';')
ui_element.clear()
ui_element.addItems(itemNameList)
elif isinstance(ui_element, QtWidgets.QTreeWidget):
# uiType: QTreeWidget
labelCnt = ui_element.headerItem().columnCount()
labelList = lang_data[ui_name].split(';')
ui_element.setHeaderLabels(labelList)
elif isinstance(ui_element, QtWidgets.QTableWidget):
# uiType: QTableWidget
colCnt = ui_element.columnCount()
headerList = lang_data[ui_name].split(';')
cur_table.setHorizontalHeaderLabels( headerList )
elif isinstance(ui_element, (str, unicode) ):
# uiType: string for msg
self.uiList[ui_name] = lang_data[ui_name]
示例4: __init__
# 需要导入模块: from PySide2 import QtWidgets [as 别名]
# 或者: from PySide2.QtWidgets import QTableWidget [as 别名]
def __init__(self, parent=None, mode=0):
QtWidgets.QMainWindow.__init__(self, parent)
#------------------------------
# class variables
#------------------------------
self.version = '0.1'
self.date = '2017.01.01'
self.log = 'no version log in user class'
self.help = 'no help guide in user class'
self.uiList={} # for ui obj storage
self.memoData = {} # key based variable data storage
self.memoData['font_size_default'] = QtGui.QFont().pointSize()
self.memoData['font_size'] = self.memoData['font_size_default']
self.memoData['last_export'] = ''
self.memoData['last_import'] = ''
self.name = self.__class__.__name__
self.location = ''
if getattr(sys, 'frozen', False):
# frozen - cx_freeze
self.location = sys.executable
else:
# unfrozen
self.location = os.path.realpath(sys.modules[self.__class__.__module__].__file__)
self.iconPath = os.path.join(os.path.dirname(self.location),'icons',self.name+'.png')
self.iconPix = QtGui.QPixmap(self.iconPath)
self.icon = QtGui.QIcon(self.iconPath)
self.fileType='.{0}_EXT'.format(self.name)
#------------------------------
# core function variable
#------------------------------
self.qui_core_dict = {
'vbox': 'QVBoxLayout','hbox':'QHBoxLayout','grid':'QGridLayout', 'form':'QFormLayout',
'split': 'QSplitter', 'grp':'QGroupBox', 'tab':'QTabWidget',
'btn':'QPushButton', 'btnMsg':'QPushButton', 'label':'QLabel', 'input':'QLineEdit', 'check':'QCheckBox', 'choice':'QComboBox',
'txt': 'QTextEdit',
'list': 'QListWidget', 'tree': 'QTreeWidget', 'table': 'QTableWidget',
'space': 'QSpacerItem',
'menu' : 'QMenu', 'menubar' : 'QMenuBar',
}
self.qui_user_dict = {}
示例5: __init__
# 需要导入模块: from PySide2 import QtWidgets [as 别名]
# 或者: from PySide2.QtWidgets import QTableWidget [as 别名]
def __init__(self, parent=None, mode=0):
QtWidgets.QMainWindow.__init__(self, parent)
#------------------------------
# class variables
#------------------------------
self.version = '0.1'
self.date = '2017.01.01'
self.log = 'no version log in user class'
self.help = 'no help guide in user class'
self.hotkey = {}
self.uiList={} # for ui obj storage
self.memoData = {} # key based variable data storage
self.memoData['font_size_default'] = QtGui.QFont().pointSize()
self.memoData['font_size'] = self.memoData['font_size_default']
self.memoData['last_export'] = ''
self.memoData['last_import'] = ''
self.name = self.__class__.__name__
self.location = ''
if getattr(sys, 'frozen', False):
# frozen - cx_freeze
self.location = sys.executable
else:
# unfrozen
self.location = os.path.realpath(sys.modules[self.__class__.__module__].__file__)
self.iconPath = os.path.join(os.path.dirname(self.location),'icons',self.name+'.png')
self.iconPix = QtGui.QPixmap(self.iconPath)
self.icon = QtGui.QIcon(self.iconPath)
self.fileType='.{0}_EXT'.format(self.name)
#------------------------------
# core function variable
#------------------------------
self.qui_core_dict = {
'vbox': 'QVBoxLayout','hbox':'QHBoxLayout','grid':'QGridLayout', 'form':'QFormLayout',
'split': 'QSplitter', 'grp':'QGroupBox', 'tab':'QTabWidget',
'btn':'QPushButton', 'btnMsg':'QPushButton', 'label':'QLabel', 'input':'QLineEdit', 'check':'QCheckBox', 'choice':'QComboBox',
'txt': 'QTextEdit',
'list': 'QListWidget', 'tree': 'QTreeWidget', 'table': 'QTableWidget',
'space': 'QSpacerItem',
'menu' : 'QMenu', 'menubar' : 'QMenuBar',
}
self.qui_user_dict = {}
示例6: __init__
# 需要导入模块: from PySide2 import QtWidgets [as 别名]
# 或者: from PySide2.QtWidgets import QTableWidget [as 别名]
def __init__(self, parent=None):
QtWidgets.QMainWindow.__init__(self, parent)
# class property
self.tpl_ver = tpl_ver
self.tpl_date = tpl_date
self.version = '0.1'
self.date = '2017.01.01'
self.log = 'no version log in user class'
self.help = 'no help guide in user class'
# class info
self.name = self.__class__.__name__
self.fileType='.{0}_EXT'.format(self.name)
# class path and icon
self.location = ''
if getattr(sys, 'frozen', False):
self.location = sys.executable # frozen case - cx_freeze
else:
self.location = os.path.realpath(sys.modules[self.__class__.__module__].__file__)
self.iconPath = os.path.join(os.path.dirname(self.location),'icons',self.name+'.png')
self.iconPix = QtGui.QPixmap(self.iconPath)
self.icon = QtGui.QIcon(self.iconPath)
# class data
self.hotkey = {}
self.uiList={} # for ui obj storage
self.memoData = {} # key based variable data storage
self.memoData['font_size_default'] = QtGui.QFont().pointSize()
self.memoData['font_size'] = self.memoData['font_size_default']
self.memoData['last_export'] = ''
self.memoData['last_import'] = ''
self.memoData['last_browse'] = ''
# core function variable
self.qui_core_dict = {
'vbox': 'QVBoxLayout','hbox':'QHBoxLayout','grid':'QGridLayout', 'form':'QFormLayout',
'split': 'QSplitter', 'grp':'QGroupBox', 'tab':'QTabWidget',
'btn':'QPushButton', 'btnMsg':'QPushButton', 'label':'QLabel', 'input':'QLineEdit', 'check':'QCheckBox', 'choice':'QComboBox', 'spin':'QSpinBox',
'txt': 'QTextEdit',
'list': 'QListWidget', 'tree': 'QTreeWidget', 'table': 'QTableWidget',
'space': 'QSpacerItem',
'menu' : 'QMenu', 'menubar' : 'QMenuBar',
}
self.qui_user_dict = {}
示例7: __init__
# 需要导入模块: from PySide2 import QtWidgets [as 别名]
# 或者: from PySide2.QtWidgets import QTableWidget [as 别名]
def __init__(self, parent=None, mode=0):
super_class.__init__(self, parent)
#------------------------------
# class variables
#------------------------------
self.version = "0.1"
self.date = '2017.01.01'
self.log = 'no version log in user class'
self.help = 'no help guide in user class'
self.uiList={} # for ui obj storage
self.memoData = {} # key based variable data storage
self.memoData['font_size_default'] = QtGui.QFont().pointSize()
self.memoData['font_size'] = self.memoData['font_size_default']
self.memoData['last_export'] = ''
self.memoData['last_import'] = ''
self.location = ""
if getattr(sys, 'frozen', False):
# frozen - cx_freeze
self.location = sys.executable
else:
# unfrozen
self.location = os.path.realpath(sys.modules[self.__class__.__module__].__file__)
self.name = self.__class__.__name__
self.iconPath = os.path.join(os.path.dirname(self.location),'icons',self.name+'.png')
self.iconPix = QtGui.QPixmap(self.iconPath)
self.icon = QtGui.QIcon(self.iconPath)
self.fileType='.{0}_EXT'.format(self.name)
#------------------------------
# core function variable
#------------------------------
self.qui_core_dict = {
'vbox': 'QVBoxLayout','hbox':'QHBoxLayout','grid':'QGridLayout', 'form':'QFormLayout',
'split': 'QSplitter', 'grp':'QGroupBox', 'tab':'QTabWidget',
'btn':'QPushButton', 'btnMsg':'QPushButton', 'label':'QLabel', 'input':'QLineEdit', 'check':'QCheckBox', 'choice':'QComboBox',
'txt': 'QTextEdit',
'list': 'QListWidget', 'tree': 'QTreeWidget', 'table': 'QTableWidget',
'space': 'QSpacerItem',
'menu' : 'QMenu', 'menubar' : 'QMenuBar',
}
self.qui_user_dict = {}
#------------------------------
示例8: __init__
# 需要导入模块: from PySide2 import QtWidgets [as 别名]
# 或者: from PySide2.QtWidgets import QTableWidget [as 别名]
def __init__(self, parent=None, mode=0):
super_class.__init__(self, parent)
#------------------------------
# class variables
#------------------------------
self.version = "0.1"
self.date = '2017.01.01'
self.log = 'no version log in user class'
self.help = 'no help guide in user class'
self.uiList={} # for ui obj storage
self.memoData = {} # key based variable data storage
self.memoData['font_size_default'] = QtGui.QFont().pointSize()
self.memoData['font_size'] = self.memoData['font_size_default']
self.location = ""
if getattr(sys, 'frozen', False):
# frozen - cx_freeze
self.location = sys.executable
else:
# unfrozen
self.location = os.path.realpath(sys.modules[self.__class__.__module__].__file__)
self.name = self.__class__.__name__
self.iconPath = os.path.join(os.path.dirname(self.location),'icons',self.name+'.png')
self.iconPix = QtGui.QPixmap(self.iconPath)
self.icon = QtGui.QIcon(self.iconPath)
self.fileType='.{0}_EXT'.format(self.name)
#------------------------------
# core function variable
#------------------------------
self.qui_core_dict = {
'vbox': 'QVBoxLayout','hbox':'QHBoxLayout','grid':'QGridLayout', 'form':'QFormLayout',
'split': 'QSplitter', 'grp':'QGroupBox', 'tab':'QTabWidget',
'btn':'QPushButton', 'btnMsg':'QPushButton', 'label':'QLabel', 'input':'QLineEdit', 'check':'QCheckBox', 'choice':'QComboBox',
'txt': 'QTextEdit',
'list': 'QListWidget', 'tree': 'QTreeWidget', 'table': 'QTableWidget',
'space': 'QSpacerItem',
'menu' : 'QMenu', 'menubar' : 'QMenuBar',
}
self.qui_user_dict = {}
#------------------------------