[PYQT] API

kingdelee發表於2019-07-24

API

QButtonGroup

參考:
https://www.wandouip.com/t5i220093/

注意:需要先將按鈕加到分組中,才能對組內的button操作

獲取被選項索引id

checkedId()
返回:int,按鈕id索引從-2開始,沒有0 -1。
應用:呼叫時,獲取被選中的按鈕的id。如果沒有選中項,則返回-1

獲取被選按鈕

checkedButton
返回:QAbstractButton,如果未選擇,則返回None
應用:獲取被選中的按鈕

QComboxBox

Linux

Table

滾動條三種狀態 \
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 協議》,轉載必須註明作者和本文連結

相關文章