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


Python QtWidgets.QTableWidget方法代码示例

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


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

示例1: _init_datatable

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QTableWidget [as 别名]
def _init_datatable(self):
        template = ElementTree.fromstring("""
          <vframe>
            <hframe>
              <QLineEdit id='filter' name='input_xlarge' placeholder='Filter'/>
              <stretch/><pushbutton text='Refresh' click='refresh_datatable'/>
            </hframe>
            <vframe id='table'/>
          </vframe>""")
        # Build the datatable
        self.datatable_wrap = PKWidget(template, self)
        datatable = QtWidgets.QTableWidget(0, 3, parent=None)
        datatable.setSelectionMode(QtWidgets.QAbstractItemView.SingleSelection)
        datatable.setHorizontalHeaderLabels(['Variable', 'Value', 'Type   '])
        datatable.horizontalHeader().setSectionResizeMode(0, QtWidgets.QHeaderView.Interactive)
        datatable.horizontalHeader().setSectionResizeMode(1, QtWidgets.QHeaderView.Stretch)
        datatable.horizontalHeader().setSectionResizeMode(2, QtWidgets.QHeaderView.ResizeToContents)
        datatable.horizontalHeader().resizeSection(0, 200)
        datatable.verticalHeader().setVisible(False)
        datatable.verticalHeader().setDefaultSectionSize(19)
        datatable.setParent(self.datatable_wrap)
        self.datatable_wrap.manifest.table.layout().addWidget(datatable)
        # Connect the filter input
        self.datatable_wrap.manifest.filter.textChanged.connect(self.filter_datatable)
        return datatable 
开发者ID:pkkid,项目名称:pkmeter,代码行数:27,代码来源:pkconfig.py

示例2: __init__

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QTableWidget [as 别名]
def __init__(self, parent=None):
        super(buttonEditor, self).__init__(parent)
        self.ecurequestsparser = None

        self.layout = None
        self.layouth = widgets.QHBoxLayout()
        self.buttontable = widgets.QTableWidget()
        self.layoutv = widgets.QVBoxLayout()

        self.layouth.addWidget(self.buttontable)
        self.layouth.addLayout(self.layoutv)

        self.buttondata = buttonData()
        self.layoutv.addWidget(self.buttondata)

        self.setLayout(self.layouth)

        self.buttontable.setFixedWidth(250)
        self.buttontable.setColumnCount(2)
        self.buttontable.verticalHeader().hide()
        self.buttontable.setSelectionBehavior(widgets.QAbstractItemView.SelectRows)
        self.buttontable.setSelectionMode(widgets.QAbstractItemView.SingleSelection)
        #self.buttontable.setShowGrid(False)
        self.buttontable.itemSelectionChanged.connect(self.selection_changed)
        self.enable_view(False) 
开发者ID:cedricp,项目名称:ddt4all,代码行数:27,代码来源:dataeditor.py

示例3: createTable

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QTableWidget [as 别名]
def createTable(self):
        # Set up location table
        self.locationTable = QTableWidget(self)
        self.locationTable.setColumnCount(8)
        self.locationTable.setGeometry(10, 10, self.geometry().width()/2-20, self.geometry().height()/2)
        self.locationTable.setShowGrid(True)
        self.locationTable.setHorizontalHeaderLabels(['macAddr','SSID', 'Strength', 'Timestamp','GPS', 'Latitude', 'Longitude', 'Altitude'])
        self.locationTable.resizeColumnsToContents()
        self.locationTable.setRowCount(0)
        self.locationTable.horizontalHeader().setSectionResizeMode(1, QHeaderView.Stretch)
        
        self.ntRightClickMenu = QMenu(self)
        newAct = QAction('Copy', self)        
        newAct.setStatusTip('Copy data to clipboard')
        newAct.triggered.connect(self.onCopy)
        self.ntRightClickMenu.addAction(newAct)
        
        self.locationTable.setContextMenuPolicy(Qt.CustomContextMenu)
        self.locationTable.customContextMenuRequested.connect(self.showNTContextMenu) 
开发者ID:ghostop14,项目名称:sparrow-wifi,代码行数:21,代码来源:telemetry.py

示例4: createGUI

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QTableWidget [as 别名]
def createGUI(self):

        length = len(self.DataSetsHist)
        self.table = QTableWidget(length, 2)
        self.table.setHorizontalHeaderLabels(["Images", "Using for"])
        self.table.verticalHeader().setVisible(True)
        self.table.setSizeAdjustPolicy(QtWidgets.QAbstractScrollArea.AdjustToContents)

        for i in range(length):
            imageItem = QTableWidgetItem(self.DataSetsHist[i])
            selectItem = QtWidgets.QComboBox()
            selectItem.addItems(['Training', 'Validation', 'Test'])
            self.table.setItem(i, 0, imageItem)
            self.table.setCellWidget(i, 1, selectItem)

        self.table.resizeColumnToContents(0)
        self.table.horizontalHeader().setStretchLastSection(False)
        self.table.cellClicked.connect(self.updateRecord)

        self.layout.addWidget(self.table, 0, 0)
        self.setLayout(self.layout)
        self.setGeometry(800, 200, 550, 200)
        self.setWindowTitle("Select Datasets for Training & Test Network")
        self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint) 
开发者ID:thomaskuestner,项目名称:CNNArt,代码行数:26,代码来源:network_interface.py

示例5: scan_finished

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QTableWidget [as 别名]
def scan_finished(self, matches):
        records = [[x.rule, a[0]] for x in matches for a in x.strings]
        self._table.setRowCount(len(records))
        for i in range(0, len(records)):
            # TODO: Proper QTableView / model implementation instead of lazy use of QTableWidget
            desc = QtWidgets.QTableWidgetItem(records[i][0])
            desc.setFlags(Qt.ItemIsEnabled)
            # TODO: meta tooltip
            offset = QtWidgets.QTableWidgetItem('0x%.8x' % records[i][1])
            offset.setFlags(Qt.ItemIsEnabled)
            offset.setForeground(QtGui.QColor(162, 217, 175))
            self._table.setItem(i, 0, offset)
            self._table.setItem(i, 1, desc)

        self._table.cellDoubleClicked.connect(self.cell_action)
        self._thread.terminate()
        self._core.show()
        self._core.selectTab(self)
        self.show() 
开发者ID:NOPDev,项目名称:BinjaDock,代码行数:21,代码来源:yarascan.py

示例6: _setup_table

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QTableWidget [as 别名]
def _setup_table(self, name, columns):
        table = self.findChild(QtWidgets.QTableWidget, name)

        ncols = len(columns)
        table.setColumnCount(ncols)
        table.setHorizontalHeaderLabels(columns)

        header = table.horizontalHeader()       
        header.setVisible(True)

        if 'Connections' in columns:
            for col_idx, _ in enumerate(columns):
                header.setSectionResizeMode(col_idx, \
                        QtWidgets.QHeaderView.Stretch if col_idx == 0 else QtWidgets.QHeaderView.ResizeToContents)

        else:
            for col_idx, _ in enumerate(columns):
                header.setSectionResizeMode(col_idx, QtWidgets.QHeaderView.ResizeToContents)

        return table 
开发者ID:evilsocket,项目名称:opensnitch,代码行数:22,代码来源:stats.py

示例7: create_steps_spreadsheet

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QTableWidget [as 别名]
def create_steps_spreadsheet(self):
        """Creates Recipe Steps table. It does not populate the table in this
        method."""
        recipeStepsTable = QtWidgets.QTableWidget()
        recipeStepsTable.setShowGrid(False)
        recipeStepsTable.setAlternatingRowColors(True)
        recipeStepsTable.setCornerButtonEnabled(False)
        recipeStepsTable.horizontalHeader().setSectionResizeMode(1)
        recipeStepsTable.setSelectionMode(QtWidgets.QAbstractItemView.NoSelection)

        # Steps spreadsheet
        recipeStepsTable.setColumnCount(4)
        recipeStepsTable.setHorizontalHeaderLabels(["Temperature",
            "Fan Speed", "Section Time", "Modify"])

        return recipeStepsTable 
开发者ID:Roastero,项目名称:Openroast,代码行数:18,代码来源:recipeeditorwindow.py

示例8: setupUi

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QTableWidget [as 别名]
def setupUi(self, DialogModulationParameters):
        DialogModulationParameters.setObjectName("DialogModulationParameters")
        DialogModulationParameters.resize(303, 286)
        DialogModulationParameters.setModal(True)
        self.verticalLayout = QtWidgets.QVBoxLayout(DialogModulationParameters)
        self.verticalLayout.setObjectName("verticalLayout")
        self.tblSymbolParameters = QtWidgets.QTableWidget(DialogModulationParameters)
        self.tblSymbolParameters.setShowGrid(False)
        self.tblSymbolParameters.setRowCount(2)
        self.tblSymbolParameters.setObjectName("tblSymbolParameters")
        self.tblSymbolParameters.setColumnCount(2)
        item = QtWidgets.QTableWidgetItem()
        self.tblSymbolParameters.setHorizontalHeaderItem(0, item)
        item = QtWidgets.QTableWidgetItem()
        self.tblSymbolParameters.setHorizontalHeaderItem(1, item)
        self.tblSymbolParameters.horizontalHeader().setVisible(True)
        self.tblSymbolParameters.verticalHeader().setVisible(False)
        self.verticalLayout.addWidget(self.tblSymbolParameters)
        self.buttonBox = QtWidgets.QDialogButtonBox(DialogModulationParameters)
        self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
        self.buttonBox.setObjectName("buttonBox")
        self.verticalLayout.addWidget(self.buttonBox)

        self.retranslateUi(DialogModulationParameters) 
开发者ID:jopohl,项目名称:urh,代码行数:26,代码来源:ui_modulation_parameters_dialog.py

示例9: setupUi

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QTableWidget [as 别名]
def setupUi(self, Dialog_manage_attributes):
        Dialog_manage_attributes.setObjectName("Dialog_manage_attributes")
        Dialog_manage_attributes.resize(546, 569)
        self.gridLayout = QtWidgets.QGridLayout(Dialog_manage_attributes)
        self.gridLayout.setObjectName("gridLayout")
        self.pushButton_add = QtWidgets.QPushButton(Dialog_manage_attributes)
        self.pushButton_add.setObjectName("pushButton_add")
        self.gridLayout.addWidget(self.pushButton_add, 0, 0, 1, 1)
        self.pushButton_delete = QtWidgets.QPushButton(Dialog_manage_attributes)
        self.pushButton_delete.setObjectName("pushButton_delete")
        self.gridLayout.addWidget(self.pushButton_delete, 0, 1, 1, 1)
        self.tableWidget = QtWidgets.QTableWidget(Dialog_manage_attributes)
        self.tableWidget.setObjectName("tableWidget")
        self.tableWidget.setColumnCount(0)
        self.tableWidget.setRowCount(0)
        self.gridLayout.addWidget(self.tableWidget, 1, 0, 1, 2)

        self.retranslateUi(Dialog_manage_attributes)
        QtCore.QMetaObject.connectSlotsByName(Dialog_manage_attributes) 
开发者ID:ccbogel,项目名称:QualCoder,代码行数:21,代码来源:ui_dialog_manage_attributes.py

示例10: createTable

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QTableWidget [as 别名]
def createTable(self):
        table =  QtWidgets.QTableWidget(0,4)
        table.setHorizontalHeaderLabels(("Current", "Position", "Shape", "Name"))
        #table.setColumnWidth(3,1)
        table.setShowGrid(False)
        #table.horizontalHeader().setResizeMode(2, QtWidgets.QHeaderView.Stretch)
        table.verticalHeader().hide()
        table.cellDoubleClicked.connect(self.tableLeftClick)
        return table 
开发者ID:simnibs,项目名称:simnibs,代码行数:11,代码来源:main_gui.py

示例11: setCondTable

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QTableWidget [as 别名]
def setCondTable(self):
        self.condTable = QtWidgets.QTableWidget(0,2)
        self.condTable.setHorizontalHeaderLabels(("Name", "Value")) 
        self.condTable.setShowGrid(False)
        self.condTable.horizontalHeader().setSectionResizeMode(0, QtWidgets.QHeaderView.Stretch)
        self.condTable.verticalHeader().hide()


        self.setRowValues()

    #Sets up each row 
开发者ID:simnibs,项目名称:simnibs,代码行数:13,代码来源:main_gui.py

示例12: setupUi

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QTableWidget [as 别名]
def setupUi(self, Ebeam_Table):
        Ebeam_Table.setObjectName("Ebeam_Table")
        Ebeam_Table.resize(700, 500)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(Ebeam_Table.sizePolicy().hasHeightForWidth())
        Ebeam_Table.setSizePolicy(sizePolicy)
        self.gridLayout_2 = QtWidgets.QGridLayout(Ebeam_Table)
        self.gridLayout_2.setObjectName("gridLayout_2")
        self.table = QtWidgets.QTableWidget(Ebeam_Table)
        self.table.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates))
        self.table.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers)
        self.table.setRowCount(0)
        self.table.setColumnCount(2)
        self.table.setObjectName("table")
        item = QtWidgets.QTableWidgetItem()
        item.setTextAlignment(QtCore.Qt.AlignCenter)
        self.table.setHorizontalHeaderItem(0, item)
        item = QtWidgets.QTableWidgetItem()
        item.setTextAlignment(QtCore.Qt.AlignCenter)
        self.table.setHorizontalHeaderItem(1, item)
        self.table.verticalHeader().setVisible(False)
        self.gridLayout_2.addWidget(self.table, 0, 1, 1, 1)

        self.retranslateUi(Ebeam_Table)
        QtCore.QMetaObject.connectSlotsByName(Ebeam_Table) 
开发者ID:ocelot-collab,项目名称:ocelot,代码行数:29,代码来源:ebeam_table_ui.py

示例13: setupUi

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QTableWidget [as 别名]
def setupUi(self, WMachineTable):
        WMachineTable.setObjectName("WMachineTable")
        WMachineTable.resize(290, 357)
        WMachineTable.setMinimumSize(QtCore.QSize(290, 0))
        WMachineTable.setMaximumSize(QtCore.QSize(282, 16777215))
        self.verticalLayout = QtWidgets.QVBoxLayout(WMachineTable)
        self.verticalLayout.setObjectName("verticalLayout")
        self.in_name = QtWidgets.QLabel(WMachineTable)
        self.in_name.setAlignment(QtCore.Qt.AlignCenter)
        self.in_name.setObjectName("in_name")
        self.verticalLayout.addWidget(self.in_name)
        self.tab_param = QtWidgets.QTableWidget(WMachineTable)
        self.tab_param.setMinimumSize(QtCore.QSize(270, 0))
        self.tab_param.setMaximumSize(QtCore.QSize(260, 16777215))
        self.tab_param.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded)
        self.tab_param.setSizeAdjustPolicy(
            QtWidgets.QAbstractScrollArea.AdjustToContents
        )
        self.tab_param.setAlternatingRowColors(True)
        self.tab_param.setColumnCount(2)
        self.tab_param.setObjectName("tab_param")
        self.tab_param.setRowCount(0)
        item = QtWidgets.QTableWidgetItem()
        self.tab_param.setHorizontalHeaderItem(0, item)
        item = QtWidgets.QTableWidgetItem()
        self.tab_param.setHorizontalHeaderItem(1, item)
        self.tab_param.horizontalHeader().setCascadingSectionResizes(False)
        self.tab_param.horizontalHeader().setStretchLastSection(True)
        self.tab_param.verticalHeader().setVisible(False)
        self.tab_param.verticalHeader().setCascadingSectionResizes(False)
        self.verticalLayout.addWidget(self.tab_param)
        self.b_mmf = QtWidgets.QPushButton(WMachineTable)
        self.b_mmf.setObjectName("b_mmf")
        self.verticalLayout.addWidget(self.b_mmf)

        self.retranslateUi(WMachineTable)
        QtCore.QMetaObject.connectSlotsByName(WMachineTable) 
开发者ID:Eomys,项目名称:pyleecan,代码行数:39,代码来源:Ui_WMachineTable.py

示例14: __init__

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QTableWidget [as 别名]
def __init__(self, parent=None):
        super(sniffer, self).__init__(parent)
        self.ecu_file = None
        self.ecurequests = None
        self.snifferthread = None
        self.currentrequest = None
        self.names = []
        self.oktostart = False
        self.ecu_filter = ""

        hlayout = widgets.QHBoxLayout()

        self.framecombo = widgets.QComboBox()

        self.startbutton = widgets.QPushButton(">>")
        self.addressinfo = widgets.QLabel("0000")

        self.startbutton.setCheckable(True)
        self.startbutton.toggled.connect(self.startmonitoring)

        self.addressinfo.setFixedWidth(90)
        self.startbutton.setFixedWidth(90)

        hlayout.addWidget(self.addressinfo)
        hlayout.addWidget(self.framecombo)
        hlayout.addWidget(self.startbutton)

        vlayout = widgets.QVBoxLayout()
        self.setLayout(vlayout)

        vlayout.addLayout(hlayout)

        self.table = widgets.QTableWidget()
        vlayout.addWidget(self.table)

        self.framecombo.activated.connect(self.change_frame) 
开发者ID:cedricp,项目名称:ddt4all,代码行数:38,代码来源:sniffer.py

示例15: create_snapshot

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QTableWidget [as 别名]
def create_snapshot(self):
        self.snapshotCheckBox = QtWidgets.QCheckBox("Show snapshot")
        self.snapshotCheckBox.toggled.connect(self.toggle_snapshot)
        self.layout.addWidget(self.snapshotCheckBox)

        self.snapshot = QtWidgets.QTableWidget()
        self.snapshot.verticalHeader().setSectionResizeMode(QtWidgets.QHeaderView.Fixed)
        self.snapshot.horizontalHeader().setSectionResizeMode(
            QtWidgets.QHeaderView.Interactive
        )
        self.snapshot.horizontalHeader().setCascadingSectionResizes(True)
        self.layout.addWidget(self.snapshot) 
开发者ID:ScriptSmith,项目名称:reaper,代码行数:14,代码来源:progress.py


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