Python PyQt5.QtCore.Qt.AlignLeft() Examples
The following are 30
code examples of PyQt5.QtCore.Qt.AlignLeft().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
PyQt5.QtCore.Qt
, or try the search function
.
Example #1
Source File: about.py From vidcutter with GNU General Public License v3.0 | 6 votes |
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
Example #2
Source File: ProbeWindow.py From PyQt with GNU General Public License v3.0 | 6 votes |
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()))
Example #3
Source File: ChartThemes.py From PyQt with GNU General Public License v3.0 | 5 votes |
def createLegendBox(self): legendComboBox = QComboBox() legendComboBox.addItem("No Legend ", 0) legendComboBox.addItem("Legend Top", Qt.AlignTop) legendComboBox.addItem("Legend Bottom", Qt.AlignBottom) legendComboBox.addItem("Legend Left", Qt.AlignLeft) legendComboBox.addItem("Legend Right", Qt.AlignRight) return legendComboBox
Example #4
Source File: file_table.py From parsec-cloud with GNU Affero General Public License v3.0 | 5 votes |
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)
Example #5
Source File: graficoCircular.py From PyQt5 with MIT License | 5 votes |
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
Example #6
Source File: QLineEdit.py From PyQt5 with MIT License | 5 votes |
def initUI(self): # =================== WIDGET QLINEEDIT ===================== self.lineEdit = QLineEdit(self) # ================== FUNCIONES PÚBLICAS ================== self.lineEdit.setGeometry(20, 20, 360, 24) self.lineEdit.setText("Andres Niño") # self.lineEdit.setAlignment(Qt.AlignLeft) # self.lineEdit.setClearButtonEnabled(True) # self.lineEdit.setCursorPosition(6) # self.lineEdit.home(True) # self.lineEdit.end(True) # self.lineEdit.setEchoMode(QLineEdit.Password) # self.lineEdit.setFrame(False) # self.lineEdit.setMaxLength(2) # self.lineEdit.setPlaceholderText("Andres Niño") # self.lineEdit.setReadOnly(True) # self.lineEdit.setSelection(3, 2) # self.lineEdit.selectAll() # self.lineEdit.deselect() # self.lineEdit.setTextMargins(10, 0, 6, 1) # self.lineEdit.setInputMask(">AAAAA-AAAAA-AAAAA-AAAAA-AAAAA;#") # self.lineEdit.setValidator(QRegExpValidator(QRegExp("[0-9]+"))) # print(self.lineEdit.text()) fuente = QFont() fuente.setPointSize(10) fuente.setCapitalization(QFont.Capitalize) self.lineEdit.setFont(fuente) # ======================= SEÑALES ======================== # self.lineEdit.returnPressed.connect(lambda: print("Se presiono la tecla Enter...")) # self.lineEdit.textChanged.connect(lambda: print("El texto cambio...")) # self.lineEdit.textEdited.connect(lambda: print("El texto cambio...")) # ================================================================
Example #7
Source File: panel_modules.py From Dwarf with GNU General Public License v3.0 | 5 votes |
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
Example #8
Source File: panel_modules.py From Dwarf with GNU General Public License v3.0 | 5 votes |
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_])
Example #9
Source File: panel_modules.py From Dwarf with GNU General Public License v3.0 | 5 votes |
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_])
Example #10
Source File: panel_modules.py From Dwarf with GNU General Public License v3.0 | 5 votes |
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 ********************************** # ************************************************************************
Example #11
Source File: meta.py From FeelUOwn with GNU General Public License v3.0 | 5 votes |
def add_tabbar(self, tabbar): self._right_layout.addWidget(tabbar) self._right_layout.setAlignment(self.parent().tabbar, Qt.AlignLeft)
Example #12
Source File: DynamicSpline.py From PyQt with GNU General Public License v3.0 | 5 votes |
def __init__(self): super().__init__() self.m_step = 0 self.m_x = 5 self.m_y = 1 # 初始化图像 self.series = QSplineSeries(self) green_pen = QPen(Qt.red) green_pen.setWidth(3) self.series.setPen(green_pen) self.axisX = QValueAxis() self.axisY = QValueAxis() self.series.append(self.m_x, self.m_y) self.addSeries(self.series) self.addAxis(self.axisX, Qt.AlignBottom) self.addAxis(self.axisY, Qt.AlignLeft) self.series.attachAxis(self.axisX) self.series.attachAxis(self.axisY) self.axisX.setTickCount(5) self.axisX.setRange(0, 10) self.axisY.setRange(-5, 10) self.timer = QTimer(self) self.timer.setInterval(1000) self.timer.timeout.connect(self.handleTimeout) self.timer.start()
Example #13
Source File: ChartView.py From PyQt with GNU General Public License v3.0 | 5 votes |
def __getAlignment(self, alignment): ''' :param alignment: left|top|right|bottom ''' try: return getattr(Qt, "Align" + alignment.capitalize()) except: return Qt.AlignTop # if alignment == "left": # return Qt.AlignLeft # if alignment == "right": # return Qt.AlignRight # if alignment == "bottom": # return Qt.AlignBottom # return Qt.AlignTop
Example #14
Source File: LabelValueTableModel.py From urh with GNU General Public License v3.0 | 5 votes |
def headerData(self, section, orientation, role=Qt.DisplayRole): if role == Qt.DisplayRole and orientation == Qt.Horizontal: return self.header_labels[section] elif role == Qt.TextAlignmentRole: return Qt.AlignLeft return super().headerData(section, orientation, role)
Example #15
Source File: SimulatorMessageFieldModel.py From urh with GNU General Public License v3.0 | 5 votes |
def headerData(self, section, orientation, role=Qt.DisplayRole): if role == Qt.DisplayRole and orientation == Qt.Horizontal: return self.header_labels[section] elif role == Qt.TextAlignmentRole: return Qt.AlignLeft return super().headerData(section, orientation, role)
Example #16
Source File: main.py From controleEstoque with MIT License | 5 votes |
def conteudoTabelaLeft(self, tabela, row, col, data): item = QtWidgets.QTableWidgetItem() item.setTextAlignment(Qt.AlignJustify | Qt.AlignLeft | Qt.AlignVCenter) item.setFlags(Qt.NoItemFlags) item.setText(data) tabela.setItem(row, col, item) # Botão Tabela
Example #17
Source File: main.py From controleEstoque with MIT License | 5 votes |
def TabelaNomeTelefone(self, tabela, row, col, nome, telefone): item = QtWidgets.QLabel() item.setAlignment(Qt.AlignLeading|Qt.AlignLeft| Qt.AlignVCenter) item.setIndent(3) item.setMargin(0) item.setStyleSheet('background: #FFF') html = ((""" <span style="font-family:Arial; font-size:13px; ">{}</span><br/> <span style="font-family:Arial; font-size:10px;">{}</span>""" )).format(nome, telefone) item.setText(html) tabela.setCellWidget(row, col, item) # texto quantidade e status produtos tabela Produto
Example #18
Source File: first.py From FIRST-plugin-ida with GNU General Public License v2.0 | 5 votes |
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;
Example #19
Source File: player.py From MusicBox with MIT License | 5 votes |
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)
Example #20
Source File: find_widget.py From execution-trace-viewer with MIT License | 5 votes |
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)
Example #21
Source File: battleView.py From imperialism-remake with GNU General Public License v3.0 | 5 votes |
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)
Example #22
Source File: lrcwindow.py From QMusic with GNU Lesser General Public License v2.1 | 5 votes |
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)
Example #23
Source File: part-4.py From Writer-Tutorial with MIT License | 5 votes |
def alignLeft(self): self.text.setAlignment(Qt.AlignLeft)
Example #24
Source File: part-3.py From Writer-Tutorial with MIT License | 5 votes |
def alignLeft(self): self.text.setAlignment(Qt.AlignLeft)
Example #25
Source File: part-2.py From Writer-Tutorial with MIT License | 5 votes |
def alignLeft(self): self.text.setAlignment(Qt.AlignLeft)
Example #26
Source File: windows_notification_ui.py From persepolis with GNU General Public License v3.0 | 4 votes |
def __init__(self, parent, persepolis_setting): super().__init__(parent) self.persepolis_setting = persepolis_setting # set ui direction ui_direction = self.persepolis_setting.value('ui_direction') if ui_direction == 'rtl': self.setLayoutDirection(Qt.RightToLeft) elif ui_direction in 'ltr': self.setLayoutDirection(Qt.LeftToRight) # set size self.resize(QSize(400, 80)) self.setFixedWidth(400) # show this widget as ToolTip widget self.setWindowFlags(Qt.ToolTip) # find bottom right position bottom_right_screen = QDesktopWidget().availableGeometry().bottomRight() bottom_right_notification = QRect(QPoint(0, 0), QSize(410, 120)) bottom_right_notification.moveBottomRight(bottom_right_screen) self.move(bottom_right_notification.topLeft()) # get persepolis icon path icons = ':/' + \ str(self.persepolis_setting.value('settings/icons')) + '/' notification_horizontalLayout = QHBoxLayout(self) # persepolis icon svgWidget = QtSvg.QSvgWidget(':/persepolis.svg') svgWidget.setFixedSize(QSize(64, 64)) notification_horizontalLayout.addWidget(svgWidget) notification_verticalLayout = QVBoxLayout() # 2 labels for notification messages self.label1 = QLabel(self) self.label1.setAlignment(Qt.AlignLeft | Qt.AlignVCenter) self.label1.setStyleSheet("font-weight: bold") self.label1.setWordWrap(True) self.label2 = QLabel(self) self.label2.setWordWrap(True) self.label2.setAlignment(Qt.AlignLeft | Qt.AlignVCenter) notification_verticalLayout.addWidget(self.label1) notification_verticalLayout.addWidget(self.label2) notification_horizontalLayout.addLayout(notification_verticalLayout)
Example #27
Source File: telemetry.py From sparrow-wifi with GNU General Public License v3.0 | 4 votes |
def createChart(self): self.timeChart = QChart() titleFont = QFont() titleFont.setPixelSize(18) titleBrush = QBrush(QColor(0, 0, 255)) self.timeChart.setTitleFont(titleFont) self.timeChart.setTitleBrush(titleBrush) self.timeChart.setTitle('Signal (Past ' + str(self.maxPoints) + ' Samples)') # self.timeChart.addSeries(testseries) # self.timeChart.createDefaultAxes() self.timeChart.legend().hide() # Axis examples: https://doc.qt.io/qt-5/qtcharts-multiaxis-example.html newAxis = QValueAxis() newAxis.setMin(0) newAxis.setMax(self.maxPoints) newAxis.setTickCount(11) newAxis.setLabelFormat("%d") newAxis.setTitleText("Sample") self.timeChart.addAxis(newAxis, Qt.AlignBottom) newAxis = QValueAxis() newAxis.setMin(-100) newAxis.setMax(-10) newAxis.setTickCount(9) newAxis.setLabelFormat("%d") newAxis.setTitleText("dBm") self.timeChart.addAxis(newAxis, Qt.AlignLeft) chartBorder = Qt.darkGray self.timePlot = QChartView(self.timeChart, self) self.timePlot.setBackgroundBrush(chartBorder) self.timePlot.setRenderHint(QPainter.Antialiasing) self.timeSeries = QLineSeries() pen = QPen(Qt.yellow) pen.setWidth(2) self.timeSeries.setPen(pen) self.timeChart.addSeries(self.timeSeries) self.timeSeries.attachAxis(self.timeChart.axisX()) self.timeSeries.attachAxis(self.timeChart.axisY())
Example #28
Source File: first.py From FIRST-plugin-ida with GNU General Public License v2.0 | 4 votes |
def data(self, index, role): if not index.isValid(): return None if not (0 <= index.row() < self.rowCount()): 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; # Color background if role == Qt.BackgroundRole: function = self._data[index.row()] # Row is selected if index.row() in self.rows_selected: return FIRST.color_selected # Data has been updated since original if function.has_changed: return FIRST.color_changed # if function.id is not None: return FIRST.color_unchanged # Return the default color return FIRST.color_default if role == Qt.DisplayRole: function = self._data[index.row()] column = index.column() if 0 == column: return '0x{0:X}'.format(function.address) elif 1 == column: return function.name elif 2 == column: return function.prototype elif 3 == column: return function.comment return None return super(FIRST.Model.Upload, self).data(index, role)
Example #29
Source File: mainwindow.py From learningPyQt5 with Apache License 2.0 | 4 votes |
def __init__(self, parent=None): super(MainWindow, self).__init__(parent) self.setupUi(self) icon = QIcon() icon.addPixmap(QPixmap("qt.png")) self.setWindowIcon(icon) self.actionExit.triggered.connect(self.onExitTriggered) self.actionCopy.triggered.connect(self.onCopyTriggered) self.actionPaste.triggered.connect(self.onPasteTriggered) self.actionCut.triggered.connect(self.onCutTriggered) # QLabel self.label.setToolTip("这是一个气泡提示!") self.label.setAlignment(Qt.AlignLeft) # self.label.setText('修改后的文本') # QLineedit self.lineEdit.setAlignment(Qt.AlignRight) self.lineEdit.setEchoMode(QLineEdit.Normal) self.lineEdit.setText("这是一个QLineedit!") print(self.lineEdit.text()) self.lineEdit.textChanged.connect(self.onQLineeditTextChanged) self.lineEdit.editingFinished.connect(self.onQLineeditFinished) self.lineEdit.selectionChanged.connect(self.onQLineeditSelectionChanged) # QTextEdit strs = "MQTT(Message Queuing Telemetry Transport),是一个物联网传输协议,它被设计用于轻量级的发布/订阅式消息传输,旨在为低带宽和不稳定的网络环境中的物联网设备提供可靠的网络服务。MQTT是专门针对物联网开发的轻量级传输协议。MQTT协议针对低带宽网络,低计算能力的设备,做了特殊的优化,使得其能适应各种物联网应用场景。本文旨在研究其在消息发布/订阅/接收场景下的应用." self.textEdit.setPlainText(strs) print(self.textEdit.toHtml()) # Qpushbutton self.pushButton.setCheckable(True) self.pushButton.setEnabled(False) self.pushButton.clicked.connect(self.onClicked) self.timer = QTimer(self) self.count = 0 self.timer.timeout.connect(self.showNum) # self.timer.timeout.connect(self.showNum2) # self.startCount()
Example #30
Source File: CuraSplashScreen.py From Cura with GNU Lesser General Public License v3.0 | 4 votes |
def drawContents(self, painter): if self._to_stop: return painter.save() painter.setPen(QColor(255, 255, 255, 255)) painter.setRenderHint(QPainter.Antialiasing) painter.setRenderHint(QPainter.Antialiasing, True) version = Application.getInstance().getVersion().split("-") # Draw version text font = QFont() # Using system-default font here font.setPixelSize(18) painter.setFont(font) painter.drawText(60, 70 + self._version_y_offset, 330 * self._scale, 230 * self._scale, Qt.AlignLeft | Qt.AlignTop, version[0]) if len(version) > 1: font.setPixelSize(16) painter.setFont(font) painter.setPen(QColor(200, 200, 200, 255)) painter.drawText(247, 105 + self._version_y_offset, 330 * self._scale, 255 * self._scale, Qt.AlignLeft | Qt.AlignTop, version[1]) painter.setPen(QColor(255, 255, 255, 255)) # Draw the loading image pen = QPen() pen.setWidth(6 * self._scale) pen.setColor(QColor(32, 166, 219, 255)) painter.setPen(pen) painter.drawArc(60, 150, 32 * self._scale, 32 * self._scale, self._loading_image_rotation_angle * 16, 300 * 16) # Draw message text if self._current_message: font = QFont() # Using system-default font here font.setPixelSize(13) pen = QPen() pen.setColor(QColor(255, 255, 255, 255)) painter.setPen(pen) painter.setFont(font) painter.drawText(100, 128, 170, 64, Qt.AlignLeft | Qt.AlignVCenter | Qt.TextWordWrap, self._current_message) painter.restore() super().drawContents(painter)