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


Python Qt.AlignCenter方法代码示例

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


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

示例1: set_status

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AlignCenter [as 别名]
def set_status(self, raw, exist=None):
        item = QLabel()
        item.setAlignment(Qt.AlignCenter)

        if exist is 0:
            icon = QPixmap(QUEUE_ICON).scaled(20, 20, Qt.KeepAspectRatio,
                                              Qt.SmoothTransformation)
            item.setPixmap(icon)
            item.setToolTip('Waiting in the download queue...')

        if exist is 1:
            icon = QPixmap(CHECK_ICON).scaled(20, 20, Qt.KeepAspectRatio,
                                              Qt.SmoothTransformation)
            item.setPixmap(icon)
            item.setToolTip('All the features are downloaded...')

        if exist is 2:
            item = QPushButton(self)
            item.setToolTip('Download')
            item.setIcon(QIcon(DOWNLOAD_ICON))
            item.clicked.connect(self.download_clicked)

        self.setCellWidget(raw, 0, item) 
开发者ID:MTG,项目名称:dunya-desktop,代码行数:25,代码来源:table.py

示例2: __init__

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AlignCenter [as 别名]
def __init__(self, parent):
        QDialog.__init__(self, parent=parent)
        self.setMinimumSize(QSize(1200, 600))
        layout = QVBoxLayout(self)

        self.label_collection = QLabel()
        self.label_collection.setAlignment(Qt.AlignCenter)
        layout.addWidget(self.label_collection)

        self.lineedit_filter = QLineEdit(self)
        layout.addWidget(self.lineedit_filter)

        self.coll_table = TableViewCollections(self)
        layout.addWidget(self.coll_table)

        self.model = CollectionTableModel()

        self.proxy_model = SortFilterProxyModel()
        self.proxy_model.setSourceModel(self.model)
        self.proxy_model.setFilterKeyColumn(-1)

        self.coll_table.setModel(self.proxy_model)

        # signals
        self.lineedit_filter.textChanged.connect(self._lineedit_changed) 
开发者ID:MTG,项目名称:dunya-desktop,代码行数:27,代码来源:table.py

示例3: update_table

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AlignCenter [as 别名]
def update_table(self):

        ebp = self.calc_ebparams()

        if ebp is None:
            self.ui.table.setRowCount(1)
            self.ui.table.setSpan(0, 0, 1, 2)

            item = QtWidgets.QTableWidgetItem("No solution")
            item.setTextAlignment(Qt.AlignCenter)
            self.ui.table.setItem(0, 0, item)

            return

        n = len(ebp) 
        self.ui.table.setRowCount(n)
        self.ui.table.clearSpans()
        
        for i in range(n):
            item = QtWidgets.QTableWidgetItem(ebp[i][0])
            self.ui.table.setItem(i, 0, item)

            item = QtWidgets.QTableWidgetItem(str(ebp[i][1]))
            item.setTextAlignment(Qt.AlignCenter)
            self.ui.table.setItem(i, 1, item) 
开发者ID:ocelot-collab,项目名称:ocelot,代码行数:27,代码来源:ebeam_table.py

示例4: data

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AlignCenter [as 别名]
def data(self, index, role = Qt.DisplayRole):
        if not index.isValid():
            return None
        obj = self.getObject(index)
        prop = self.getProperty(index)
        if role == Qt.BackgroundRole:
            return color(obj.D)
        if role == Qt.TextAlignmentRole:
            return Qt.AlignCenter
        if (obj is None) or (prop is None):
            return None
        try:
            if role in [Qt.DisplayRole, Qt.EditRole]:
                return getAttrRecursive(obj, prop['attr'])
        except:
            return None
        return None 
开发者ID:aseylys,项目名称:KStock,代码行数:19,代码来源:ObjList.py

示例5: updateTable

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AlignCenter [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]) 
开发者ID:taseikyo,项目名称:PyQt5-Apps,代码行数:21,代码来源:main.py

示例6: __init__

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AlignCenter [as 别名]
def __init__(self, **kwargs):
        super().__init__(**kwargs)
        self.setLayout(QVBoxLayout())
        self.layout().setAlignment(Qt.AlignTop)

        self.panBox = QGroupBox(self)
        self.panBox.setGeometry(0, 0, self.width(), 80)
        self.panBox.setLayout(QHBoxLayout(self.panBox))
        self.layout().addWidget(self.panBox)

        self.panSlider = QSlider(self.panBox)
        self.panSlider.setRange(-10, 10)
        self.panSlider.setPageStep(1)
        self.panSlider.setOrientation(Qt.Horizontal)
        self.panSlider.valueChanged.connect(self.pan_changed)
        self.panBox.layout().addWidget(self.panSlider)

        self.panLabel = QLabel(self.panBox)
        self.panLabel.setAlignment(Qt.AlignCenter)
        self.panBox.layout().addWidget(self.panLabel)

        self.panBox.layout().setStretch(0, 5)
        self.panBox.layout().setStretch(1, 1)

        self.retransaleUi() 
开发者ID:FrancescoCeruti,项目名称:linux-show-player,代码行数:27,代码来源:audio_pan.py

示例7: __init__

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AlignCenter [as 别名]
def __init__(self, cue):
        super().__init__()

        self.cue = cue
        self.num_column = 1
        self.name_column = 2

        self._selected = False

        self.cue.changed('name').connect(
            self._update_name, Connection.QtQueued)
        self.cue.changed('index').connect(
            self._update_index, Connection.QtQueued)

        self._update_name(self.cue.name)
        self._update_index(self.cue.index)

        self.setTextAlignment(self.num_column, Qt.AlignCenter) 
开发者ID:FrancescoCeruti,项目名称:linux-show-player,代码行数:20,代码来源:cue_list_item.py

示例8: __init__

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AlignCenter [as 别名]
def __init__(self, *args, mode=FadeComboBox.Mode.FadeOut, **kwargs):
        super().__init__(*args, **kwargs)
        self.setLayout(QGridLayout())

        self.fadeDurationSpin = QDoubleSpinBox(self)
        self.fadeDurationSpin.setRange(0, 3600)
        self.layout().addWidget(self.fadeDurationSpin, 0, 0)

        self.fadeDurationLabel = QLabel(self)
        self.fadeDurationLabel.setAlignment(Qt.AlignCenter)
        self.layout().addWidget(self.fadeDurationLabel, 0, 1)

        self.fadeTypeCombo = FadeComboBox(self, mode=mode)
        self.layout().addWidget(self.fadeTypeCombo, 1, 0)

        self.fadeTypeLabel = QLabel(self)
        self.fadeTypeLabel.setAlignment(Qt.AlignCenter)
        self.layout().addWidget(self.fadeTypeLabel, 1, 1)

        self.retranslateUi() 
开发者ID:FrancescoCeruti,项目名称:linux-show-player,代码行数:22,代码来源:fade_edit.py

示例9: __init__

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AlignCenter [as 别名]
def __init__(self, parent, slider: VideoSlider):
        super(VideoSliderWidget, self).__init__(parent)
        self.parent = parent
        self.slider = slider
        self.loaderEffect = OpacityEffect()
        self.loaderEffect.setEnabled(False)
        self.setGraphicsEffect(self.loaderEffect)
        self.setContentsMargins(0, 0, 0, 0)
        self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
        self.layout().setStackingMode(QStackedLayout.StackAll)
        self.genlabel = QLabel(self.parent)
        self.genlabel.setContentsMargins(0, 0, 0, 14)
        self.genlabel.setPixmap(QPixmap(':/images/generating-thumbs.png'))
        self.genlabel.setAlignment(Qt.AlignCenter)
        self.genlabel.hide()
        sliderLayout = QGridLayout()
        sliderLayout.setContentsMargins(0, 0, 0, 0)
        sliderLayout.setSpacing(0)
        sliderLayout.addWidget(self.slider, 0, 0)
        sliderLayout.addWidget(self.genlabel, 0, 0)
        sliderWidget = QWidget(self.parent)
        sliderWidget.setLayout(sliderLayout)
        self.addWidget(sliderWidget) 
开发者ID:ozmartian,项目名称:vidcutter,代码行数:25,代码来源:videosliderwidget.py

示例10: __init__

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AlignCenter [as 别名]
def __init__(
        self,
        jobs_ctx,
        workspace_fs,
        path,
        reload_timestamped_signal,
        update_version_list,
        close_version_list,
    ):
        super().__init__()
        self.setupUi(self)
        self.jobs_ctx = jobs_ctx
        update_version_list.connect(self.reset_dialog)
        self.get_versions_success.connect(self.on_get_version_success)
        self.get_versions_error.connect(self.on_get_version_error)
        self.button_load_more_entries.clicked.connect(self.load_more)
        self.workspace_fs = workspace_fs
        self.version_lister = workspace_fs.get_version_lister()
        self.spinner = QSvgWidget(":/icons/images/icons/spinner.svg")
        self.spinner.setFixedSize(100, 100)
        self.spinner_layout.addWidget(self.spinner, Qt.AlignCenter)
        self.spinner_layout.setAlignment(Qt.AlignCenter)
        self.set_loading_in_progress(False)
        self.reset_dialog(workspace_fs, self.version_lister, path) 
开发者ID:Scille,项目名称:parsec-cloud,代码行数:26,代码来源:file_history_widget.py

示例11: paint

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AlignCenter [as 别名]
def paint(self, painter, rect, mode, state):
        painter.save()
        self.font.setPixelSize(round(0.875 * min(rect.width(), rect.height())))
        painter.setFont(self.font)
        if self.icon:
            if self.icon.animation:
                self.icon.animation.paint(painter, rect)
            ms = self.icon._getMode(mode) * self.icon._getState(state)
            text, color = self.icon.icons.get(ms, (None, None))
            if text == None and color == None:
                return
            painter.setPen(color)
            self.text = text if text else self.text
            painter.drawText(
                rect, int(Qt.AlignCenter | Qt.AlignVCenter), self.text)
        painter.restore() 
开发者ID:PyQt5,项目名称:CustomWidgets,代码行数:18,代码来源:CFontIcon.py

示例12: test

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AlignCenter [as 别名]
def test():
    import sys
    import cgitb
    sys.excepthook = cgitb.enable(1, None, 5, '')
    from PyQt5.QtWidgets import QApplication, QLabel
    app = QApplication(sys.argv)

    def getColor():
        ret, color = CColorPicker.getColor()
        if ret == QDialog.Accepted:
            r, g, b, a = color.red(), color.green(), color.blue(), color.alpha()
            label.setText('color: rgba(%d, %d, %d, %d)' % (r, g, b, a))
            label.setStyleSheet(
                'background: rgba(%d, %d, %d, %d);' % (r, g, b, a))

    window = QWidget()
    window.resize(200, 200)
    layout = QVBoxLayout(window)
    label = QLabel('', window, alignment=Qt.AlignCenter)
    button = QPushButton('点击选择颜色', window, clicked=getColor)
    layout.addWidget(label)
    layout.addWidget(button)
    window.show()

    sys.exit(app.exec_()) 
开发者ID:PyQt5,项目名称:CustomWidgets,代码行数:27,代码来源:CColorPicker.py

示例13: __init__

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AlignCenter [as 别名]
def __init__(self, totalPages, *args, **kwargs):
        super(_CPaginationJumpBar, self).__init__(*args, **kwargs)
        self.setAttribute(Qt.WA_StyledBackground, True)
        layout = QHBoxLayout(self)
        layout.setSpacing(4)
        layout.setContentsMargins(0, 0, 0, 0)
        layout.addWidget(QLabel('前往', self, alignment=Qt.AlignCenter))
        self.editPage = QSpinBox(self)
        layout.addWidget(self.editPage)
        layout.addWidget(QLabel('页', self, alignment=Qt.AlignCenter))

        self.setTotalPages(totalPages)
        self.editPage.setObjectName('CPaginationBar_editJump')
        self.editPage.setFrame(False)
        self.editPage.setAlignment(Qt.AlignCenter)
        self.editPage.setButtonSymbols(QSpinBox.NoButtons)
        self.editPage.editingFinished.connect(self.onValueChanged)
        # 禁止鼠标滑轮
        self.editPage.wheelEvent = self._wheelEvent 
开发者ID:PyQt5,项目名称:CustomWidgets,代码行数:21,代码来源:CPaginationBar.py

示例14: __init__

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AlignCenter [as 别名]
def __init__(self, *args, **kwargs):
        super(Window, self).__init__(*args, **kwargs)
        self.setStyleSheet(Style)
        layout = QVBoxLayout(self)
        layout.addWidget(QLabel('目标值:1234,持续时间:6秒', self))
        self.countLabel = CCountUp(self)
        self.countLabel.setAlignment(Qt.AlignCenter)
        self.countLabel.setMinimumSize(100, 100)
        self.countLabel.setDuration(6000)  # 动画时间 6 秒
        layout.addWidget(self.countLabel)

        cw = QWidget(self)
        layout.addWidget(cw)
        layoutc = QHBoxLayout(cw)
        layoutc.addWidget(QPushButton(
            '开始', cw, clicked=lambda: self.countLabel.setNum(1234)))
        layoutc.addWidget(QPushButton('重置', cw, clicked=self.countLabel.reset))
        layoutc.addWidget(QPushButton('暂停/继续', cw, clicked=self.doContinue))

        layoutc.addWidget(QPushButton(
            '开始负小数-1234.00', cw, clicked=lambda: self.countLabel.setNum(-1234.00))) 
开发者ID:PyQt5,项目名称:CustomWidgets,代码行数:23,代码来源:TestCCountUp.py

示例15: paintEvent

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AlignCenter [as 别名]
def paintEvent(self, event):
        ancho, altura = self.width(), self.height()
        icono = self.icono.scaled(ancho, altura, Qt.KeepAspectRatio, Qt.SmoothTransformation)

        pintor = QPainter()
        
        pintor.begin(self)
        pintor.setRenderHint(QPainter.Antialiasing, True)
        pintor.setPen(Qt.NoPen)
        pintor.drawPixmap(0, 0, icono, 0, 0, 0, 0)
        pintor.setPen(Qt.white)
        pintor.drawText(event.rect(), Qt.AlignCenter, self.etiqueta)
        pintor.setPen(Qt.NoPen)
        pintor.setBrush(self.opacidad)
        pintor.drawEllipse(0, 0, ancho, altura)
        pintor.end()

        self.setMask(icono.mask()) 
开发者ID:andresnino,项目名称:PyQt5,代码行数:20,代码来源:botonCircular.py


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