本文整理汇总了Python中PyQt5.QtCore.Qt.AlignLeft方法的典型用法代码示例。如果您正苦于以下问题:Python Qt.AlignLeft方法的具体用法?Python Qt.AlignLeft怎么用?Python Qt.AlignLeft使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtCore.Qt
的用法示例。
在下文中一共展示了Qt.AlignLeft方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AlignLeft [as 别名]
def __init__(self, parent=None):
super(BaseTab, self).__init__(parent)
self.setTextFormat(Qt.RichText)
self.setWordWrap(True)
self.setAlignment(Qt.AlignLeft | Qt.AlignTop)
self.setOpenExternalLinks(True)
if parent.theme == 'dark':
bgcolor = 'rgba(12, 15, 16, 210)'
pencolor = '#FFF'
else:
bgcolor = 'rgba(255, 255, 255, 200)'
pencolor = '#000'
self.setStyleSheet('''
QLabel {{
background-color: {bgcolor};
color: {pencolor};
padding: 8px;
}}'''.format(**locals()))
# noinspection PyBroadException
示例2: paintEvent
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AlignLeft [as 别名]
def paintEvent(self, event):
super(Label, self).paintEvent(event)
# 中正间画十字
painter = QPainter(self)
painter.setPen(Qt.red)
x = int(self.width() / 2)
y = int(self.height() / 2)
painter.drawLine(x, 0, x, self.height())
painter.drawLine(0, y, self.width(), y)
if self.ismd:
# 画坐标点
pos = QCursor.pos()
ret = win32gui.GetPixel(win32gui.GetWindowDC(
win32gui.GetDesktopWindow()), pos.x(), pos.y())
r, g, b = ret & 0xff, (ret >> 8) & 0xff, (ret >> 16) & 0xff
print(r, g, b)
painter.setPen(Qt.white)
painter.drawText(self.rect(), Qt.AlignLeft |
Qt.AlignBottom, '({}, {})\nRGB: ({}, {}, {})\n{}'.format(
pos.x(), pos.y(), r, g, b, QColor(r, g, b).name()))
示例3: data
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AlignLeft [as 别名]
def data(self, index, role=Qt.DisplayRole):
'''The data stored under the given role for the item referred
to by the index.
Args:
index (:obj:`QtCore.QModelIndex`): Index
role (:obj:`Qt.ItemDataRole`): Default :obj:`Qt.DisplayRole`
Returns:
data
'''
if role == Qt.DisplayRole:
row = self._data[index.row()]
if (index.column() == 0) and (type(row) != dict):
return row
elif index.column() < self.columnCount():
if type(row) == dict:
if self.header[index.column()] in row:
return row[self.header[index.column()]]
elif self.header[index.column()].lower() in row:
return row[self.header[index.column()].lower()]
return row[index.column()]
return None
elif role == Qt.FontRole:
return QtGui.QFont().setPointSize(30)
elif role == Qt.DecorationRole and index.column() == 0:
return None
elif role == Qt.TextAlignmentRole:
return Qt.AlignLeft;
示例4: paintEvent
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AlignLeft [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)
示例5: alignLeft
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AlignLeft [as 别名]
def alignLeft(self):
self.text.setAlignment(Qt.AlignLeft)
示例6: paintEvent
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AlignLeft [as 别名]
def paintEvent(self, event):
self.startX = (self.width() - self.textWidth) / 2
self.startY = self.toolBarHeight + (self.height() - self.toolBarHeight - self.textHeight) / 2
painter = QPainter(self)
painter.setRenderHint(QPainter.Antialiasing)
# pixelSize = self.font.pixelSize()
# pixelSize += 1
# self.font.setPixelSize(pixelSize)
# self.setFont(self.font)
# self.textHeight = self.fontMetrics().height()
# spacing = (self.height() - self.toolBarHeight - self.textHeight) / 2
# # if spacing > 0:
painter.setFont(self.font)
if self.boderFlag:
color = QColor('lightgray')
color.setAlpha(30)
painter.fillRect(0, self.toolBarHeight, self.width(), self.height() - self.toolBarHeight, color)
painter.setPen(QColor(0, 0, 0, 200))
painter.drawText(self.startX + 1, self.startY + 1, self.textWidth, self.textHeight, Qt.AlignLeft, self.text)
painter.setPen(QPen(self.linear_gradient, 0))
painter.drawText(self.startX, self.startY, self.textWidth, self.textHeight, Qt.AlignLeft, self.text)
painter.setPen(QPen(self.mask_linear_gradient, 0))
painter.drawText(self.startX, self.startY, self.textWidth * self.p , self.textHeight, Qt.AlignLeft, self.text)
self.p += 0.01
if self.p >= 1:
self.p = 0
self.font.setPixelSize(30)
示例7: setup_turn_label
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AlignLeft [as 别名]
def setup_turn_label(self):
size_policy = constants.default_size_policy(self.dateLabel, QSizePolicy.Preferred, QSizePolicy.Fixed)
self.dateLabel.setSizePolicy(size_policy)
self.dateLabel.setFont(constants.default_font())
self.dateLabel.setText('Turn ' + str(self.battleView.turn))
self.dateLabel.setAlignment(Qt.AlignLeft | Qt.AlignVCenter)
self.gridLayout.addWidget(self.dateLabel, 0, 0, 1, 1)
示例8: init_ui
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AlignLeft [as 别名]
def init_ui(self):
layout = QHBoxLayout(self)
self.find_label = QLabel("Find:")
self.find_label.setMaximumSize(35, 24)
layout.addWidget(self.find_label)
self.find_combo_box = QComboBox()
self.find_combo_box.setMaximumSize(105, 24)
layout.addWidget(self.find_combo_box)
self.find_edit = QLineEdit()
self.find_edit.setMaximumSize(140, 24)
self.find_edit.returnPressed.connect(
lambda: self.on_find_btn_clicked(self.last_direction)
)
layout.addWidget(self.find_edit)
self.prev_btn = QToolButton(self)
self.prev_btn.clicked.connect(lambda: self.on_find_btn_clicked(-1))
self.prev_btn.setArrowType(Qt.UpArrow)
self.prev_btn.setToolTip("Find previous")
layout.addWidget(self.prev_btn)
self.next_btn = QToolButton(self)
self.next_btn.clicked.connect(lambda: self.on_find_btn_clicked(1))
self.next_btn.setArrowType(Qt.DownArrow)
self.next_btn.setToolTip("Find next")
layout.addWidget(self.next_btn)
layout.setAlignment(Qt.AlignLeft)
示例9: __init__
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AlignLeft [as 别名]
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.previous_selection = []
self.setColumnCount(len(Column))
h_header = self.horizontalHeader()
h_header.setDefaultAlignment(Qt.AlignLeft | Qt.AlignVCenter)
for col in Column:
h_header.setSectionResizeMode(col, QHeaderView.Fixed)
self.setColumnWidth(Column.ICON, 50)
self.setColumnWidth(
Column.NAME,
max(self.size().width() - FileTable.FIXED_COL_SIZE, FileTable.NAME_COL_MIN_SIZE),
)
self.setColumnWidth(Column.CREATED, 200)
self.setColumnWidth(Column.UPDATED, 200)
self.setColumnWidth(Column.SIZE, 100)
v_header = self.verticalHeader()
v_header.setSectionResizeMode(QHeaderView.Fixed)
v_header.setDefaultSectionSize(48)
self.setItemDelegate(ItemDelegate())
self.setContextMenuPolicy(Qt.CustomContextMenu)
self.itemSelectionChanged.connect(self.change_selection)
self.customContextMenuRequested.connect(self.show_context_menu)
self.cellDoubleClicked.connect(self.item_double_clicked)
self.cellClicked.connect(self.item_clicked)
self.current_user_role = WorkspaceRole.OWNER
self.paste_disabled = True
effect = QGraphicsDropShadowEffect(self)
effect.setColor(QColor(34, 34, 34, 25))
effect.setBlurRadius(8)
effect.setXOffset(0)
effect.setYOffset(2)
self.setGraphicsEffect(effect)
示例10: add_tabbar
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AlignLeft [as 别名]
def add_tabbar(self, tabbar):
self._right_layout.addWidget(tabbar)
self._right_layout.setAlignment(self.parent().tabbar, Qt.AlignLeft)
示例11: crearLeyendaCaja
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AlignLeft [as 别名]
def crearLeyendaCaja(self):
leyendaComboBox = QComboBox()
leyendaComboBox.addItem("No Leyenda", 0)
leyendaComboBox.addItem("Leyenda superior", Qt.AlignTop)
leyendaComboBox.addItem("Leyenda inferior", Qt.AlignBottom)
leyendaComboBox.addItem("Leyenda izquierda", Qt.AlignLeft)
leyendaComboBox.addItem("Leyenda derecha", Qt.AlignRight)
return leyendaComboBox
示例12: add_module
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AlignLeft [as 别名]
def add_module(self, module):
name = QStandardItem()
name.setTextAlignment(Qt.AlignLeft)
if 'name' in module:
name.setText(module['name'])
base = QStandardItem()
base.setTextAlignment(Qt.AlignCenter)
str_fmt = '0x{0:X}'
if not self.uppercase_hex:
str_fmt = '0x{0:x}'
if 'base' in module:
base.setText(str_fmt.format(int(module['base'], 16)))
size = QStandardItem()
size.setTextAlignment(Qt.AlignRight)
if 'size' in module:
size.setText("{0:,d}".format(int(module['size'])))
path = QStandardItem()
path.setTextAlignment(Qt.AlignLeft)
if 'path' in module:
path.setText(module['path'])
self.modules_model.appendRow([name, base, size, path])
module_info = ModuleInfo(module)
if 'exports' in module and module['exports']:
module_info.apply_exports(module['exports'])
if 'imports' in module and module['imports']:
module_info.apply_imports(module['imports'])
if 'symbols' in module and module['symbols']:
module_info.apply_symbols(module['symbols'])
module_info._updated_details = True
示例13: set_imports
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AlignLeft [as 别名]
def set_imports(self, imports):
""" Fills the ImportsList with data
"""
if self.imports_list is None:
return
self.imports_list.clear()
for import_ in imports:
name = QStandardItem()
name.setTextAlignment(Qt.AlignLeft)
if 'name' in import_:
name.setText(import_['name'])
address = QStandardItem()
address.setTextAlignment(Qt.AlignCenter)
str_fmt = '0x{0:X}'
if not self.uppercase_hex:
str_fmt = '0x{0:x}'
if 'address' in import_:
address.setText(str_fmt.format(int(import_['address'], 16)))
module = QStandardItem()
if 'module' in import_:
module.setTextAlignment(Qt.AlignLeft)
module.setText(import_['module'])
type_ = QStandardItem()
if 'type' in import_:
type_.setTextAlignment(Qt.AlignLeft)
type_.setText(import_['type'])
self.imports_model.appendRow([name, address, module, type_])
示例14: set_exports
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AlignLeft [as 别名]
def set_exports(self, exports):
""" Fills the ExportsList with data
"""
if self.exports_list is None:
return
self.exports_list.clear()
for export in exports:
name = QStandardItem()
name.setTextAlignment(Qt.AlignLeft)
if 'name' in export:
name.setText(export['name'])
address = QStandardItem()
address.setTextAlignment(Qt.AlignCenter)
str_fmt = '0x{0:X}'
if not self.uppercase_hex:
str_fmt = '0x{0:x}'
if 'address' in export:
address.setText(str_fmt.format(int(export['address'], 16)))
type_ = QStandardItem()
type_.setTextAlignment(Qt.AlignLeft)
if 'type' in export:
type_.setText(export['type'])
self.exports_model.appendRow([name, address, type_])
示例15: set_symbols
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AlignLeft [as 别名]
def set_symbols(self, symbols):
""" Fills the SymbolsList with data
"""
if self.symbols_list is None:
return
self.symbols_list.clear()
for symbol in symbols:
name = QStandardItem()
name.setTextAlignment(Qt.AlignLeft)
if 'name' in symbol:
name.setText(symbol['name'])
address = QStandardItem()
address.setTextAlignment(Qt.AlignCenter)
str_fmt = '0x{0:X}'
if not self.uppercase_hex:
str_fmt = '0x{0:x}'
if 'address' in symbol:
address.setText(str_fmt.format(int(symbol['address'], 16)))
type_ = QStandardItem()
type_.setTextAlignment(Qt.AlignLeft)
if 'type' in symbol:
type_.setText(symbol['type'])
self.symbols_model.appendRow([name, address, type_])
# ************************************************************************
# **************************** Handlers **********************************
# ************************************************************************