本文整理汇总了Python中qtpy.QtCore.Qt.AlignCenter方法的典型用法代码示例。如果您正苦于以下问题:Python Qt.AlignCenter方法的具体用法?Python Qt.AlignCenter怎么用?Python Qt.AlignCenter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qtpy.QtCore.Qt
的用法示例。
在下文中一共展示了Qt.AlignCenter方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from qtpy.QtCore import Qt [as 别名]
# 或者: from qtpy.QtCore.Qt import AlignCenter [as 别名]
def __init__(self, value='', parent=None, get_pos=None):
super().__init__(value, parent=parent)
self.fm = QFontMetrics(QFont("", 0))
self.setObjectName('slice_label')
self.min_width = 30
self.max_width = 200
self.setCursor(Qt.IBeamCursor)
self.setValidator(QDoubleValidator())
self.textChanged.connect(self._on_text_changed)
self._on_text_changed(value)
self.get_pos = get_pos
if parent is not None:
self.min_width = 50
self.slider = parent.slider
self.setAlignment(Qt.AlignCenter)
示例2: __init__
# 需要导入模块: from qtpy.QtCore import Qt [as 别名]
# 或者: from qtpy.QtCore.Qt import AlignCenter [as 别名]
def __init__(self, editor_widget, main):
"""Main widget constructor."""
self.editor_widget = editor_widget
self.main = main
QLineEdit.__init__(self, editor_widget)
# Build widget
self.commandline = VimLineEdit(self)
self.commandline.textChanged.connect(self.on_text_changed)
self.commandline.returnPressed.connect(self.on_return)
self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
hlayout = QHBoxLayout()
self.status_label = QLabel("INSERT")
self.status_label.setFixedWidth(60)
self.status_label.setAlignment(Qt.AlignCenter)
self.on_mode_changed("insert")
hlayout.addWidget(self.status_label)
hlayout.addWidget(self.commandline)
hlayout.setContentsMargins(5, 0, 0, 5)
self.setLayout(hlayout)
self.selection_type = (int(time()), "char")
QApplication.clipboard().dataChanged.connect(self.on_copy)
# Initialize available commands
self.vim_keys = VimKeys(self)
self.vim_commands = VimCommands(self)
self.vim_keys.mode_changed.connect(self.on_mode_changed)
示例3: get_level_show_checkbox
# 需要导入模块: from qtpy.QtCore import Qt [as 别名]
# 或者: from qtpy.QtCore.Qt import AlignCenter [as 别名]
def get_level_show_checkbox(self, level):
checkbox_widget = QWidget(self.table)
checkbox_widget.setStyleSheet("QWidget { background-color:none;}")
checkbox = QCheckBox()
checkbox.setStyleSheet("QCheckBox::indicator { width: 15px; height: 15px;}")
checkbox.setChecked(level.enabled)
checkbox_layout = QHBoxLayout()
checkbox_layout.setAlignment(Qt.AlignCenter)
checkbox_layout.setContentsMargins(0, 0, 0, 0)
checkbox_layout.addWidget(checkbox)
checkbox_widget.setLayout(checkbox_layout)
return checkbox_widget
示例4: __init__
# 需要导入模块: from qtpy.QtCore import Qt [as 别名]
# 或者: from qtpy.QtCore.Qt import AlignCenter [as 别名]
def __init__(self, parent=None):
"""Constructor."""
QTreeView.__init__(self, parent)
self.header().setDefaultAlignment(Qt.AlignCenter)
self.setItemsExpandable(True)
self.setSortingEnabled(True)
self.header().setSortIndicatorShown(False)
self.header().sortIndicatorChanged.connect(self.sortByColumn)
self.header().sortIndicatorChanged.connect(
lambda col, order: self.header().setSortIndicatorShown(True))
self.setExpandsOnDoubleClick(False)
self.doubleClicked.connect(self.go_to_test_definition)
示例5: __draw_link
# 需要导入模块: from qtpy.QtCore import Qt [as 别名]
# 或者: from qtpy.QtCore.Qt import AlignCenter [as 别名]
def __draw_link(self, vlink: VLink) -> None:
"""Draw a link."""
if vlink.name == VLink.FRAME or not vlink.points:
return
pen = QPen()
# Rearrange: Put the nearest point to the next position.
qpoints = convex_hull(
[(c.x * self.zoom, c.y * -self.zoom)
for c in vlink.points_pos(self.vpoints)], as_qpoint=True)
if (
self.select_mode == SelectMode.LINK
and self.vlinks.index(vlink) in self.selections
):
pen.setWidth(self.link_width + 6)
pen.setColor(Qt.black if self.monochrome else QColor(161, 16, 239))
self.painter.setPen(pen)
self.painter.drawPolygon(*qpoints)
pen.setWidth(self.link_width)
pen.setColor(Qt.black if self.monochrome else QColor(*vlink.color))
self.painter.setPen(pen)
self.painter.drawPolygon(*qpoints)
if not self.show_point_mark:
return
pen.setColor(Qt.darkGray)
self.painter.setPen(pen)
p_count = len(qpoints)
cen_x = sum(p.x() for p in qpoints) / p_count
cen_y = sum(p.y() for p in qpoints) / p_count
self.painter.drawText(
QRectF(cen_x - 50, cen_y - 50, 100, 100),
Qt.AlignCenter,
f'[{vlink.name}]'
)
示例6: _show_message
# 需要导入模块: from qtpy.QtCore import Qt [as 别名]
# 或者: from qtpy.QtCore.Qt import AlignCenter [as 别名]
def _show_message(self, text):
"""Show message on splash screen."""
self.splash.showMessage(text, Qt.AlignBottom | Qt.AlignCenter |
Qt.AlignAbsolute, QColor(Qt.black))
示例7: __init__
# 需要导入模块: from qtpy.QtCore import Qt [as 别名]
# 或者: from qtpy.QtCore.Qt import AlignCenter [as 别名]
def __init__(self, parent, compatibles, title="Append data"):
super().__init__(parent)
self.setWindowTitle(title)
vbox = QVBoxLayout(self)
grid = QGridLayout()
grid.addWidget(QLabel("Source"), 0, 0, Qt.AlignCenter)
grid.addWidget(QLabel("Destination"), 0, 2, Qt.AlignCenter)
source = QListWidget(self)
source.setAcceptDrops(True)
source.setDragEnabled(True)
source.setSelectionMode(QAbstractItemView.ExtendedSelection)
source.setDefaultDropAction(Qt.DropAction.MoveAction)
source.insertItems(0, [d["name"] for d in compatibles])
grid.addWidget(source, 1, 0)
grid.addWidget(QLabel("->"), 1, 1, Qt.AlignHCenter)
self.destination = QListWidget(self)
self.destination.setAcceptDrops(True)
self.destination.setDragEnabled(True)
self.destination.setSelectionMode(QAbstractItemView.ExtendedSelection)
self.destination.setDefaultDropAction(Qt.DropAction.MoveAction)
grid.addWidget(self.destination, 1, 2)
vbox.addLayout(grid)
self.buttonbox = QDialogButtonBox(QDialogButtonBox.Ok |
QDialogButtonBox.Cancel)
self.buttonbox.accepted.connect(self.accept)
self.buttonbox.rejected.connect(self.reject)
vbox.addWidget(self.buttonbox)
vbox.setSizeConstraint(QVBoxLayout.SetFixedSize)
self.destination.model().rowsInserted.connect(self.toggle_buttons)
self.destination.model().rowsRemoved.connect(self.toggle_buttons)
self.toggle_buttons()
示例8: __init__
# 需要导入模块: from qtpy.QtCore import Qt [as 别名]
# 或者: from qtpy.QtCore.Qt import AlignCenter [as 别名]
def __init__(self, dims, axis, reverse=False, fps=10, mode=LoopMode.LOOP):
super().__init__()
self.dims = dims
self.axis = axis
self.reverse = reverse
self.fps = fps
self.mode = mode
self.setProperty('reverse', str(reverse)) # for styling
self.setProperty('playing', 'False') # for styling
# build popup modal form
self.popup = QtPopup(self)
form_layout = QFormLayout()
self.popup.frame.setLayout(form_layout)
fpsspin = QtCustomDoubleSpinBox(self.popup)
fpsspin.setObjectName("fpsSpinBox")
fpsspin.setAlignment(Qt.AlignCenter)
fpsspin.setValue(self.fps)
if hasattr(fpsspin, 'setStepType'):
# this was introduced in Qt 5.12. Totally optional, just nice.
fpsspin.setStepType(QDoubleSpinBox.AdaptiveDecimalStepType)
fpsspin.setMaximum(500)
fpsspin.setMinimum(0)
form_layout.insertRow(
0, QLabel('frames per second:', parent=self.popup), fpsspin
)
self.fpsspin = fpsspin
revcheck = QCheckBox(self.popup)
revcheck.setObjectName("playDirectionCheckBox")
form_layout.insertRow(
1, QLabel('play direction:', parent=self.popup), revcheck
)
self.reverse_check = revcheck
mode_combo = QComboBox(self.popup)
mode_combo.addItems([str(i).replace('_', ' ') for i in LoopMode])
form_layout.insertRow(
2, QLabel('play mode:', parent=self.popup), mode_combo
)
mode_combo.setCurrentText(str(self.mode))
self.mode_combo = mode_combo