[PYQT] API
API
QButtonGroup
参考:
https://www.wandouip.com/t5i220093/
注意:需要先将按钮加到分组中,才能对组内的button操作
获取被选项索引id
checkedId()
返回:int,按钮id索引从-2开始,没有0 -1。
应用:调用时,获取被选中的按钮的id。如果没有选中项,则返回-1
获取被选按钮
checkedButton
返回:QAbstractButton,如果未选择,则返回None
应用:获取被选中的按钮
QComboxBox
Table
PyQt5 设置QTableWidget或QTreeWidget滚动条隐藏
滚动条三种状态 \
ScrollBarAlwaysOff-始终隐藏 \
ScrollBarAlwaysOn-始终开启 \
ScrollBarAsNeeded-需要时出现
self.tab_loop_tableWidget.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded)
CSS
背景图以拉伸方式(不重复)填充背景
.background-pic\
{\
background-image: url(图片地址);\
background-attachment: fixed;\
background-repeat: no-repeat;\
background-size: cover;\
}
label = QLabel()
label.setStyleSheet("background-image:url(:/loopType/loopType_B.jpg);background-repeat: no-repeat;background-position: center 0;background-attachment: fixed;")
label.setAlignment(QtCore.Qt.AlignHCenter | QtCore.Qt.AlignVCenter)
label.setScaledContents(True)
self.tab_loop_tableWidget.setCellWidget(0, 5, label)
本作品采用《CC 协议》,转载必须注明作者和本文链接
推荐文章: