本文整理汇总了Python中AnyQt.QtWidgets.QLabel.show方法的典型用法代码示例。如果您正苦于以下问题:Python QLabel.show方法的具体用法?Python QLabel.show怎么用?Python QLabel.show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AnyQt.QtWidgets.QLabel
的用法示例。
在下文中一共展示了QLabel.show方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: PreprocessorModule
# 需要导入模块: from AnyQt.QtWidgets import QLabel [as 别名]
# 或者: from AnyQt.QtWidgets.QLabel import show [as 别名]
class PreprocessorModule(gui.OWComponent, QWidget):
"""The base widget for the pre-processing modules."""
change_signal = pyqtSignal() # Emitted when the settings are changed.
title = NotImplemented
attribute = NotImplemented
methods = NotImplemented
single_method = True
toggle_enabled = True
enabled = settings.Setting(True)
disabled_value = None
Layout = QGridLayout
def __init__(self, master):
QWidget.__init__(self)
gui.OWComponent.__init__(self, master)
self.master = master
# Title bar.
title_holder = QWidget()
title_holder.setSizePolicy(QSizePolicy.MinimumExpanding,
QSizePolicy.Fixed)
title_holder.setStyleSheet("""
.QWidget {
background: qlineargradient( x1:0 y1:0, x2:0 y2:1,
stop:0 #F8F8F8, stop:1 #C8C8C8);
border-bottom: 1px solid #B3B3B3;
}
""")
self.titleArea = QHBoxLayout()
self.titleArea.setContentsMargins(10, 5, 10, 5)
self.titleArea.setSpacing(0)
title_holder.setLayout(self.titleArea)
self.title_label = QLabel(self.title)
self.title_label.mouseDoubleClickEvent = self.on_toggle
self.title_label.setStyleSheet('font-size: 12px; border: 2px solid red;')
self.titleArea.addWidget(self.title_label)
self.off_label = QLabel('[disabled]')
self.off_label.setStyleSheet('color: #B0B0B0; margin-left: 5px;')
self.titleArea.addWidget(self.off_label)
self.off_label.hide()
self.titleArea.addStretch()
# Root.
self.rootArea = QVBoxLayout()
self.rootArea.setContentsMargins(0, 0, 0, 0)
self.rootArea.setSpacing(0)
self.setLayout(self.rootArea)
self.rootArea.addWidget(title_holder)
self.contents = QWidget()
contentArea = QVBoxLayout()
contentArea.setContentsMargins(15, 10, 15, 10)
self.contents.setLayout(contentArea)
self.rootArea.addWidget(self.contents)
self.method_layout = self.Layout()
self.setup_method_layout()
self.contents.layout().addLayout(self.method_layout)
if self.toggle_enabled:
self.on_off_button = OnOffButton(enabled=self.enabled)
self.on_off_button.stateChanged.connect(self.on_toggle)
self.on_off_button.setContentsMargins(0, 0, 0, 0)
self.titleArea.addWidget(self.on_off_button)
self.display_widget()
@staticmethod
def get_tooltip(method):
return ' '.join([l.strip() for l in method.__doc__.split('\n')]).strip('.') \
if method.__doc__ else None
@staticmethod
def textify(text):
return text.replace('&', '&&')
@property
def value(self):
if self.enabled:
return self.get_value()
return self.disabled_value
def setup_method_layout(self):
raise NotImplementedError
def on_toggle(self, event=None):
# Activated when the widget is enabled/disabled.
self.enabled = not self.enabled
self.display_widget()
self.update_value()
def display_widget(self):
if self.enabled:
self.off_label.hide()
self.contents.show()
self.title_label.setStyleSheet('color: #000000;')
else:
#.........这里部分代码省略.........