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


Python QHeaderView.Stretch方法代码示例

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


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

示例1: addProduct

# 需要导入模块: from PyQt5.QtWidgets import QHeaderView [as 别名]
# 或者: from PyQt5.QtWidgets.QHeaderView import Stretch [as 别名]
def addProduct(self):
        name = self.nameLinEdit.text()
        price = self.priceLineEdit.text()
        stars = self.starsLineEdit.text()

        try:
            p = Product(name=name, price=price, star=stars)
            p.save()
        except Exception as e:
            print(e)

        if self.connection:
            query = QSqlQuery(str(Product.objects.all().values('name', 'price', 'star').query), self.db)
            self.tableModel.setQuery(query)
            self.tableView.setModel(self.tableModel)
            self.tableView.hide()
            self.tableModel.setHeaderData(0, QtCore.Qt.Horizontal, "Name")
            self.tableModel.setHeaderData(1, QtCore.Qt.Horizontal, "Price")
            self.tableModel.setHeaderData(2, QtCore.Qt.Horizontal, "Starred")
            for i in range(self.tableView.horizontalHeader().count()):
                self.tableView.horizontalHeader().setSectionResizeMode(i, QHeaderView.Stretch)
            self.tableView.show() 
开发者ID:ZedObaia,项目名称:django-pyqt,代码行数:24,代码来源:mainWindowManager.py

示例2: init_logs

# 需要导入模块: from PyQt5.QtWidgets import QHeaderView [as 别名]
# 或者: from PyQt5.QtWidgets.QHeaderView import Stretch [as 别名]
def init_logs(self):
        self.logTableWidget.setAlternatingRowColors(True)
        header = self.logTableWidget.horizontalHeader()
        header.setVisible(True)
        [header.setSectionResizeMode(i, QHeaderView.ResizeToContents) for i in range(5)]
        header.setSectionResizeMode(3, QHeaderView.Stretch)

        self.logTableWidget.setSelectionBehavior(QTableView.SelectRows)
        self.logTableWidget.setEditTriggers(QTableView.NoEditTriggers)

        event_logs = [s for s in EventLogModel.select().order_by(EventLogModel.start_time.desc())]

        for row, log_line in enumerate(event_logs):
            self.logTableWidget.insertRow(row)
            formatted_time = log_line.start_time.strftime('%Y-%m-%d %H:%M')
            self.logTableWidget.setItem(row, 0, QTableWidgetItem(formatted_time))
            self.logTableWidget.setItem(row, 1, QTableWidgetItem(log_line.category))
            self.logTableWidget.setItem(row, 2, QTableWidgetItem(log_line.subcommand))
            self.logTableWidget.setItem(row, 3, QTableWidgetItem(log_line.repo_url))
            self.logTableWidget.setItem(row, 4, QTableWidgetItem(str(log_line.returncode)))
        self.logTableWidget.setRowCount(len(event_logs))
        self._draw_next_scheduled_backup() 
开发者ID:borgbase,项目名称:vorta,代码行数:24,代码来源:schedule_tab.py

示例3: __init__

# 需要导入模块: from PyQt5.QtWidgets import QHeaderView [as 别名]
# 或者: from PyQt5.QtWidgets.QHeaderView import Stretch [as 别名]
def __init__(self, fs_data, archive_newer, archive_older):
        super().__init__()
        self.setupUi(self)

        files_with_attributes, nested_file_list = parse_diff_lines(fs_data.split('\n'))
        model = DiffTree(files_with_attributes, nested_file_list)

        view = self.treeView
        view.setAlternatingRowColors(True)
        view.setUniformRowHeights(True)  # Allows for scrolling optimizations.
        view.setModel(model)
        header = view.header()
        header.setStretchLastSection(False)
        header.setSectionResizeMode(1, QHeaderView.ResizeToContents)
        header.setSectionResizeMode(2, QHeaderView.ResizeToContents)
        header.setSectionResizeMode(0, QHeaderView.Stretch)

        self.archiveNameLabel_1.setText(f'{archive_newer.name}')
        self.archiveNameLabel_2.setText(f'{archive_older.name}')
        self.okButton.clicked.connect(self.accept) 
开发者ID:borgbase,项目名称:vorta,代码行数:22,代码来源:diff_result.py

示例4: onAgentAnnounce

# 需要导入模块: from PyQt5.QtWidgets import QHeaderView [as 别名]
# 或者: from PyQt5.QtWidgets.QHeaderView import Stretch [as 别名]
def onAgentAnnounce(self, ipAddr, port):
        if not self.agentInTable(ipAddr, port):
            rowPosition = self.agentTable.rowCount()
            rowPosition -= 1
            addedFirstRow = False
            if rowPosition < 0:
                addedFirstRow = True
                rowPosition = 0
                
            self.agentTable.insertRow(rowPosition)
            
            # Just make sure we don't get an extra blank row
            if (addedFirstRow):
                self.agentTable.setRowCount(1)

            self.agentTable.setItem(rowPosition, 0, QTableWidgetItem(ipAddr))
            self.agentTable.setItem(rowPosition, 1, IntTableWidgetItem(str(port)))
            self.agentTable.resizeColumnsToContents()
            self.agentTable.horizontalHeader().setSectionResizeMode(0, QHeaderView.Stretch) 
开发者ID:ghostop14,项目名称:sparrow-wifi,代码行数:21,代码来源:sparrowdialogs.py

示例5: createTable

# 需要导入模块: from PyQt5.QtWidgets import QHeaderView [as 别名]
# 或者: from PyQt5.QtWidgets.QHeaderView import Stretch [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

示例6: __init__

# 需要导入模块: from PyQt5.QtWidgets import QHeaderView [as 别名]
# 或者: from PyQt5.QtWidgets.QHeaderView import Stretch [as 别名]
def __init__(self, checksum_label: ChecksumLabel, message: Message, proto_view: int, parent=None):
        super().__init__(parent)
        self.ui = Ui_ChecksumOptions()
        self.ui.setupUi(self)
        self.checksum_label = checksum_label
        self.data_range_table_model = self.RangeTableModel(checksum_label, message, proto_view, parent=self)
        self.ui.tableViewDataRanges.setItemDelegateForColumn(0, SpinBoxDelegate(1, 999999, self))
        self.ui.tableViewDataRanges.setItemDelegateForColumn(1, SpinBoxDelegate(1, 999999, self))
        self.ui.tableViewDataRanges.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)
        self.ui.tableViewDataRanges.setModel(self.data_range_table_model)
        self.ui.tableViewDataRanges.setEditTriggers(QAbstractItemView.AllEditTriggers)
        self.display_crc_data_ranges_in_table()
        self.ui.comboBoxCRCFunction.addItems([crc_name for crc_name in GenericCRC.DEFAULT_POLYNOMIALS])
        self.ui.comboBoxCRCFunction.addItems([special_crc_name for special_crc_name in self.SPECIAL_CRCS])
        self.ui.lineEditCRCPolynomial.setValidator(QRegExpValidator(QRegExp("[0-9,a-f]*")))
        self.ui.comboBoxCategory.clear()
        for _, member in self.checksum_label.Category.__members__.items():
            self.ui.comboBoxCategory.addItem(member.value)
        self.set_ui_for_category()
        self.setFocus()
        self.create_connects() 
开发者ID:jopohl,项目名称:urh,代码行数:23,代码来源:ChecksumWidget.py

示例7: onToggleCollateral

# 需要导入模块: from PyQt5.QtWidgets import QHeaderView [as 别名]
# 或者: from PyQt5.QtWidgets.QHeaderView import Stretch [as 别名]
def onToggleCollateral(self):
        if self.ui.rewardsList.box.collateralRow is not None:
            if not self.ui.collateralHidden:
                try:
                    # If collateral row was selected, deselect it before hiding
                    if self.ui.rewardsList.box.item(self.ui.rewardsList.box.collateralRow, 0).isSelected():
                        self.ui.rewardsList.box.selectRow(self.ui.rewardsList.box.collateralRow)
                except Exception as e:
                    err_msg = "Error toggling collateral"
                    printException(getCallerName(), getFunctionName(), err_msg, e.args)

                self.ui.rewardsList.box.hideRow(self.ui.rewardsList.box.collateralRow)
                self.ui.btn_toggleCollateral.setText("Show Collateral")
                self.ui.collateralHidden = True
                self.updateSelection()
            else:
                self.ui.rewardsList.box.showRow(self.ui.rewardsList.box.collateralRow)
                self.ui.btn_toggleCollateral.setText("Hide Collateral")
                self.ui.collateralHidden = False
                self.updateSelection()
                self.ui.rewardsList.box.resizeColumnsToContents()
                self.ui.rewardsList.box.horizontalHeader().setSectionResizeMode(2, QHeaderView.Stretch)

        else:
            myPopUp_sb(self.caller, "warn", 'No Collateral', "No collateral selected") 
开发者ID:PIVX-Project,项目名称:PIVX-SPMT,代码行数:27,代码来源:tabRewards.py

示例8: setupGrainTable

# 需要导入模块: from PyQt5.QtWidgets import QHeaderView [as 别名]
# 或者: from PyQt5.QtWidgets.QHeaderView import Stretch [as 别名]
def setupGrainTable(self):
        self.ui.tableWidgetGrainList.clearContents()

        header = self.ui.tableWidgetGrainList.horizontalHeader()
        header.setSectionResizeMode(0, QHeaderView.ResizeToContents)
        header.setSectionResizeMode(1, QHeaderView.Stretch)

        self.updateGrainTable()

        self.ui.pushButtonMoveGrainUp.pressed.connect(lambda: self.moveGrain(-1))
        self.ui.pushButtonMoveGrainDown.pressed.connect(lambda: self.moveGrain(1))
        self.ui.pushButtonDeleteGrain.pressed.connect(self.deleteGrain)
        self.ui.pushButtonCopyGrain.pressed.connect(self.copyGrain)

        self.ui.tableWidgetGrainList.itemSelectionChanged.connect(self.checkGrainSelection)
        self.checkGrainSelection()
        
        self.ui.tableWidgetGrainList.doubleClicked.connect(self.doubleClickGrainSelector) 
开发者ID:reilleya,项目名称:openMotor,代码行数:20,代码来源:mainWindow.py

示例9: __init__

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

        header = self.archiveTable.horizontalHeader()
        header.setVisible(True)
        header.setSectionResizeMode(0, QHeaderView.ResizeToContents)
        header.setSectionResizeMode(1, QHeaderView.ResizeToContents)
        header.setSectionResizeMode(2, QHeaderView.ResizeToContents)
        header.setSectionResizeMode(3, QHeaderView.Stretch)
        header.setStretchLastSection(True)

        if sys.platform != "darwin":
            self._set_status("")  # Set platform-specific hints.

        self.archiveTable.setSelectionBehavior(QTableView.SelectRows)
        self.archiveTable.setEditTriggers(QTableView.NoEditTriggers)
        self.archiveTable.setAlternatingRowColors(True)

        # Populate pruning options from database
        for i in self.prune_intervals:
            getattr(self, f"prune_{i}").setValue(getattr(self.profile(), f"prune_{i}"))
            getattr(self, f"prune_{i}").valueChanged.connect(self.save_prune_setting)

        self.mountButton.clicked.connect(self.mount_action)
        self.listButton.clicked.connect(self.list_action)
        self.pruneButton.clicked.connect(self.prune_action)
        self.checkButton.clicked.connect(self.check_action)
        self.extractButton.clicked.connect(self.extract_action)

        self.populate_from_profile() 
开发者ID:Mebus,项目名称:restatic,代码行数:34,代码来源:archive_tab.py

示例10: __init__

# 需要导入模块: from PyQt5.QtWidgets import QHeaderView [as 别名]
# 或者: from PyQt5.QtWidgets.QHeaderView import Stretch [as 别名]
def __init__(self, cue_model, parent=None):
        """
        :type cue_model: lisp.layouts.list_layout.cue_list_model.CueListModel
        """
        super().__init__(parent)
        self._model = cue_model
        self._model.item_added.connect(self.__cue_added, Connection.QtQueued)
        self._model.item_moved.connect(self.__cue_moved, Connection.QtQueued)
        self._model.item_removed.connect(self.__cue_removed, Connection.QtQueued)
        self._model.model_reset.connect(self.__model_reset)
        self.__item_moving = False

        self.setHeaderLabels(
            [translate('ListLayoutHeader', h) for h in CueListView.HEADER_NAMES])
        self.header().setDragEnabled(False)
        self.header().setStretchLastSection(False)
        self.header().setSectionResizeMode(QHeaderView.Fixed)
        self.header().setSectionResizeMode(1, QHeaderView.ResizeToContents)
        self.header().setSectionResizeMode(2, QHeaderView.Stretch)

        self.setColumnWidth(0, 40)
        self.setColumnWidth(len(CueListView.HEADER_NAMES) - 1, 18)
        self.setSelectionMode(self.SingleSelection)
        self.setDragDropMode(self.InternalMove)
        self.setAlternatingRowColors(True)
        self.setVerticalScrollMode(self.ScrollPerItem)

        self.setIndentation(0)

        self.currentItemChanged.connect(self.__current_changed)

        self.__guard = False
        self.verticalScrollBar().rangeChanged.connect(self.__update_range) 
开发者ID:FrancescoCeruti,项目名称:linux-show-player,代码行数:35,代码来源:cue_list_view.py

示例11: __init__

# 需要导入模块: from PyQt5.QtWidgets import QHeaderView [as 别名]
# 或者: from PyQt5.QtWidgets.QHeaderView import Stretch [as 别名]
def __init__(self, fs_data, archive):
        super().__init__()
        self.setupUi(self)

        files_with_attributes = []
        nested_file_list = nested_dict()
        self.selected = set()

        def parse_line(line):
            size, modified, full_path = line.split("\t")
            size = int(size)
            dir, name = os.path.split(full_path)

            # add to nested dict of folders to find nested dirs.
            d = get_dict_from_list(nested_file_list, dir.split("/"))
            if name not in d:
                d[name] = {}

            return size, modified, name, dir

        for line in fs_data.split("\n"):
            try:
                files_with_attributes.append(parse_line(line))
            except ValueError:
                pass

        model = ExtractTree(files_with_attributes, nested_file_list, self.selected)

        view = self.treeView
        view.setAlternatingRowColors(True)
        view.setUniformRowHeights(True)  # Allows for scrolling optimizations.
        view.setModel(model)
        header = view.header()
        header.setStretchLastSection(False)
        header.setSectionResizeMode(1, QHeaderView.ResizeToContents)
        header.setSectionResizeMode(2, QHeaderView.ResizeToContents)
        header.setSectionResizeMode(0, QHeaderView.Stretch)

        self.archiveNameLabel.setText(f"{archive.name}, {archive.time}")
        self.cancelButton.clicked.connect(self.close)
        self.extractButton.clicked.connect(self.accept) 
开发者ID:borgbase,项目名称:vorta,代码行数:43,代码来源:extract_dialog.py

示例12: __init__

# 需要导入模块: from PyQt5.QtWidgets import QHeaderView [as 别名]
# 或者: from PyQt5.QtWidgets.QHeaderView import Stretch [as 别名]
def __init__(self, archiveTable):
        super().__init__()
        self.setupUi(self)

        header = self.archiveTable.horizontalHeader()
        header.setVisible(True)
        header.setSectionResizeMode(0, QHeaderView.ResizeToContents)
        header.setSectionResizeMode(1, QHeaderView.ResizeToContents)
        header.setSectionResizeMode(2, QHeaderView.ResizeToContents)
        header.setSectionResizeMode(3, QHeaderView.Interactive)
        header.setSectionResizeMode(4, QHeaderView.Stretch)
        header.setStretchLastSection(True)

        self.archiveTable.setSelectionBehavior(QTableView.SelectRows)
        self.archiveTable.setSelectionMode(QTableView.MultiSelection)
        self.archiveTable.setEditTriggers(QTableView.NoEditTriggers)
        self.archiveTable.setWordWrap(False)
        self.archiveTable.setTextElideMode(QtCore.Qt.ElideLeft)
        self.archiveTable.setAlternatingRowColors(True)
        self.archiveTable.itemSelectionChanged.connect(self.itemSelectionChanged_action)

        # Copy archiveTable of MainWindow
        self.archiveTable.setRowCount(archiveTable.rowCount())
        for row in range(archiveTable.rowCount()):
            for column in range(archiveTable.columnCount()):
                try:
                    text = archiveTable.item(row, column).text()
                    self.archiveTable.setItem(row, column, QTableWidgetItem(text))
                except AttributeError:
                    self.archiveTable.setItem(row, column, QTableWidgetItem(""))

        self.diffButton.setEnabled(False)

        self.cancelButton.clicked.connect(self.close)
        self.diffButton.clicked.connect(self.diff_action)
        self.selected_archives = None 
开发者ID:borgbase,项目名称:vorta,代码行数:38,代码来源:diff_dialog.py

示例13: __init__

# 需要导入模块: from PyQt5.QtWidgets import QHeaderView [as 别名]
# 或者: from PyQt5.QtWidgets.QHeaderView import Stretch [as 别名]
def __init__(self, *args, **kwargs):
        QTableWidget.__init__(self, *args, **kwargs)
        self.tags = set()

        # Set up table
        self.setColumnCount(1)
        self.horizontalHeader().hide()
        self.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)
        self.verticalHeader().hide()
        self.verticalHeader().setSectionResizeMode(QHeaderView.ResizeToContents)
        self.setEditTriggers(QAbstractItemView.NoEditTriggers) 
开发者ID:roglew,项目名称:guppy-proxy,代码行数:13,代码来源:reqview.py

示例14: __init__

# 需要导入模块: from PyQt5.QtWidgets import QHeaderView [as 别名]
# 或者: from PyQt5.QtWidgets.QHeaderView import Stretch [as 别名]
def __init__(self, *args, **kwargs):
        QTableWidget.__init__(self, *args, **kwargs)
        self.listeners = []

        # Set up table
        self.setColumnCount(1)
        self.horizontalHeader().hide()
        self.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)
        self.verticalHeader().hide()
        self.verticalHeader().setSectionResizeMode(QHeaderView.ResizeToContents)
        self.setEditTriggers(QAbstractItemView.NoEditTriggers) 
开发者ID:roglew,项目名称:guppy-proxy,代码行数:13,代码来源:settings.py

示例15: __init__

# 需要导入模块: from PyQt5.QtWidgets import QHeaderView [as 别名]
# 或者: from PyQt5.QtWidgets.QHeaderView import Stretch [as 别名]
def __init__(self, *args, **kwargs):
        self.client = kwargs.pop("client")
        QTableWidget.__init__(self, *args, **kwargs)
        self.context = RequestContext(self.client)

        # Set up table
        self.setColumnCount(1)
        self.horizontalHeader().hide()
        self.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)
        self.verticalHeader().hide()
        self.verticalHeader().setSectionResizeMode(QHeaderView.ResizeToContents)
        #self.setSelectionMode(QAbstractItemView.NoSelection)
        #self.setEditTriggers(QAbstractItemView.NoEditTriggers) 
开发者ID:roglew,项目名称:guppy-proxy,代码行数:15,代码来源:reqlist.py


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