本文整理汇总了Python中qt.QLabel.setEnabled方法的典型用法代码示例。如果您正苦于以下问题:Python QLabel.setEnabled方法的具体用法?Python QLabel.setEnabled怎么用?Python QLabel.setEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qt.QLabel
的用法示例。
在下文中一共展示了QLabel.setEnabled方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ScoringDialog
# 需要导入模块: from qt import QLabel [as 别名]
# 或者: from qt.QLabel import setEnabled [as 别名]
class ScoringDialog(QWidget):
"""a dialog for entering the scores"""
# pylint: disable=too-many-instance-attributes
def __init__(self, scene):
QWidget.__init__(self)
self.scene = scene
decorateWindow(self, m18n("Scoring for this Hand"))
self.nameLabels = [None] * 4
self.spValues = [None] * 4
self.windLabels = [None] * 4
self.wonBoxes = [None] * 4
self.detailsLayout = [None] * 4
self.details = [None] * 4
self.__tilePixMaps = []
self.__meldPixMaps = []
grid = QGridLayout(self)
pGrid = QGridLayout()
grid.addLayout(pGrid, 0, 0, 2, 1)
pGrid.addWidget(QLabel(m18nc("kajongg", "Player")), 0, 0)
pGrid.addWidget(QLabel(m18nc("kajongg", "Wind")), 0, 1)
pGrid.addWidget(QLabel(m18nc("kajongg", "Score")), 0, 2)
pGrid.addWidget(QLabel(m18n("Winner")), 0, 3)
self.detailTabs = QTabWidget()
self.detailTabs.setDocumentMode(True)
pGrid.addWidget(self.detailTabs, 0, 4, 8, 1)
for idx in range(4):
self.setupUiForPlayer(pGrid, idx)
self.draw = QCheckBox(m18nc("kajongg", "Draw"))
self.draw.clicked.connect(self.wonChanged)
btnPenalties = QPushButton(m18n("&Penalties"))
btnPenalties.clicked.connect(self.penalty)
self.btnSave = QPushButton(m18n("&Save Hand"))
self.btnSave.clicked.connect(self.game.nextScoringHand)
self.btnSave.setEnabled(False)
self.setupUILastTileMeld(pGrid)
pGrid.setRowStretch(87, 10)
pGrid.addWidget(self.draw, 7, 3)
self.cbLastTile.currentIndexChanged.connect(self.slotLastTile)
self.cbLastMeld.currentIndexChanged.connect(self.slotInputChanged)
btnBox = QHBoxLayout()
btnBox.addWidget(btnPenalties)
btnBox.addWidget(self.btnSave)
pGrid.addLayout(btnBox, 8, 4)
StateSaver(self)
self.refresh()
@property
def game(self):
"""proxy"""
return self.scene.game
def setupUILastTileMeld(self, pGrid):
"""setup UI elements for last tile and last meld"""
self.lblLastTile = QLabel(m18n("&Last Tile:"))
self.cbLastTile = QComboBox()
self.cbLastTile.setMinimumContentsLength(1)
vpol = QSizePolicy()
vpol.setHorizontalPolicy(QSizePolicy.Fixed)
self.cbLastTile.setSizePolicy(vpol)
self.cbLastTile.setSizeAdjustPolicy(QComboBox.AdjustToMinimumContentsLengthWithIcon)
self.lblLastTile.setBuddy(self.cbLastTile)
self.lblLastMeld = QLabel(m18n("L&ast Meld:"))
self.prevLastTile = None
self.cbLastMeld = QComboBox()
self.cbLastMeld.setMinimumContentsLength(1)
self.cbLastMeld.setSizePolicy(vpol)
self.cbLastMeld.setSizeAdjustPolicy(QComboBox.AdjustToMinimumContentsLengthWithIcon)
self.lblLastMeld.setBuddy(self.cbLastMeld)
self.comboTilePairs = set()
pGrid.setRowStretch(6, 5)
pGrid.addWidget(self.lblLastTile, 7, 0, 1, 2)
pGrid.addWidget(self.cbLastTile, 7, 2, 1, 1)
pGrid.addWidget(self.lblLastMeld, 8, 0, 1, 2)
pGrid.addWidget(self.cbLastMeld, 8, 2, 1, 2)
def setupUiForPlayer(self, pGrid, idx):
"""setup UI elements for a player"""
self.spValues[idx] = QSpinBox()
self.nameLabels[idx] = QLabel()
self.nameLabels[idx].setBuddy(self.spValues[idx])
self.windLabels[idx] = WindLabel()
pGrid.addWidget(self.nameLabels[idx], idx + 2, 0)
pGrid.addWidget(self.windLabels[idx], idx + 2, 1)
pGrid.addWidget(self.spValues[idx], idx + 2, 2)
self.wonBoxes[idx] = QCheckBox("")
pGrid.addWidget(self.wonBoxes[idx], idx + 2, 3)
self.wonBoxes[idx].clicked.connect(self.wonChanged)
self.spValues[idx].valueChanged.connect(self.slotInputChanged)
detailTab = QWidget()
self.detailTabs.addTab(detailTab, "")
self.details[idx] = QWidget()
detailTabLayout = QVBoxLayout(detailTab)
detailTabLayout.addWidget(self.details[idx])
detailTabLayout.addStretch()
self.detailsLayout[idx] = QVBoxLayout(self.details[idx])
def refresh(self):
#.........这里部分代码省略.........