当前位置: 首页>>代码示例>>Python>>正文


Python QLabel.setToolTip方法代码示例

本文整理汇总了Python中guidata.qt.QtGui.QLabel.setToolTip方法的典型用法代码示例。如果您正苦于以下问题:Python QLabel.setToolTip方法的具体用法?Python QLabel.setToolTip怎么用?Python QLabel.setToolTip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在guidata.qt.QtGui.QLabel的用法示例。


在下文中一共展示了QLabel.setToolTip方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_image_layout

# 需要导入模块: from guidata.qt.QtGui import QLabel [as 别名]
# 或者: from guidata.qt.QtGui.QLabel import setToolTip [as 别名]
def get_image_layout(imagename, text="", tooltip="", alignment=Qt.AlignLeft):
    """
    Construct a QHBoxLayout including image from the file with specified name,
    left-aligned text [with specified tooltip]
    Return (layout, label)
    """
    layout = QHBoxLayout()
    if alignment in (Qt.AlignCenter, Qt.AlignRight):
        layout.addStretch()
    layout.addWidget(get_image_label(imagename))
    label = QLabel(text)
    label.setToolTip(tooltip)
    layout.addWidget(label)
    if alignment in (Qt.AlignCenter, Qt.AlignLeft):
        layout.addStretch()
    return (layout, label)    
开发者ID:CARIBOuSystem,项目名称:guidata,代码行数:18,代码来源:configtools.py

示例2: DataSetShowWidget

# 需要导入模块: from guidata.qt.QtGui import QLabel [as 别名]
# 或者: from guidata.qt.QtGui.QLabel import setToolTip [as 别名]
class DataSetShowWidget(AbstractDataSetWidget):
    """Read-only base widget"""
    READ_ONLY = True
    def __init__(self, item, parent_layout):
        AbstractDataSetWidget.__init__(self, item, parent_layout)
        self.group = QLabel()
        wordwrap = item.get_prop_value("display", "wordwrap", False)
        self.group.setWordWrap(wordwrap)
        self.group.setToolTip(item.get_help())
        self.group.setStyleSheet( LABEL_CSS )
        self.group.setTextInteractionFlags(Qt.TextSelectableByMouse)
        #self.group.setEnabled(False)

    def get(self):
        """Override AbstractDataSetWidget method"""
        self.set_state()
        text = self.item.get_string_value()
        self.group.setText(text)

    def set(self):
        """Read only..."""
        pass
开发者ID:Alwnikrotikz,项目名称:guidata,代码行数:24,代码来源:qtwidgets.py

示例3: AbstractDataSetWidget

# 需要导入模块: from guidata.qt.QtGui import QLabel [as 别名]
# 或者: from guidata.qt.QtGui.QLabel import setToolTip [as 别名]
class AbstractDataSetWidget(object):
    """
    Base class for 'widgets' handled by `DataSetEditLayout` and it's derived 
    classes.
    
    This is a generic representation of an input (or display) widget that
    has a label and one or more entry field.
    
    `DataSetEditLayout` uses a registry of *Item* to *Widget* mapping in order 
    to automatically create a GUI for a `DataSet` structure
    """
    READ_ONLY = False
    def __init__(self, item, parent_layout):
        """Derived constructors should create the necessary widgets
        The base class keeps a reference to item and parent 
        """
        self.item = item
        self.parent_layout = parent_layout
        self.group = None # Layout/Widget grouping items
        self.label = None
        self.build_mode = False

    def place_label(self, layout, row, column):
        """
        Place item label on layout at specified position (row, column)
        """
        label_text = self.item.get_prop_value("display", "label")
        unit = self.item.get_prop_value("display", "unit", '')
        if unit and not self.READ_ONLY:
            label_text += (' (%s)' % unit)
        self.label = QLabel(label_text)
        self.label.setToolTip(self.item.get_help())
        layout.addWidget(self.label, row, column)

    def place_on_grid(self, layout, row, label_column, widget_column,
                      row_span=1, column_span=1):
        """
        Place widget on layout at specified position
        """
        self.place_label(layout, row, label_column)
        layout.addWidget(self.group, row, widget_column, row_span, column_span)
    
    def is_active(self):
        """
        Return True if associated item is active
        """
        return self.item.get_prop_value("display", "active", True)
    
    def check(self):
        """
        Item validator
        """
        return True
    
    def set(self):
        """
        Update data item value from widget contents
        """
        # XXX: consider using item.set instead of item.set_from_string...
        self.item.set_from_string(self.value())
    
    def get(self):
        """
        Update widget contents from data item value
        """
        pass

    def value(self):
        """
        Returns the widget's current value
        """
        return None

    def set_state(self):
        """
        Update the visual status of the widget
        """
        active = self.is_active()
        if self.group:
            self.group.setEnabled(active)
        if self.label:
            self.label.setEnabled(active)
开发者ID:artillan,项目名称:guidata,代码行数:84,代码来源:qtitemwidgets.py


注:本文中的guidata.qt.QtGui.QLabel.setToolTip方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。