当前位置: 首页>>代码示例>>Python>>正文


Python QtWidgets.QTableWidgetItem方法代码示例

本文整理汇总了Python中PySide2.QtWidgets.QTableWidgetItem方法的典型用法代码示例。如果您正苦于以下问题:Python QtWidgets.QTableWidgetItem方法的具体用法?Python QtWidgets.QTableWidgetItem怎么用?Python QtWidgets.QTableWidgetItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PySide2.QtWidgets的用法示例。


在下文中一共展示了QtWidgets.QTableWidgetItem方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: add_row

# 需要导入模块: from PySide2 import QtWidgets [as 别名]
# 或者: from PySide2.QtWidgets import QTableWidgetItem [as 别名]
def add_row(self, row: int, item_text: str, item_text_color: QColor = color.TABLE_CODE_TEXT_COLOR, item_background_color=color.TABLE_CODE_BACKGROUND_COLOR, header_text: str = ''):
        self.table_widget.setRowCount(row + 1)
        table_header = QTableWidgetItem(header_text)
        self.table_widget.setVerticalHeaderItem(row, table_header)
        table_item = QTableWidgetItem(item_text)
        table_item.setTextColor(item_text_color)
        table_item.setFlags(table_item.flags() ^ Qt.ItemIsEditable)
        table_item.setBackgroundColor(item_background_color)
        self.table_widget.setItem(row, 0, table_item) 
开发者ID:yukiarrr,项目名称:Il2cppSpy,代码行数:11,代码来源:tab_item_view.py

示例2: handle_add_action

# 需要导入模块: from PySide2 import QtWidgets [as 别名]
# 或者: from PySide2.QtWidgets import QTableWidgetItem [as 别名]
def handle_add_action(self):

        self.table.cellChanged.disconnect()

        row_index = self.table.rowCount()
        self.table.insertRow(row_index)
        identifierItem = QTableWidgetItem()
        identifierItem.setFlags(editDisabledFlags)
        self.table.setItem(row_index, 0, identifierItem)

        self.table.cellChanged.connect(self.handle_cell_change) 
开发者ID:lightning-power-users,项目名称:node-launcher,代码行数:13,代码来源:configuration.py

示例3: newLang_action

# 需要导入模块: from PySide2 import QtWidgets [as 别名]
# 或者: from PySide2.QtWidgets import QTableWidgetItem [as 别名]
def newLang_action(self):
        if len(self.memoData['fileList'].keys()) == 0:
            print("You need have UI name structure loaded in order to create a new language.")
        else:
            text, ok = QtWidgets.QInputDialog.getText(self, 'New Translation Creation', 'Enter language file name (eg. lang_cn):')
            if ok:
                if text in self.memoData['fileList'].keys():
                    print("This Language already in the table.")
                else:
                    self.uiList['dict_table'].insertColumn(self.uiList['dict_table'].columnCount())
                    index = self.uiList['dict_table'].columnCount() - 1
                    self.uiList['dict_table'].setHorizontalHeaderItem(index, QtWidgets.QTableWidgetItem(text) ) 
开发者ID:shiningdesign,项目名称:universal_tool_template.py,代码行数:14,代码来源:UITranslator.py

示例4: memory_to_source_ui

# 需要导入模块: from PySide2 import QtWidgets [as 别名]
# 或者: from PySide2.QtWidgets import QTableWidgetItem [as 别名]
def memory_to_source_ui(self):
        # update ui once memory gets update
        txt='\n'.join([row for row in self.memoData['fileList']])
        self.uiList['source_txtEdit'].setText(txt)
        # table
        table = self.uiList['dict_table']
        table.clear()
        table.setRowCount(0)
        table.setColumnCount(0)
        
        headers = ["UI Name"]
        table.insertColumn(table.columnCount())
        for key in self.memoData['fileList']:
            headers.append(key)
            table.insertColumn(table.columnCount())
        table.setHorizontalHeaderLabels(headers)
        
        ui_name_ok = 0
        translate = 1
        for file in self.memoData['fileList']:
            for row, ui_name in enumerate(self.memoData['fileList'][file]):
                #create ui list
                if ui_name_ok == 0:
                    ui_item = QtWidgets.QTableWidgetItem(ui_name)
                    table.insertRow(table.rowCount())
                    table.setItem(row, 0, ui_item)
                translate_item = QtWidgets.QTableWidgetItem(self.memoData['fileList'][file][ui_name])
                table.setItem(row, translate, translate_item)
            ui_name_ok = 1
            translate +=1 
开发者ID:shiningdesign,项目名称:universal_tool_template.py,代码行数:32,代码来源:UITranslator.py

示例5: widgets

# 需要导入模块: from PySide2 import QtWidgets [as 别名]
# 或者: from PySide2.QtWidgets import QTableWidgetItem [as 别名]
def widgets(self):
        state = self.state

        name = state.gui_data.name
        base_name = state.gui_data.base_name
        is_changed = 'No' if state.gui_data.is_original else 'Yes'
        mode = state.mode
        address = '%#x' % state.addr if isinstance(state.addr, int) else 'Symbolic'
        state_options = {o for o, v in state.options._options.items() if v is True}
        options_plus = state_options - angr.sim_options.modes[mode]
        options_minus = angr.sim_options.modes[mode] - state_options
        options = ' '.join([' '.join('+' + o for o in options_plus), ' '.join('-' + o for o in options_minus)])

        widgets = [
            QTableWidgetItem(name),
            QTableWidgetItem(address),
            QTableWidgetItem(is_changed),
            QTableWidgetItem(base_name),
            QTableWidgetItem(mode),
            QTableWidgetItem(options),
        ]

        if state.gui_data.is_base:
            color = QColor(0, 0, 0x80)
        elif state.gui_data.is_original:
            color = QColor(0, 0x80, 0)
        else:
            color = QColor(0, 0, 0)

        for w in widgets:
            w.setFlags(w.flags() & ~Qt.ItemIsEditable)
            w.setForeground(color)

        return widgets 
开发者ID:angr,项目名称:angr-management,代码行数:36,代码来源:qstate_table.py

示例6: update_row

# 需要导入模块: from PySide2 import QtWidgets [as 别名]
# 或者: from PySide2.QtWidgets import QTableWidgetItem [as 别名]
def update_row(self, key, value, identifier=None, row_index=None):
        """
        Updates a table row by row index or identifier, with key and value.

        :param key: Key for that row
        :param value: Value for that row
        :param identifier: identifier of the row to be updated
        :param row_index: Index of the row to be updated
        :return: None
        """

        if identifier is None and row_index is None:
            return

        # Disconnecting cellChanged event so we don't get a feedback loop
        self.table.cellChanged.disconnect()

        if row_index is not None:
            for column_index, cell_text in enumerate([identifier, key, value]):
                item = QTableWidgetItem()
                item.setText(str(cell_text) if cell_text is not None else '')

                if column_index != 2:
                    item.setFlags(editDisabledFlags)

                self.table.setItem(row_index, column_index, item)
        elif identifier is not None:
            for row_index in range(self.table.rowCount()):
                row_identifier = self.table.item(row_index, 0).text()
                if row_identifier == identifier:
                    key_item = QTableWidgetItem()
                    key_item.setText(key)
                    key_item.setFlags(editDisabledFlags)
                    value_item = QTableWidgetItem()
                    value_item.setText(str(value))
                    self.table.setItem(row_index, 1, key_item)
                    self.table.setItem(row_index, 2, value_item)
                    break

        # Connecting the cellChanged event again
        self.table.cellChanged.connect(self.handle_cell_change)

        self.table.resizeColumnsToContents() 
开发者ID:lightning-power-users,项目名称:node-launcher,代码行数:45,代码来源:configuration.py

示例7: setupUI

# 需要导入模块: from PySide2 import QtWidgets [as 别名]
# 或者: from PySide2.QtWidgets import QTableWidgetItem [as 别名]
def setupUI(self):
        super(self.__class__,self).setupUI('grid')
        #------------------------------
        # user ui creation part
        #------------------------------
        # + template: qui version since universal tool template v7
        #   - no extra variable name, all text based creation and reference
        
        self.qui('box_btn;Box | sphere_btn;Sphere | ring_btn;Ring', 'my_layout;grid', 'h')
        self.qui('box2_btn;Box2 | sphere2_btn;Sphere2 | ring2_btn;Ring2', 'my_layout', 'h')
        
        self.qui('cat_btn;Cat | dog_btn;Dog | pig_btn;Pig', 'pet_layout;grid', 'v')
        self.qui('cat2_btn;Cat2 | dog2_btn;Dog2 | pig2_btn;Pig2', 'pet_layout', 'v')
        
        self.qui('name_input@Name:;John | email_input@Email:;test@test.com', 'entry_form')
        
        self.qui('user2_btn;User2 | info2_btn;Info2', 'my_grp;vbox,Personal Data')
        
        self.qui('source_txt | process_btn;Process and Update', 'upper_vbox')
        self.qui('upper_vbox | result_txt', 'input_split;v')
        self.qui('filePath_input | fileLoad_btn;Load | fileExport_btn;Export', 'fileBtn_layout;hbox')
        self.qui('my_layout | my_table | input_split | entry_form | fileBtn_layout | pet_layout | my_grp', 'main_layout')
        
        cur_table = self.uiList['my_table']
        cur_table.setRowCount(0)
        cur_table.setColumnCount(1)
        cur_table.insertColumn(cur_table.columnCount())
        cur_item = QtWidgets.QTableWidgetItem('ok') #QtWidgets.QPushButton('Cool') #
        cur_table.insertRow(0)
        cur_table.setItem(0,1, cur_item) #setCellWidget(0,0,cur_item)
        cur_table.setHorizontalHeaderLabels(('a','b'))
        '''
        self.qui('source_txt | process_btn;Process and Update', 'upper_vbox')
        self.qui('upper_vbox | result_txt', 'input_split;v')
        self.qui('filePath_input | fileLoad_btn;Load | fileExport_btn;Export', 'fileBtn_layout;hbox')
        self.qui('input_split | fileBtn_layout', 'main_layout')
        '''
        self.memoData['settingUI']=[]
        #------------- end ui creation --------------------
        keep_margin_layout = ['main_layout']
        keep_margin_layout_obj = []
        # add tab layouts
        for each in self.uiList.values():
            if isinstance(each, QtWidgets.QTabWidget):
                for i in range(each.count()):
                    keep_margin_layout_obj.append( each.widget(i).layout() )
        for name, each in self.uiList.items():
            if isinstance(each, QtWidgets.QLayout) and name not in keep_margin_layout and not name.endswith('_grp_layout') and each not in keep_margin_layout_obj:
                each.setContentsMargins(0, 0, 0, 0)
        self.quickInfo('Ready')
        # self.statusBar().hide() 
开发者ID:shiningdesign,项目名称:universal_tool_template.py,代码行数:53,代码来源:universal_tool_template_1116.py

示例8: setupUI

# 需要导入模块: from PySide2 import QtWidgets [as 别名]
# 或者: from PySide2.QtWidgets import QTableWidgetItem [as 别名]
def setupUI(self):
        super(self.__class__,self).setupUI('grid')
        #------------------------------
        # user ui creation part
        #------------------------------
        # + template: qui version since universal tool template v7
        #   - no extra variable name, all text based creation and reference
        
        self.qui('box_btn;Box | sphere_btn;Sphere | ring_btn;Ring', 'my_layout;grid', 'h')
        self.qui('box2_btn;Box2 | sphere2_btn;Sphere2 | ring2_btn;Ring2', 'my_layout', 'h')
        
        self.qui('cat_btn;Cat | dog_btn;Dog | pig_btn;Pig', 'pet_layout;grid', 'v')
        self.qui('cat2_btn;Cat2 | dog2_btn;Dog2 | pig2_btn;Pig2', 'pet_layout', 'v')
        
        self.qui('name_input@Name:;John | email_input@Email:;test@test.com', 'entry_form')
        
        self.qui('user2_btn;User2 | info2_btn;Info2', 'my_grp;vbox,Personal Data')
        
        self.qui('source_txt | process_btn;Process and Update', 'upper_vbox')
        self.qui('upper_vbox | result_txt', 'input_split;v')
        self.qui('filePath_input | fileLoad_btn;Load | fileExport_btn;Export', 'fileBtn_layout;hbox')
        self.qui('my_layout | my_table | input_split | entry_form | fileBtn_layout | pet_layout | my_grp', 'main_layout')
        
        cur_table = self.uiList['my_table']
        cur_table.setRowCount(0)
        cur_table.setColumnCount(1)
        cur_table.insertColumn(cur_table.columnCount())
        cur_item = QtWidgets.QTableWidgetItem('ok') #QtWidgets.QPushButton('Cool') #
        cur_table.insertRow(0)
        cur_table.setItem(0,1, cur_item) #setCellWidget(0,0,cur_item)
        cur_table.setHorizontalHeaderLabels(('a','b'))
        '''
        self.qui('source_txt | process_btn;Process and Update', 'upper_vbox')
        self.qui('upper_vbox | result_txt', 'input_split;v')
        self.qui('filePath_input | fileLoad_btn;Load | fileExport_btn;Export', 'fileBtn_layout;hbox')
        self.qui('input_split | fileBtn_layout', 'main_layout')
        '''
        #------------- end ui creation --------------------
        keep_margin_layout = ['main_layout']
        keep_margin_layout_obj = []
        # add tab layouts
        for each in self.uiList.values():
            if isinstance(each, QtWidgets.QTabWidget):
                for i in range(each.count()):
                    keep_margin_layout_obj.append( each.widget(i).layout() )
        for name, each in self.uiList.items():
            if isinstance(each, QtWidgets.QLayout) and name not in keep_margin_layout and not name.endswith('_grp_layout') and each not in keep_margin_layout_obj:
                each.setContentsMargins(0, 0, 0, 0)
        self.quickInfo('Ready')
        # self.statusBar().hide() 
开发者ID:shiningdesign,项目名称:universal_tool_template.py,代码行数:52,代码来源:universal_tool_template_1020.py

示例9: setupUI

# 需要导入模块: from PySide2 import QtWidgets [as 别名]
# 或者: from PySide2.QtWidgets import QTableWidgetItem [as 别名]
def setupUI(self):
        super(self.__class__,self).setupUI('grid')
        #------------------------------
        # user ui creation part
        #------------------------------
        self.qui('box_btn;Box | sphere_btn;Sphere | ring_btn;Ring', 'my_layout;grid', 'h')
        self.qui('box2_btn;Box2 | sphere2_btn;Sphere2 | ring2_btn;Ring2', 'my_layout', 'h')
        
        self.qui('cat_btn;Cat | dog_btn;Dog | pig_btn;Pig', 'pet_layout;grid', 'v')
        self.qui('cat2_btn;Cat2 | dog2_btn;Dog2 | pig2_btn;Pig2', 'pet_layout', 'v')
        
        self.qui('name_input@Name:;John | email_input@Email:;test@test.com', 'entry_form')
        
        self.qui('user2_btn;User2 | info2_btn;Info2', 'my_grp;vbox;Personal Data')
        
        self.qui('source_txt | process_btn;Process and Update', 'upper_vbox')
        self.qui('upper_vbox | result_txt', 'input_split;v')
        self.qui('filePath_input | fileLoad_btn;Load | fileExport_btn;Export', 'fileBtn_layout;hbox')
        self.qui('test_space;5;5;5;3 | testSpace_btn;Test Space', 'testSpace_layout;hbox')
        self.qui('my_layout | my_table | input_split | entry_form | fileBtn_layout | pet_layout | my_grp | testSpace_layout', 'main_layout')
        
        cur_table = self.uiList['my_table']
        cur_table.setRowCount(0)
        cur_table.setColumnCount(1)
        cur_table.insertColumn(cur_table.columnCount())
        cur_item = QtWidgets.QTableWidgetItem('ok') #QtWidgets.QPushButton('Cool') #
        cur_table.insertRow(0)
        cur_table.setItem(0,1, cur_item) #setCellWidget(0,0,cur_item)
        cur_table.setHorizontalHeaderLabels(('a','b'))
        '''
        self.qui('source_txt | process_btn;Process and Update', 'upper_vbox')
        self.qui('upper_vbox | result_txt', 'input_split;v')
        self.qui('filePath_input | fileLoad_btn;Load | fileExport_btn;Export', 'fileBtn_layout;hbox')
        self.qui('input_split | fileBtn_layout', 'main_layout')
        '''
        self.memoData['settingUI']=[]
        #------------- end ui creation --------------------
        keep_margin_layout = ['main_layout']
        keep_margin_layout_obj = []
        # add tab layouts
        for each in self.uiList.values():
            if isinstance(each, QtWidgets.QTabWidget):
                for i in range(each.count()):
                    keep_margin_layout_obj.append( each.widget(i).layout() )
        for name, each in self.uiList.items():
            if isinstance(each, QtWidgets.QLayout) and name not in keep_margin_layout and not name.endswith('_grp_layout') and each not in keep_margin_layout_obj:
                each.setContentsMargins(0, 0, 0, 0)
        self.quickInfo('Ready')
        # self.statusBar().hide() 
开发者ID:shiningdesign,项目名称:universal_tool_template.py,代码行数:51,代码来源:universal_tool_template_2010.py


注:本文中的PySide2.QtWidgets.QTableWidgetItem方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。