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


Python Qt.AlignHCenter方法代码示例

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


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

示例1: on_list_success

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AlignHCenter [as 别名]
def on_list_success(self, job):
        self.layout_workspaces.clear()
        workspaces = job.ret

        if not workspaces:
            self.line_edit_search.hide()
            label = QLabel(_("TEXT_WORKSPACE_NO_WORKSPACES"))
            label.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
            self.layout_workspaces.addWidget(label)
            return

        self.line_edit_search.show()
        for count, workspace in enumerate(workspaces):
            workspace_fs, ws_entry, users_roles, files, timestamped = workspace

            try:
                self.add_workspace(
                    workspace_fs, ws_entry, users_roles, files, timestamped=timestamped
                )
            except JobSchedulerNotAvailable:
                pass 
开发者ID:Scille,项目名称:parsec-cloud,代码行数:23,代码来源:workspaces_widget.py

示例2: __init__

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

        self._border_radius = 10
        self.label = QLabel('...', self)
        self._size_grip = QSizeGrip(self)
        self._size_grip.setFixedWidth(self._border_radius * 2)

        font = self.font()
        font.setPointSize(24)
        self.label.setFont(font)
        self.label.setAlignment(Qt.AlignBaseline | Qt.AlignVCenter | Qt.AlignHCenter)
        self.label.setWordWrap(False)

        self._layout = QHBoxLayout(self)
        self._layout.setContentsMargins(0, 0, 0, 0)
        self._layout.setSpacing(0)
        self._layout.addSpacing(self._border_radius * 2)
        self._layout.addWidget(self.label)
        self._layout.addWidget(self._size_grip)
        self._layout.setAlignment(self._size_grip, Qt.AlignBottom) 
开发者ID:feeluown,项目名称:FeelUOwn,代码行数:23,代码来源:lyric.py

示例3: data

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AlignHCenter [as 别名]
def data(self, index, role):
        if index.isValid() or (0 <= index.row() < len(self.ListItemData)):
            if role == Qt.DisplayRole:
                return QVariant(self.ListItemData[index.row()]['name'])
            elif role == Qt.DecorationRole:
                return QVariant(QIcon(self.ListItemData[index.row()]['iconPath']))
            elif role == Qt.SizeHintRole:
                return QVariant(QSize(70,80))
            elif role == Qt.TextAlignmentRole:
                return QVariant(int(Qt.AlignHCenter|Qt.AlignVCenter))
            elif role == Qt.FontRole:
                font = QFont()
                font.setPixelSize(20)
                return QVariant(font)
        else:            
            return QVariant() 
开发者ID:Python3Spiders,项目名称:WeiboSuperSpider,代码行数:18,代码来源:ListModel.py

示例4: __init__

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AlignHCenter [as 别名]
def __init__(self, *args, **kwargs):
        super(WidgetCode, self).__init__(*args, **kwargs)
        self._sensitive = False  # 是否大小写敏感
        self.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
        self.setBackgroundRole(QPalette.Midlight)
        self.setAutoFillBackground(True)
        # 字体
        newFont = self.font()
        newFont.setPointSize(16)
        newFont.setFamily("Kristen ITC")
        newFont.setBold(True)
        self.setFont(newFont)
        self.reset()
        # 定时器
        self.step = 0
        self.timer = QBasicTimer()
        self.timer.start(60, self) 
开发者ID:PyQt5,项目名称:PyQt,代码行数:19,代码来源:VerificationCode.py

示例5: data

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AlignHCenter [as 别名]
def data(self, index, role):
        """Re-implemented method to get the data for a given index and role"""
        node = index.internalPointer()
        parent = node.parent
        if parent:
            if role == Qt.DisplayRole and index.column() == 5:
                return node.name
        elif not parent and role == Qt.DisplayRole and index.column() == 5:
            return node.var_list()
        elif not parent and role == Qt.DisplayRole:
            if index.column() == 0:
                return node.id
            if index.column() == 1:
                return node.name
            if index.column() == 2:
                return str(node.period)
        if role == Qt.TextAlignmentRole and \
                (index.column() == 4 or index.column() == 3):
            return Qt.AlignHCenter | Qt.AlignVCenter

        return None 
开发者ID:bitcraze,项目名称:crazyflie-clients-python,代码行数:23,代码来源:LogBlockTab.py

示例6: TabelaEntrega

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AlignHCenter [as 别名]
def TabelaEntrega(self, tabela, row, col, data, cor, status):
        item = QtWidgets.QLabel()
        item.setAlignment(Qt.AlignLeading|Qt.AlignHCenter|
        Qt.AlignVCenter)
        item.setIndent(3)
        item.setMargin(0)
        item.setStyleSheet("background: #FFF")
        html = ("""
                <strong style="font-family:Arial; font-size: 13px;">{}<br/>
                <span style="color:{}; font-size: 12px">{}</span></strong>"""
                ).format(data, cor, status)
        item.setText(html)
        tabela.setCellWidget(row, col, item)


    # Texto Tabela Valor Produtos 
开发者ID:andrersp,项目名称:controleEstoque,代码行数:18,代码来源:main.py

示例7: paintEvent

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AlignHCenter [as 别名]
def paintEvent(self, event):
        painter = QPainter(self)
        painter.setFont(self.font)
        
        linear = QLinearGradient(QPoint(self.rect().topLeft()), QPoint(self.rect().bottomLeft()))
        linear.setStart(0, 10)
        linear.setFinalStop(0, 50)
        linear.setColorAt(0.1, QColor(14, 179, 255));
        linear.setColorAt(0.5, QColor(154, 232, 255));
        linear.setColorAt(0.9, QColor(14, 179, 255));
        
        linear2 = QLinearGradient(QPoint(self.rect().topLeft()), QPoint(self.rect().bottomLeft()))
        linear2.setStart(0, 10)
        linear2.setFinalStop(0, 50)
        linear2.setColorAt(0.1, QColor(222, 54, 4));
        linear2.setColorAt(0.5, QColor(255, 172, 116));
        linear2.setColorAt(0.9, QColor(222, 54, 4));
        
        painter.setPen(QColor(0, 0, 0, 200));
        painter.drawText(QRect(1, 1, self.screen.width(), 60), Qt.AlignHCenter | Qt.AlignVCenter, self.lyric)
        
        painter.setPen(QColor('transparent'));
        self.textRect = painter.drawText(QRect(0, 0, self.screen.width(), 60), Qt.AlignHCenter | Qt.AlignVCenter, self.lyric)

        painter.setPen(QPen(linear, 0))
        painter.drawText(self.textRect, Qt.AlignLeft | Qt.AlignVCenter, self.lyric)
        if self.intervel != 0:
            self.widthBlock = self.textRect.width()/(self.intervel/150.0)
        else:
            self.widthBlock = 0
        self.maskRect = QRectF(self.textRect.x(), self.textRect.y(), self.textRect.width(), self.textRect.height())
        self.maskRect.setWidth(self.maskWidth)
        painter.setPen(QPen(linear2, 0));
        painter.drawText(self.maskRect, Qt.AlignLeft | Qt.AlignVCenter, self.lyric) 
开发者ID:HuberTRoy,项目名称:MusicBox,代码行数:36,代码来源:player.py

示例8: __init__

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AlignHCenter [as 别名]
def __init__(self, experiment, **kwargs):

        super().__init__(**kwargs)
        self.experiment = experiment
        self.container_layout = QVBoxLayout()
        self.container_layout.setContentsMargins(0, 0, 0, 0)

        StimDisplay = type("StimDisplay", (StimDisplayWidgetConditional, QWidget), {})
        self.widget_display = StimDisplay(
            self,
            calibrator=self.experiment.calibrator,
            protocol_runner=self.experiment.protocol_runner,
            record_stim_framerate=None,
        )

        self.layout_inner = QVBoxLayout()
        self.layout_inner.addWidget(self.widget_display)
        self.button_show_display = QPushButton(
            "Show stimulus (showing stimulus may impair performance)"
        )
        self.widget_display.display_state = False
        self.button_show_display.clicked.connect(self.change_button)
        self.layout_inner.addWidget(self.button_show_display)

        self.layout_inner.setContentsMargins(12, 0, 12, 12)
        self.container_layout.addLayout(self.layout_inner)
        self.setLayout(self.container_layout)
        self.container_layout.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter)

        self.widget_display.sizeHint = lambda: QSize(100, 100)
        sizePolicy = QSizePolicy(
            QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding
        )
        self.widget_display.setSizePolicy(sizePolicy)

        self.widget_display.setMaximumSize(500, 500) 
开发者ID:portugueslab,项目名称:stytra,代码行数:38,代码来源:stimulus_display.py

示例9: paint

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AlignHCenter [as 别名]
def paint(self, painter, option, index):
        option.displayAlignment = Qt.AlignHCenter | Qt.AlignVCenter
        super().paint(painter, option, index) 
开发者ID:FrancescoCeruti,项目名称:linux-show-player,代码行数:5,代码来源:qdelegates.py

示例10: showSplashMessage

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AlignHCenter [as 别名]
def showSplashMessage(self, message: str) -> None:
        """Display text on the splash screen."""

        if not QtApplication.splash:
            self.createSplash()

        if QtApplication.splash:
            self.processEvents()  # Process events from previous loading phase before updating the message
            QtApplication.splash.showMessage(message, Qt.AlignHCenter | Qt.AlignVCenter)  # Now update the message
            self.processEvents()  # And make sure it is immediately visible
        elif self.getIsHeadLess():
            Logger.log("d", message) 
开发者ID:Ultimaker,项目名称:Uranium,代码行数:14,代码来源:QtApplication.py

示例11: initCategories

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AlignHCenter [as 别名]
def initCategories(self):
        generalButton = QListWidgetItem(self.categories)
        generalButton.setIcon(QIcon(':/images/settings-general.png'))
        generalButton.setText('General')
        generalButton.setToolTip('General settings')
        generalButton.setTextAlignment(Qt.AlignHCenter)
        generalButton.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)
        videoButton = QListWidgetItem(self.categories)
        videoButton.setIcon(QIcon(':/images/settings-video.png'))
        videoButton.setText('Video')
        videoButton.setToolTip('Video settings')
        videoButton.setTextAlignment(Qt.AlignHCenter)
        videoButton.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)
        themeButton = QListWidgetItem(self.categories)
        themeButton.setIcon(QIcon(':/images/settings-theme.png'))
        themeButton.setText('Theme')
        themeButton.setToolTip('Theme settings')
        themeButton.setTextAlignment(Qt.AlignHCenter)
        themeButton.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)
        ffmpegButton = QListWidgetItem(self.categories)
        ffmpegButton.setIcon(QIcon(':/images/settings-ffmpeg.png'))
        ffmpegButton.setText('Tools')
        ffmpegButton.setToolTip('Tools settings')
        ffmpegButton.setTextAlignment(Qt.AlignHCenter)
        ffmpegButton.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)
        logsButton = QListWidgetItem(self.categories)
        logsButton.setIcon(QIcon(':/images/settings-logs.png'))
        logsButton.setText('Logs')
        logsButton.setToolTip('Logging settings')
        logsButton.setTextAlignment(Qt.AlignHCenter)
        logsButton.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)
        self.categories.currentItemChanged.connect(self.changePage)
        self.categories.setCurrentRow(0)
        self.categories.setMaximumWidth(self.categories.sizeHintForColumn(0) + 2) 
开发者ID:ozmartian,项目名称:vidcutter,代码行数:36,代码来源:settings.py

示例12: __init__

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AlignHCenter [as 别名]
def __init__(self, defaultStr):
        super().__init__(defaultStr)
        
        self.setTextAlignment( Qt.AlignHCenter  + Qt.AlignVCenter) 
开发者ID:ghostop14,项目名称:sparrow-wifi,代码行数:6,代码来源:sparrowtablewidgets.py

示例13: paint

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AlignHCenter [as 别名]
def paint(self, painter, option, index):
        view_option = QStyleOptionViewItem(option)
        view_option.decorationAlignment |= Qt.AlignHCenter
        # Even though we told Qt that we don't want any selection on our
        # list, it still adds a blue rectangle on focused items.
        # So we just get rid of focus.
        if option.state & QStyle.State_HasFocus:
            view_option.state &= ~QStyle.State_HasFocus
        super().paint(painter, view_option, index) 
开发者ID:Scille,项目名称:parsec-cloud,代码行数:11,代码来源:notification_center_widget.py

示例14: on_list_error

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AlignHCenter [as 别名]
def on_list_error(self, job):
        self.layout_workspaces.clear()
        label = QLabel(_("TEXT_WORKSPACE_NO_WORKSPACES"))
        label.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
        self.layout_workspaces.addWidget(label) 
开发者ID:Scille,项目名称:parsec-cloud,代码行数:7,代码来源:workspaces_widget.py

示例15: paint

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AlignHCenter [as 别名]
def paint(self, painter, option, index):
        view_option = QStyleOptionViewItem(option)
        view_option.decorationAlignment |= Qt.AlignHCenter
        # Qt tries to be nice and adds a lovely background color
        # on the focused item. Since we select items by rows and not
        # individually, we don't want that, so we remove the focus
        if option.state & QStyle.State_HasFocus:
            view_option.state &= ~QStyle.State_HasFocus
        if index.data(COPY_STATUS_DATA_INDEX):
            view_option.font.setItalic(True)
        super().paint(painter, view_option, index) 
开发者ID:Scille,项目名称:parsec-cloud,代码行数:13,代码来源:file_table.py


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