mirror of
https://github.com/muziing/PySide6-Code-Tutorial.git
synced 2025-01-30 14:22:53 +08:00
Fix trailing-whitespace
This commit is contained in:
parent
424e942f1a
commit
a7ad0e6006
@ -74,6 +74,6 @@ if (QLabel label = QLabel (obj)) { label.setText(tr("Ping"))
|
||||
|
||||
------
|
||||
|
||||
© 2022 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the [GNU Free Documentation License version 1.3](https://www.gnu.org/licenses/fdl-1.3.html) as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.
|
||||
© 2022 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the [GNU Free Documentation License version 1.3](https://www.gnu.org/licenses/fdl-1.3.html) as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.
|
||||
|
||||
© 2022 zh_CN Translation by muzing\<muzi2001@foxmail.com>.
|
||||
|
@ -1,8 +1,3 @@
|
||||
import sys
|
||||
|
||||
from PySide6 import QtWidgets
|
||||
from PySide6.QtCore import Qt
|
||||
|
||||
"""
|
||||
QWidget 键盘输入焦点控制
|
||||
|
||||
@ -14,7 +9,7 @@ QWidget 键盘输入焦点控制
|
||||
|
||||
https://doc.qt.io/qt-6/qwidget.html#setFocusProxy
|
||||
.setFocusPolicy(policy: Qt.FocusPolicy) 设置焦点策略,详见下方Qt.FocusPolicy
|
||||
.focusPolicy() -> Qt.FocusPolicy 返回该控件的焦点策略
|
||||
.focusPolicy() -> Qt.FocusPolicy 返回该控件的焦点策略
|
||||
|
||||
Qt.FocusPolicy 具体分为如下数种:
|
||||
https://doc.qt.io/qt-6/qt.html#FocusPolicy-enum
|
||||
@ -32,6 +27,11 @@ Qt.WheelFocus 补充:若只有一个控件设置为此策略,则需要当前
|
||||
|
||||
"""
|
||||
|
||||
import sys
|
||||
|
||||
from PySide6 import QtWidgets
|
||||
from PySide6.QtCore import Qt
|
||||
|
||||
|
||||
class MyWidget(QtWidgets.QWidget):
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
@ -1,14 +1,10 @@
|
||||
import sys
|
||||
|
||||
from PySide6 import QtCore, QtWidgets
|
||||
|
||||
"""
|
||||
QComboBox 信号
|
||||
提供了多种精细的信号供使用
|
||||
|
||||
.activated(index: int)
|
||||
当用户在组合下拉框中选中一个条目时发射此信号,索引作为参数传递。即使选中项未改变也会发射
|
||||
|
||||
|
||||
.currentIndexChanged(index: int)
|
||||
当当前索引由用户交互或编程方式改变时发射此信号,索引作为参数传递。
|
||||
若combobox为空或当前索引已重置,则传递条目的 index 或 -1
|
||||
@ -18,11 +14,11 @@ QComboBox 信号
|
||||
|
||||
.editTextChanged(text: str)
|
||||
当启用了可编辑模式,且编辑器中的文本发生改变时发射此信号,新的文本作为参数传递
|
||||
|
||||
|
||||
.highlighted(index: int)
|
||||
当用户高亮(光标移入或键盘选择)了弹出菜单中的某一条目时发射此信号
|
||||
索引值作为参数传递
|
||||
|
||||
|
||||
.textActivated(text: str)
|
||||
当用户选择了条目之一时,发射此信号并将文本作为参数传递
|
||||
即使选择未发生改变也会发射此信号
|
||||
@ -33,6 +29,10 @@ QComboBox 信号
|
||||
|
||||
"""
|
||||
|
||||
import sys
|
||||
|
||||
from PySide6 import QtCore, QtWidgets
|
||||
|
||||
|
||||
class MyWidget(QtWidgets.QWidget):
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
@ -1,7 +1,3 @@
|
||||
import sys
|
||||
|
||||
from PySide6 import QtCore, QtWidgets
|
||||
|
||||
"""
|
||||
QDialog 槽、结果、尺寸拖拽控件
|
||||
|
||||
@ -14,7 +10,7 @@ QDialog有一组槽,用于显示、关闭对话框并返回结果:
|
||||
则done()也将导致局部事件循环结束,且exec()返回r。
|
||||
.exec() 将对话框作为模态对话框显示。(默认为应用程序级模态)此函数返回QDialog.Accepted或QDialog.Rejected。
|
||||
尽量避免使用exec()函数,而用open()替代。因为open()是异步的,并且不会增加额外的事件循环
|
||||
|
||||
|
||||
QDialog.result中保存了对话框获得的结果,也可以通过代码显式设置结果码:
|
||||
.result() -> int 获取模态对话框的结果码,QDialog.Accepted为1,QDialog.Rejected为0
|
||||
.setResult(i: int) 将模态对话框的结果码设置为i
|
||||
@ -30,6 +26,10 @@ QDialog可以指定是否在窗口右下角显示一个QSizeGrip控件,方便
|
||||
|
||||
"""
|
||||
|
||||
import sys
|
||||
|
||||
from PySide6 import QtCore, QtWidgets
|
||||
|
||||
|
||||
class MyWidget(QtWidgets.QWidget):
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
@ -67,7 +67,7 @@ class QSSLoader:
|
||||
```python
|
||||
app = QApplication(sys.argv)
|
||||
window = MainWindow()
|
||||
|
||||
|
||||
style_file = './style.qss'
|
||||
style_sheet = QSSLoader.read_qss_file(style_file)
|
||||
window.setStyleSheet(style_sheet)
|
||||
|
Loading…
x
Reference in New Issue
Block a user